Skip to content

Commit 38e9923

Browse files
ntBreMichaReiser
authored andcommitted
Add new noqa specification to the docs
1 parent a90cf9d commit 38e9923

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

docs/linter.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,26 @@ Ruff can _automatically add_ `noqa` directives to all lines that contain violati
353353
useful when migrating a new codebase to Ruff. To automatically add `noqa` directives to all
354354
relevant lines (with the appropriate rule codes), run: `ruff check /path/to/file.py --add-noqa`.
355355

356+
### Full suppression comment specification
357+
358+
The full specification is as follows:
359+
360+
- An inline blanket `noqa` comment is given by a case-insensitive match for
361+
`#noqa` with optional whitespace after the `#` symbol, followed by either: the
362+
end of the comment, the beginning of a new comment (`#`), or whitespace
363+
followed by any character other than `:`.
364+
- An inline rule suppression is given by first finding a case-insensitive match
365+
for `#noqa` with optional whitespace after the `#` symbol, optional whitespace
366+
after noqa, and followed by the symbol `:`. After this we are expected to have
367+
a list of rule codes which is given by sequences of uppercase ascii characters
368+
followed by ascii digits, separated by whitespace or commas. The list ends at
369+
the last valid code. We will attempt to interpret rules with a missing
370+
delimiter (e.g. `F401F841`), though a warning will be emitted in this case.
371+
- A file-level exemption comment is given by a case-sensitive match for `#ruff:`
372+
or `#flake8:`, with optional whitespace after `#` and before `:`, followed by
373+
optional whitespace and a case-insensitive match for `noqa`. After this, the
374+
specification is as in the inline case.
375+
356376
### Action comments
357377

358378
Ruff respects isort's [action comments](https://pycqa.github.io/isort/docs/configuration/action_comments.html)

0 commit comments

Comments
 (0)