Skip to content

Commit

Permalink
lint: Ruff runs fix->format->check (#2451)
Browse files Browse the repository at this point in the history
* lint: Ruff runs fix->format->check
* configure

(cherry picked from commit 6277311)
  • Loading branch information
Borda committed Mar 18, 2024
1 parent 00121ff commit 23a6d28
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
9 changes: 6 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,15 @@ repos:
- id: text-unicode-replacement-char

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
rev: v0.3.2
hooks:
- id: ruff-format
args: ["--preview"]
# try to fix what is possible
- id: ruff
args: ["--fix"]
# perform formatting updates
- id: ruff-format
# validate if all is fine with preview mode
- id: ruff

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 1.7.0
Expand Down
16 changes: 10 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ requires = [
[tool.ruff]
target-version = "py38"
line-length = 120
# Enable Pyflakes `E` and `F` codes by default.
lint.select = [

[tool.ruff.format]
preview = true

[tool.ruff.lint]
select = [
"E",
"W", # see: https://pypi.org/project/pycodestyle
"F", # see: https://pypi.org/project/pyflakes
Expand All @@ -18,7 +22,7 @@ lint.select = [
"S", # see: https://pypi.org/project/flake8-bandit
"UP", # see: https://docs.astral.sh/ruff/rules/#pyupgrade-up
]
lint.extend-select = [
extend-select = [
"A", # see: https://pypi.org/project/flake8-builtins
"B", # see: https://pypi.org/project/flake8-bugbear
"C4", # see: https://pypi.org/project/flake8-comprehensions
Expand All @@ -38,7 +42,7 @@ lint.extend-select = [
"PERF", # see: https://pypi.org/project/perflint/
"PYI", # see: https://pypi.org/project/flake8-pyi/
]
lint.ignore = [
ignore = [
"E731", # Do not assign a lambda expression, use a def
"D100", # todo: Missing docstring in public module
"D104", # todo: Missing docstring in public package
Expand All @@ -48,8 +52,8 @@ lint.ignore = [
"S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. # todo
"B905", # todo: `zip()` without an explicit `strict=` parameter
]
lint.ignore-init-module-imports = true
lint.unfixable = ["F401"]
ignore-init-module-imports = true
unfixable = ["F401"]

[tool.ruff.lint.per-file-ignores]
"setup.py" = ["ANN202", "ANN401"]
Expand Down

0 comments on commit 23a6d28

Please sign in to comment.