Skip to content

Commit 9cda3a5

Browse files
authored
Merge pull request #189 from hugovk/replace-flake8-with-ruff
Replace Flake8 with Ruff and add more linting for GitHub Actions
2 parents 26ca6d7 + fce4eb4 commit 9cda3a5

File tree

5 files changed

+50
-32
lines changed

5 files changed

+50
-32
lines changed

Diff for: .flake8

-2
This file was deleted.

Diff for: .github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ jobs:
3434
--build-root ./build_root
3535
--www-root ./www
3636
--log-directory ./logs
37-
--group $(id -g)
37+
--group "$(id -g)"
3838
--skip-cache-invalidation
39-
--theme $(pwd)
39+
--theme "$(pwd)"
4040
--language en
4141
--branch ${{ matrix.branch }}
4242
- name: Show logs

Diff for: .pre-commit-config.yaml

+18-24
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,17 @@
11
repos:
2-
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.15.0
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.4.0
44
hooks:
5-
- id: pyupgrade
6-
args: [--py38-plus]
5+
- id: ruff
6+
args: [--exit-non-zero-on-fix]
77

88
- repo: https://github.com/psf/black-pre-commit-mirror
9-
rev: 24.1.1
9+
rev: 24.4.0
1010
hooks:
1111
- id: black
1212

13-
- repo: https://github.com/PyCQA/isort
14-
rev: 5.13.2
15-
hooks:
16-
- id: isort
17-
18-
- repo: https://github.com/PyCQA/flake8
19-
rev: 7.0.0
20-
hooks:
21-
- id: flake8
22-
additional_dependencies:
23-
[flake8-2020, flake8-implicit-str-concat, flake8-logging]
24-
25-
- repo: https://github.com/pre-commit/pygrep-hooks
26-
rev: v1.10.0
27-
hooks:
28-
- id: python-check-blanket-noqa
29-
3013
- repo: https://github.com/pre-commit/pre-commit-hooks
31-
rev: v4.5.0
14+
rev: v4.6.0
3215
hooks:
3316
- id: check-case-conflict
3417
- id: check-merge-conflict
@@ -38,8 +21,19 @@ repos:
3821
- id: end-of-file-fixer
3922
- id: trailing-whitespace
4023

24+
- repo: https://github.com/python-jsonschema/check-jsonschema
25+
rev: 0.28.2
26+
hooks:
27+
- id: check-dependabot
28+
- id: check-github-workflows
29+
30+
- repo: https://github.com/rhysd/actionlint
31+
rev: v1.6.27
32+
hooks:
33+
- id: actionlint
34+
4135
- repo: https://github.com/tox-dev/pyproject-fmt
42-
rev: 1.7.0
36+
rev: 1.8.0
4337
hooks:
4438
- id: pyproject-fmt
4539
args: [--max-supported-python=3.13]

Diff for: pyproject.toml

+29-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,32 @@ include = [
4444
"python_docs_theme/",
4545
]
4646

47-
[tool.isort]
48-
add_imports = "from __future__ import annotations"
49-
profile = "black"
47+
[tool.ruff]
48+
fix = true
49+
50+
[tool.ruff.lint]
51+
select = [
52+
"C4", # flake8-comprehensions
53+
"E", # pycodestyle errors
54+
"F", # pyflakes errors
55+
"I", # isort
56+
"ISC", # flake8-implicit-str-concat
57+
"LOG", # flake8-logging
58+
"PGH", # pygrep-hooks
59+
"PYI", # flake8-pyi
60+
"RUF100", # unused noqa (yesqa)
61+
"RUF022", # unsorted-dunder-all
62+
"UP", # pyupgrade
63+
"W", # pycodestyle warnings
64+
"YTT", # flake8-2020
65+
]
66+
ignore = [
67+
"E203", # Whitespace before ':'
68+
"E221", # Multiple spaces before operator
69+
"E226", # Missing whitespace around arithmetic operator
70+
"E241", # Multiple spaces after ','
71+
]
72+
73+
74+
[tool.ruff.lint.isort]
75+
required-imports = ["from __future__ import annotations"]

Diff for: python_docs_theme/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def _asset_hash(path: str) -> str:
2424
def _add_asset_hashes(static: list[str], add_digest_to: list[str]) -> None:
2525
for asset in add_digest_to:
2626
index = static.index(asset)
27-
static[index].filename = _asset_hash(asset) # type: ignore
27+
static[index].filename = _asset_hash(asset) # type: ignore[attr-defined]
2828

2929

3030
def _html_page_context(

0 commit comments

Comments
 (0)