| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 7ca416a commit 78c0824
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,7 +129,7 @@ jobs: | |||
| 129 | 129 | run: npx envinfo | |
| 130 | 130 | - name: Lint Python | |
| 131 | 131 | run: | | |
| 132 | - make lint-py-build || true | ||
| 132 | + make lint-py-build | ||
| 133 | 133 | make lint-py | |
| 134 | 134 | lint-yaml: | |
| 135 | 135 | if: github.event.pull_request.draft == false | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,6 @@ | |||
| 14 | 14 | !.eslintignore | |
| 15 | 15 | !.eslintrc.js | |
| 16 | 16 | !.eslintrc.yaml | |
| 17 | - !.flake8 | ||
| 18 | 17 | !.gitattributes | |
| 19 | 18 | !.github | |
| 20 | 19 | !.gitignore | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1489,22 +1489,22 @@ cpplint: lint-cpp | |||
| 1489 | 1489 | $(warning Please use lint-cpp instead of cpplint) | |
| 1490 | 1490 | ||
| 1491 | 1491 | .PHONY: lint-py-build | |
| 1492 | - # python -m pip install flake8 | ||
| 1492 | + # python -m pip install ruff | ||
| 1493 | 1493 | # Try with '--system' if it fails without; the system may have set '--user' | |
| 1494 | 1494 | lint-py-build: | |
| 1495 | - $(info Pip installing flake8 linter on $(shell $(PYTHON) --version)...) | ||
| 1496 | - $(PYTHON) -m pip install --upgrade -t tools/pip/site-packages flake8 || \ | ||
| 1497 | - $(PYTHON) -m pip install --upgrade --system -t tools/pip/site-packages flake8 | ||
| 1495 | + $(info Pip installing ruff on $(shell $(PYTHON) --version)...) | ||
| 1496 | + $(PYTHON) -m pip install --upgrade --target tools/pip/site-packages ruff || \ | ||
| 1497 | + $(PYTHON) -m pip install --upgrade --system --target tools/pip/site-packages ruff | ||
| 1498 | 1498 | ||
| 1499 | 1499 | .PHONY: lint-py | |
| 1500 | - ifneq ("","$(wildcard tools/pip/site-packages/flake8)") | ||
| 1501 | - # Lints the Python code with flake8. | ||
| 1502 | - # Flag the build if there are Python syntax errors or undefined names | ||
| 1500 | + ifneq ("","$(wildcard tools/pip/site-packages/ruff)") | ||
| 1501 | + # Lint the Python code with ruff. | ||
| 1503 | 1502 | lint-py: | |
| 1504 | - PYTHONPATH=tools/pip $(PYTHON) -m flake8 --count --show-source --statistics . | ||
| 1503 | + tools/pip/site-packages/bin/ruff --version | ||
| 1504 | + tools/pip/site-packages/bin/ruff . | ||
| 1505 | 1505 | else | |
| 1506 | 1506 | lint-py: | |
| 1507 | - $(warning Python linting with flake8 is not available) | ||
| 1507 | + $(warning Python linting with ruff is not available) | ||
| 1508 | 1508 | $(warning Run 'make lint-py-build') | |
| 1509 | 1509 | endif | |
| 1510 | 1510 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,48 @@ | |||
| 1 | + [tool.ruff] | ||
| 2 | + select = [ | ||
| 3 | + "C90", # McCabe cyclomatic complexity | ||
| 4 | + "E", # pycodestyle | ||
| 5 | + "F", # Pyflakes | ||
| 6 | + "ICN", # flake8-import-conventions | ||
| 7 | + "INT", # flake8-gettext | ||
| 8 | + "PLC", # Pylint conventions | ||
| 9 | + "PLE", # Pylint errors | ||
| 10 | + "PLR09", # Pylint refactoring: max-args, max-branches, max returns, max-statements | ||
| 11 | + "PYI", # flake8-pyi | ||
| 12 | + "RSE", # flake8-raise | ||
| 13 | + "RUF", # Ruff-specific rules | ||
| 14 | + "T10", # flake8-debugger | ||
| 15 | + "TCH", # flake8-type-checking | ||
| 16 | + "TID", # flake8-tidy-imports | ||
| 17 | + "W", # pycodestyle | ||
| 18 | + "YTT", # flake8-2020 | ||
| 19 | + ] | ||
| 20 | + exclude = [ | ||
| 21 | + "deps", | ||
| 22 | + "tools/inspector_protocol", | ||
| 23 | + ] | ||
| 24 | + ignore = [ | ||
| 25 | + "E401", | ||
| 26 | + "E402", | ||
| 27 | + "E7", | ||
| 28 | + "PLC1901", | ||
| 29 | + "RUF005", | ||
| 30 | + "RUF100", | ||
| 31 | + ] | ||
| 32 | + line-length = 172 | ||
| 33 | + target-version = "py37" | ||
| 34 | + | ||
| 35 | + [tool.ruff.mccabe] | ||
| 36 | + max-complexity = 100 | ||
| 37 | + | ||
| 38 | + [tool.ruff.per-file-ignores] | ||
| 39 | + "tools/checkimports.py" = ["W605"] | ||
| 40 | + "tools/gyp/pylib/gyp/xcodeproj_file.py" = ["PLE0101"] | ||
| 41 | + "tools/icu/shrink-icu-src.py" = ["W605"] | ||
| 42 | + "tools/mkssldef.py" = ["W605"] | ||
| 43 | + | ||
| 44 | + [tool.ruff.pylint] | ||
| 45 | + max-args = 12 | ||
| 46 | + max-branches = 110 | ||
| 47 | + max-returns = 12 | ||
| 48 | + max-statements = 289 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments