Match rule prefixes from external codes setting in unused-noqa (#8177)

Supersedes https://github.com/astral-sh/ruff/pull/8176
Closes https://github.com/astral-sh/ruff/pull/8174

## Test plan

Old snapshot contains the new / unmatched `V` code
New snapshot contains no `V` prefixed codes
This commit is contained in:
Zanie Blue 2023-10-24 17:28:35 -05:00 committed by GitHub
parent a6cc56fd98
commit 6f31e9c00e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 426 additions and 115 deletions

View file

@ -226,7 +226,7 @@ impl Configuration {
dummy_variable_rgx: lint
.dummy_variable_rgx
.unwrap_or_else(|| DUMMY_VARIABLE_RGX.clone()),
external: FxHashSet::from_iter(lint.external.unwrap_or_default()),
external: lint.external.unwrap_or_default(),
ignore_init_module_imports: lint.ignore_init_module_imports.unwrap_or_default(),
tab_size: self.indent_width.unwrap_or_default(),
namespace_packages: self.namespace_packages.unwrap_or_default(),

View file

@ -548,7 +548,7 @@ pub struct LintCommonOptions {
)]
pub extend_unfixable: Option<Vec<RuleSelector>>,
/// A list of rule codes that are unsupported by Ruff, but should be
/// A list of rule codes or prefixes that are unsupported by Ruff, but should be
/// preserved when (e.g.) validating `# noqa` directives. Useful for
/// retaining `# noqa` directives that cover plugins not yet implemented
/// by Ruff.
@ -556,9 +556,9 @@ pub struct LintCommonOptions {
default = "[]",
value_type = "list[str]",
example = r#"
# Avoiding flagging (and removing) `V101` from any `# noqa`
# directives, despite Ruff's lack of support for `vulture`.
external = ["V101"]
# Avoiding flagging (and removing) any codes starting with `V` from any
# `# noqa` directives, despite Ruff's lack of support for `vulture`.
external = ["V"]
"#
)]
pub external: Option<Vec<String>>,