Skip to content

Commit

Permalink
Move most ruff exclusions out of .pre-commit-config.yaml
Browse files Browse the repository at this point in the history
This makes it easier to run 'ruff check' outside of the pre-commit
hooks.
  • Loading branch information
correctmost authored and DanielNoord committed Sep 15, 2024
1 parent a82e2fe commit f448dca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
11 changes: 2 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@ repos:
hooks:
- id: ruff
args: ["--fix"]
exclude: &fixtures tests(/\w*)*/functional/|tests/input|doc/data/messages|tests(/\w*)*data/
exclude: doc/data/messages
- id: ruff
name: ruff-doc
files: doc/data/messages
exclude: |
(?x)^(
doc/data/messages/d/duplicate-argument-name/bad.py|
doc/data/messages/s/syntax-error/bad.py
)$
args: ["--config", "doc/data/ruff.toml"]
- repo: https://github.com/Pierre-Sassoulas/copyright_notice_precommit
rev: 0.1.2
hooks:
Expand All @@ -49,7 +42,7 @@ repos:
hooks:
- id: black
args: [--safe, --quiet]
exclude: *fixtures
exclude: &fixtures tests(/\w*)*/functional/|tests/input|doc/data/messages|tests(/\w*)*data/
- id: black
name: black-doc
args: [--safe, --quiet]
Expand Down
15 changes: 10 additions & 5 deletions doc/data/ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@
# (Because of horizontal scrolling)
line-length = 103

extend-exclude = [
"messages/d/duplicate-argument-name/bad.py",
"messages/s/syntax-error/bad.py",
]

[lint]
ignore = []
select = ["E501", "I"]


[lint.per-file-ignores]
"doc/data/messages/r/reimported/bad.py" = ["I"]
"doc/data/messages/w/wrong-import-order/bad.py" = ["I"]
"doc/data/messages/u/ungrouped-imports/bad.py" = ["I"]
"doc/data/messages/m/misplaced-future/bad.py" = ["I"]
"doc/data/messages/m/multiple-imports/bad.py" = ["I"]
"messages/m/misplaced-future/bad.py" = ["I"]
"messages/m/multiple-imports/bad.py" = ["I"]
"messages/r/reimported/bad.py" = ["I"]
"messages/u/ungrouped-imports/bad.py" = ["I"]
"messages/w/wrong-import-order/bad.py" = ["I"]
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ module = [
# (for docstrings, strings and comments in particular).
line-length = 115

extend-exclude = [
"tests/**/data/",
"tests/**/functional/",
"tests/input/",
"tests/regrtest_data/",
]

[tool.ruff.lint]
select = [
"B", # bugbear
Expand Down

0 comments on commit f448dca

Please sign in to comment.