Skip to content

Commit f71a777

Browse files
targosmarco-ippolito
authored andcommittedMay 3, 2024
tools: update Ruff to v0.3.4
- Use `check` command as suggested - Adapt deprecated config - Ignore cpplint.py as it's a third-party script PR-URL: #52302 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
1 parent 739958e commit f71a777

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed
 

‎Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1512,15 +1512,15 @@ cpplint: lint-cpp
15121512
# Try with '--system' if it fails without; the system may have set '--user'
15131513
lint-py-build:
15141514
$(info Pip installing ruff on $(shell $(PYTHON) --version)...)
1515-
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.0.272 || \
1516-
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.0.272
1515+
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.3.4 || \
1516+
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.3.4
15171517

15181518
.PHONY: lint-py
15191519
ifneq ("","$(wildcard tools/pip/site-packages/ruff)")
15201520
# Lint the Python code with ruff.
15211521
lint-py:
15221522
tools/pip/site-packages/bin/ruff --version
1523-
tools/pip/site-packages/bin/ruff .
1523+
tools/pip/site-packages/bin/ruff check .
15241524
else
15251525
lint-py:
15261526
$(warning Python linting with ruff is not available)

‎pyproject.toml

+14-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
[tool.ruff]
2+
exclude = [
3+
"deps",
4+
"tools/cpplint.py",
5+
"tools/gyp",
6+
"tools/inspector_protocol",
7+
"tools/node_modules",
8+
]
9+
line-length = 172
10+
target-version = "py37"
11+
12+
[tool.ruff.lint]
213
select = [
314
"C90", # McCabe cyclomatic complexity
415
"E", # pycodestyle
@@ -17,12 +28,6 @@ select = [
1728
"W", # pycodestyle
1829
"YTT", # flake8-2020
1930
]
20-
exclude = [
21-
"deps",
22-
"tools/gyp",
23-
"tools/inspector_protocol",
24-
"tools/node_modules",
25-
]
2631
ignore = [
2732
"E401",
2833
"E402",
@@ -31,19 +36,17 @@ ignore = [
3136
"RUF005",
3237
"RUF100",
3338
]
34-
line-length = 172
35-
target-version = "py37"
3639

37-
[tool.ruff.mccabe]
40+
[tool.ruff.lint.mccabe]
3841
max-complexity = 100
3942

40-
[tool.ruff.per-file-ignores]
43+
[tool.ruff.lint.per-file-ignores]
4144
"tools/checkimports.py" = ["W605"]
4245
"tools/gyp/pylib/gyp/xcodeproj_file.py" = ["PLE0101"]
4346
"tools/icu/shrink-icu-src.py" = ["W605"]
4447
"tools/mkssldef.py" = ["W605"]
4548

46-
[tool.ruff.pylint]
49+
[tool.ruff.lint.pylint]
4750
max-args = 12
4851
max-branches = 110
4952
max-returns = 12

0 commit comments

Comments
 (0)
Please sign in to comment.