Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: update Ruff to v0.3.4 #52302

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1512,15 +1512,15 @@ cpplint: lint-cpp
# Try with '--system' if it fails without; the system may have set '--user'
lint-py-build:
$(info Pip installing ruff on $(shell $(PYTHON) --version)...)
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.0.272 || \
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.0.272
$(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff==0.3.4 || \
$(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff==0.3.4

.PHONY: lint-py
ifneq ("","$(wildcard tools/pip/site-packages/ruff)")
# Lint the Python code with ruff.
lint-py:
tools/pip/site-packages/bin/ruff --version
tools/pip/site-packages/bin/ruff .
tools/pip/site-packages/bin/ruff check .
else
lint-py:
$(warning Python linting with ruff is not available)
Expand Down
25 changes: 14 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
[tool.ruff]
exclude = [
"deps",
"tools/cpplint.py",
"tools/gyp",
"tools/inspector_protocol",
"tools/node_modules",
]
line-length = 172
target-version = "py37"

[tool.ruff.lint]
select = [
"C90", # McCabe cyclomatic complexity
"E", # pycodestyle
Expand All @@ -17,12 +28,6 @@ select = [
"W", # pycodestyle
"YTT", # flake8-2020
]
exclude = [
"deps",
"tools/gyp",
"tools/inspector_protocol",
"tools/node_modules",
]
ignore = [
"E401",
"E402",
Expand All @@ -31,19 +36,17 @@ ignore = [
"RUF005",
"RUF100",
]
line-length = 172
target-version = "py37"

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 100

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"tools/checkimports.py" = ["W605"]
"tools/gyp/pylib/gyp/xcodeproj_file.py" = ["PLE0101"]
"tools/icu/shrink-icu-src.py" = ["W605"]
"tools/mkssldef.py" = ["W605"]

[tool.ruff.pylint]
[tool.ruff.lint.pylint]
max-args = 12
max-branches = 110
max-returns = 12
Expand Down
Loading