mirror of https://github.com/astral-sh/ruff
Fix regression with line-based rules not being ignored per-file (#2311)
This commit is contained in:
parent
f308f9f27e
commit
1a32d873f0
|
|
@ -132,15 +132,6 @@ pub fn check_path(
|
|||
doc_lines.dedup();
|
||||
}
|
||||
|
||||
// Ignore diagnostics based on per-file-ignores.
|
||||
if !diagnostics.is_empty() && !settings.per_file_ignores.is_empty() {
|
||||
let ignores = fs::ignores_from_path(path, &settings.per_file_ignores)?;
|
||||
|
||||
if !ignores.is_empty() {
|
||||
diagnostics.retain(|diagnostic| !ignores.contains(&diagnostic.kind.rule()));
|
||||
}
|
||||
};
|
||||
|
||||
// Run the lines-based rules.
|
||||
if settings
|
||||
.rules
|
||||
|
|
@ -158,6 +149,15 @@ pub fn check_path(
|
|||
));
|
||||
}
|
||||
|
||||
// Ignore diagnostics based on per-file-ignores.
|
||||
if !diagnostics.is_empty() && !settings.per_file_ignores.is_empty() {
|
||||
let ignores = fs::ignores_from_path(path, &settings.per_file_ignores)?;
|
||||
|
||||
if !ignores.is_empty() {
|
||||
diagnostics.retain(|diagnostic| !ignores.contains(&diagnostic.kind.rule()));
|
||||
}
|
||||
};
|
||||
|
||||
// Enforce `noqa` directives.
|
||||
if (matches!(noqa, flags::Noqa::Enabled) && !diagnostics.is_empty())
|
||||
|| settings
|
||||
|
|
|
|||
Loading…
Reference in New Issue