Skip to content

Commit 04791a7

Browse files
committed
[py] Remove old linters and add ruff
1 parent e07e050 commit 04791a7

File tree

3 files changed

+15
-76
lines changed

3 files changed

+15
-76
lines changed

.github/workflows/ci-python.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,7 @@ jobs:
5151
- name: Test with tox
5252
run: tox -c py/tox.ini
5353
env:
54-
# If this fails, it will exit. Local work should be using `tox -e linting` prior to committing.
55-
# the linting-ci recipe exists solely for CI and will not attempt to rewrite any files in-place etc.
56-
TOXENV: linting-ci
54+
TOXENV: linting
5755

5856
mypy:
5957
name: Mypy

py/pyproject.toml

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -131,53 +131,28 @@ ignore_missing_imports = true
131131
# suppress error messages about imports that cannot be resolved.
132132
ignore_missing_imports = true
133133

134-
[tool.isort]
135-
# isort is a common python tool for keeping imports nicely formatted.
136-
# Automatically keep imports alphabetically sorted, on single lines in
137-
# PEP recommended sections (https://peps.python.org/pep-0008/#imports)
138-
# files or individual lines can be ignored via `# isort:skip|# isort:skip_file`.
139-
force_single_line = true
140-
profile = "black"
141-
py_version = 39
142-
quiet = true
143-
skip = "selenium/webdriver/common/devtools"
144-
145-
[tool.black]
146-
extend-exclude = "selenium/webdriver/common/devtools"
147-
line-length = 120
148-
target-version = ["py39"]
149-
150-
[tool.autoflake]
134+
[tool.docformatter]
151135
exclude = "selenium/webdriver/common/devtools"
152-
ignore-pass-after-docstring = true
153136
in-place = true
154-
quiet = true
155137
recursive = true
156-
remove-all-unused-imports = true
157-
remove-duplicate-keys = true
158-
remove-unused-variables = true
159-
160-
[tool.flake8]
161-
exclude = "selenium/webdriver/common/devtools"
162-
# Disable E501 once line length is better handled
163-
extend-ignore = ["E501", "E203"]
164-
# This does nothing for now as E501 is ignored
165-
max-line-length = 120
166-
min-python-version = "3.9"
167138

168139
[tool.ruff]
169-
exclude = [
140+
extend-exclude = [
170141
"selenium/webdriver/common/devtools/",
171142
"private/",
172143
"generate.py",
173144
]
174145
line-length = 120
146+
indent-width = 4
147+
respect-gitignore = true
148+
target-version = "py39"
175149

176150
[tool.ruff.lint]
177-
extend-select = ["E501"]
151+
#extend-select = ["E4", "E7", "E9", "F"]
152+
extend-select = ["E4", "E7", "E9", "F", "E501"]
153+
#extend-ignore = ["E501"]
178154
fixable = ["ALL"]
179155

180-
[tool.docformatter]
181-
exclude = "selenium/webdriver/common/devtools"
182-
in-place = true
183-
recursive = true
156+
[tool.ruff.format]
157+
docstring-code-format = true
158+
docstring-code-line-length = 120

py/tox.ini

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -32,46 +32,12 @@ deps =
3232
trio-typing==0.10.0
3333
commands = mypy --install-types {posargs}
3434

35-
[testenv:linting-ci]
36-
; checks linting for CI with stricter exiting when failing and no rewriting
37-
skip_install = true
38-
deps =
39-
isort==6.0.1
40-
black==25.1.0
41-
autoflake==2.3.1
42-
flake8==7.1.2
43-
flake8-pyproject==1.2.3
44-
flake8-typing-imports==1.16.0
45-
docformatter==1.7.5
46-
commands =
47-
isort --check-only --diff selenium/ test/ conftest.py
48-
black --check --diff selenium/ test/ conftest.py
49-
autoflake --check-diff selenium/ test/ conftest.py
50-
flake8 selenium/ test/ conftest.py
51-
docformatter --check --diff selenium/ test/ conftest.py
52-
5335
[testenv:linting]
54-
; A consolidated linting based recipe, responsible for executing linting tools across the code base.
55-
; This encompasses:
56-
; - isort for imports
57-
; - black and flake8 for general formatting
58-
; - autoflake for unused imports and variables
59-
; - docformatter for docstrings
60-
; IMPORTANT:
61-
; - isort, black, autoflake, docformatter: will rewrite files
62-
; - flake8: only alerts to the failures
6336
skip_install = true
6437
deps =
65-
isort==6.0.1
66-
black==25.1.0
67-
autoflake==2.3.1
68-
flake8==7.1.2
69-
flake8-pyproject==1.2.3
70-
flake8-typing-imports==1.16.0
38+
ruff==0.11.10
7139
docformatter==1.7.5
7240
commands =
73-
isort selenium/ test/ conftest.py
74-
black selenium/ test/ conftest.py
75-
autoflake selenium/ test/ conftest.py
76-
flake8 selenium/ test/ conftest.py
7741
docformatter selenium/ test/ conftest.py
42+
ruff check --fix --show-fixes --exit-non-zero-on-fix selenium/ test/ conftest.py
43+
ruff format --exit-non-zero-on-format selenium/ test/ conftest.py

0 commit comments

Comments
 (0)