From 088b7b5f77fcb05994fd2a17cbc940cd9edb341a Mon Sep 17 00:00:00 2001 From: chiri Date: Fri, 28 Aug 2026 19:39:33 +0300 Subject: [PATCH] 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 --- crates/ruff_workspace/src/options.rs | 4 ++++ ruff.schema.json | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ruff_workspace/src/options.rs b/crates/ruff_workspace/src/options.rs index a108f73f74..95682b75b9 100644 --- a/crates/ruff_workspace/src/options.rs +++ b/crates/ruff_workspace/src/options.rs @@ -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>>, diff --git a/ruff.schema.json b/ruff.schema.json index ad8f8b3e43..ba99644ac8 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -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"