Add example of per-file ignores to the README (#488)

This commit is contained in:
Charlie Marsh 2022-10-27 12:58:52 -04:00 committed by GitHub
parent 416aa298ac
commit bad2d7ba85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -95,6 +95,10 @@ select = [
"F401",
"F403",
]
per-file-ignores = [
"__init__.py:F401",
"path/to/file.py:F401"
]
```
Alternatively, on the command-line:

View File

@ -1,3 +1,5 @@
import os
print(__path__)
__all__ = ["a", "b", "c"]

View File

@ -5,3 +5,6 @@ extend-exclude = [
"migrations",
"directory/also_excluded.py",
]
per-file-ignores = [
"__init__.py:F401",
]

View File

@ -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,
}