mirror of https://github.com/astral-sh/ruff
Add example of per-file ignores to the README (#488)
This commit is contained in:
parent
416aa298ac
commit
bad2d7ba85
|
|
@ -95,6 +95,10 @@ select = [
|
|||
"F401",
|
||||
"F403",
|
||||
]
|
||||
per-file-ignores = [
|
||||
"__init__.py:F401",
|
||||
"path/to/file.py:F401"
|
||||
]
|
||||
```
|
||||
|
||||
Alternatively, on the command-line:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import os
|
||||
|
||||
print(__path__)
|
||||
|
||||
__all__ = ["a", "b", "c"]
|
||||
|
|
|
|||
|
|
@ -5,3 +5,6 @@ extend-exclude = [
|
|||
"migrations",
|
||||
"directory/also_excluded.py",
|
||||
]
|
||||
per-file-ignores = [
|
||||
"__init__.py:F401",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -362,7 +362,10 @@ other-attribute = 1
|
|||
extend_select: vec![],
|
||||
ignore: vec![],
|
||||
extend_ignore: vec![],
|
||||
per_file_ignores: vec![],
|
||||
per_file_ignores: vec![StrCheckCodePair {
|
||||
pattern: "__init__.py".to_string(),
|
||||
code: CheckCode::F401
|
||||
}],
|
||||
dummy_variable_rgx: None,
|
||||
target_version: None,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue