mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Warn on invalid noqa even when there are no diagnostics (#16178)
On `main` we warn the user if there is an invalid noqa comment[^1] and at least one of the following holds: - There is at least one diagnostic - A lint rule related to `noqa`s is enabled (e.g. `RUF100`) This is probably strange behavior from the point of view of the user, so we now show invalid `noqa`s even when there are no diagnostics. Closes #12831 [^1]: For the current definition of "invalid noqa comment", which may be expanded in #12811 . This PR is independent of loc. cit. in the sense that the CLI warnings should be consistent, regardless of which `noqa` comments are considered invalid.
This commit is contained in:
parent
3a0d45c85b
commit
f29c7b03ec
3 changed files with 39 additions and 1 deletions
|
@ -267,7 +267,7 @@ pub fn check_path(
|
|||
}
|
||||
|
||||
// Enforce `noqa` directives.
|
||||
if (noqa.is_enabled() && !diagnostics.is_empty())
|
||||
if noqa.is_enabled()
|
||||
|| settings
|
||||
.rules
|
||||
.iter_enabled()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue