mirror of
https://github.com/astral-sh/ruff.git
synced 2026-10-28 10:45:37 +08:00
Add another example and glob reference for lint.per-file-ignores (#28106)
## Summary I came across this syntax while exploring the `glob` crate and found it quite useful. I think it would be worth adding a short example to the documentation. ## Test Plan
This commit is contained in:
1 parent
3c77dcc2a5
commit
088b7b5f77
2 files changed
+6
-2
No files matched your search
@@ -1092,6 +1092,8 @@ pub struct LintCommonOptions {
|
||||
/// A list of mappings from file pattern to rule codes or prefixes to
|
||||
/// exclude, when considering any matching files. An initial '!' negates
|
||||
/// the file pattern.
|
||||
///
|
||||
/// For more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).
|
||||
#[option(
|
||||
default = "{}",
|
||||
value_type = "dict[str, list[RuleSelector]]",
|
||||
@@ -1102,6 +1104,8 @@ pub struct LintCommonOptions {
|
||||
"path/to/file.py" = ["E402"]
|
||||
# Ignore `D` rules everywhere except for the `src/` directory.
|
||||
"!src/**.py" = ["D"]
|
||||
# Ignore check for packages that are missing an `__init__.py` file.
|
||||
"{benchmark,scripts,.github/action-name/}/*.py" = ["INP001"]
|
||||
"#
|
||||
)]
|
||||
pub per_file_ignores: Option<FxHashMap<String, Vec<UnresolvedRuleSelector>>>,
|
||||
|
||||
Generated
+2
-2
@@ -582,7 +582,7 @@
|
||||
"deprecated": true
|
||||
},
|
||||
"per-file-ignores": {
|
||||
"description": "A list of mappings from file pattern to rule codes or prefixes to\nexclude, when considering any matching files. An initial '!' negates\nthe file pattern.",
|
||||
"description": "A list of mappings from file pattern to rule codes or prefixes to\nexclude, when considering any matching files. An initial '!' negates\nthe file pattern.\n\nFor more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
@@ -2512,7 +2512,7 @@
|
||||
]
|
||||
},
|
||||
"per-file-ignores": {
|
||||
"description": "A list of mappings from file pattern to rule codes or prefixes to\nexclude, when considering any matching files. An initial '!' negates\nthe file pattern.",
|
||||
"description": "A list of mappings from file pattern to rule codes or prefixes to\nexclude, when considering any matching files. An initial '!' negates\nthe file pattern.\n\nFor more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).",
|
||||
"type": [
|
||||
"object",
|
||||
"null"
|
||||
|
||||
Reference in new issue
Block a user