From 9a0d2f5afdd4dfd11af48e790fc5fee1f1866acd Mon Sep 17 00:00:00 2001 From: Nok Lam Chan Date: Mon, 14 Aug 2023 23:02:40 +0100 Subject: [PATCH] Add regular expression example for `per-file-ignores` (#6573) ## Summary Hi! This is my first PR to `ruff` and thanks for this amazing project. While I am working on my project, I need to set different rules for my `test/` folder and the main `src` package. It's not immediately obvious that the [`tool.ruff.per-file-ignores`](https://beta.ruff.rs/docs/settings/#per-file-ignores) support regular expression. It is useful to set rules on directory level. The PR add a simple example to make it clear this support regex. --- docs/configuration.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/configuration.md b/docs/configuration.md index c587f5ee07..cbe8c31cde 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -77,6 +77,7 @@ unfixable = ["B"] [tool.ruff.per-file-ignores] "__init__.py" = ["E402"] "path/to/file.py" = ["E402"] +"**/{tests,docs,tools}/*" = ["E402"] ``` Plugin configurations should be expressed as subsections, e.g.: