mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 22:01:47 +00:00
Respect per-file-ignores for RUF100 with no other diagnostics (#11058)
## Summary The existing test didn't cover the case in which there are _no_ other diagnostics in the file. Closes https://github.com/astral-sh/ruff/issues/10906.
This commit is contained in:
parent
c80b9a4a90
commit
d544199272
3 changed files with 29 additions and 1 deletions
|
@ -265,7 +265,13 @@ pub fn check_path(
|
|||
}
|
||||
|
||||
// Ignore diagnostics based on per-file-ignores.
|
||||
let per_file_ignores = if !diagnostics.is_empty() && !settings.per_file_ignores.is_empty() {
|
||||
let per_file_ignores = if (!diagnostics.is_empty()
|
||||
|| settings
|
||||
.rules
|
||||
.iter_enabled()
|
||||
.any(|rule_code| rule_code.lint_source().is_noqa()))
|
||||
&& !settings.per_file_ignores.is_empty()
|
||||
{
|
||||
fs::ignores_from_path(path, &settings.per_file_ignores)
|
||||
} else {
|
||||
RuleSet::empty()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue