Skip to content

Commit

Permalink
fix(era001): mypy and SPDX-License-Identifier false positives
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Feb 5, 2023
1 parent 6b3ae1a commit a5bb0c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rules/eradicate/detection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use regex::Regex;

static ALLOWLIST_REGEX: Lazy<Regex> = Lazy::new(|| {
Regex::new(
r"^(?i)(?:pylint|pyright|noqa|nosec|type:\s*ignore|fmt:\s*(on|off)|isort:\s*(on|off|skip|skip_file|split|dont-add-imports(:\s*\[.*?])?))"
r"^(?i)(?:pylint|pyright|noqa|nosec|type:\s*ignore|fmt:\s*(on|off)|isort:\s*(on|off|skip|skip_file|split|dont-add-imports(:\s*\[.*?])?)|mypy:|SPDX-License-Identifier:)"
).unwrap()
});
static BRACKET_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"^[()\[\]{}\s]+$").unwrap());
Expand Down Expand Up @@ -128,6 +128,11 @@ mod tests {
"# Issue #999: This is not code",
&[]
));
assert!(!comment_contains_code("# mypy: allow-untyped-calls", &[]));
assert!(!comment_contains_code(
"# SPDX-License-Identifier: MIT",
&[]
));

// TODO(charlie): This should be `true` under aggressive mode.
assert!(!comment_contains_code("#},", &[]));
Expand Down

0 comments on commit a5bb0c6

Please sign in to comment.