Skip to content

Commit 23a6d28

Browse files
committed
lint: Ruff runs fix->format->check (Lightning-AI#2451)
* lint: Ruff runs fix->format->check * configure (cherry picked from commit 6277311)
1 parent 00121ff commit 23a6d28

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,15 @@ repos:
111111
- id: text-unicode-replacement-char
112112

113113
- repo: https://github.com/astral-sh/ruff-pre-commit
114-
rev: v0.3.0
114+
rev: v0.3.2
115115
hooks:
116-
- id: ruff-format
117-
args: ["--preview"]
116+
# try to fix what is possible
118117
- id: ruff
119118
args: ["--fix"]
119+
# perform formatting updates
120+
- id: ruff-format
121+
# validate if all is fine with preview mode
122+
- id: ruff
120123

121124
- repo: https://github.com/tox-dev/pyproject-fmt
122125
rev: 1.7.0

pyproject.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ requires = [
77
[tool.ruff]
88
target-version = "py38"
99
line-length = 120
10-
# Enable Pyflakes `E` and `F` codes by default.
11-
lint.select = [
10+
11+
[tool.ruff.format]
12+
preview = true
13+
14+
[tool.ruff.lint]
15+
select = [
1216
"E",
1317
"W", # see: https://pypi.org/project/pycodestyle
1418
"F", # see: https://pypi.org/project/pyflakes
@@ -18,7 +22,7 @@ lint.select = [
1822
"S", # see: https://pypi.org/project/flake8-bandit
1923
"UP", # see: https://docs.astral.sh/ruff/rules/#pyupgrade-up
2024
]
21-
lint.extend-select = [
25+
extend-select = [
2226
"A", # see: https://pypi.org/project/flake8-builtins
2327
"B", # see: https://pypi.org/project/flake8-bugbear
2428
"C4", # see: https://pypi.org/project/flake8-comprehensions
@@ -38,7 +42,7 @@ lint.extend-select = [
3842
"PERF", # see: https://pypi.org/project/perflint/
3943
"PYI", # see: https://pypi.org/project/flake8-pyi/
4044
]
41-
lint.ignore = [
45+
ignore = [
4246
"E731", # Do not assign a lambda expression, use a def
4347
"D100", # todo: Missing docstring in public module
4448
"D104", # todo: Missing docstring in public package
@@ -48,8 +52,8 @@ lint.ignore = [
4852
"S310", # todo: Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected. # todo
4953
"B905", # todo: `zip()` without an explicit `strict=` parameter
5054
]
51-
lint.ignore-init-module-imports = true
52-
lint.unfixable = ["F401"]
55+
ignore-init-module-imports = true
56+
unfixable = ["F401"]
5357

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

0 commit comments

Comments
 (0)