diff --git a/src/rules/eradicate/detection.rs b/src/rules/eradicate/detection.rs index 4080e23f99a6d..6caee16e7dea0 100644 --- a/src/rules/eradicate/detection.rs +++ b/src/rules/eradicate/detection.rs @@ -4,7 +4,7 @@ use regex::Regex; static ALLOWLIST_REGEX: Lazy = 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 = Lazy::new(|| Regex::new(r"^[()\[\]{}\s]+$").unwrap()); @@ -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("#},", &[]));