Skip to content

Commit 7734921

Browse files
authored
Merge pull request #1870 from EliahKagan/tox-ruff
Split tox lint env into three envs, all safe
2 parents e880c33 + 89e519e commit 7734921

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

.github/workflows/lint.yml

-2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,3 @@ jobs:
1414
python-version: "3.x"
1515

1616
- uses: pre-commit/action@v3.0.1
17-
with:
18-
extra_args: --all-files --hook-stage manual

tox.ini

+24-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
requires = tox>=4
3-
env_list = py{37,38,39,310,311,312}, mypy, html
3+
env_list = py{37,38,39,310,311,312}, ruff, format, mypy, html, misc
44

55
[testenv]
66
description = Run unit tests
@@ -9,14 +9,27 @@ extras = test
99
pass_env = SSH_*
1010
commands = pytest --color=yes {posargs}
1111

12-
[testenv:lint]
13-
description = Lint via pre-commit
12+
[testenv:ruff]
13+
description = Lint with Ruff
1414
base_python = py{39,310,311,312,38,37}
15-
commands = pre-commit run --all-files --hook-stage manual
15+
deps = ruff
16+
set_env =
17+
CLICOLOR_FORCE = 1 # Set NO_COLOR to override this.
18+
commands = ruff check .
19+
20+
[testenv:format]
21+
description = Check formatting with Ruff
22+
base_python = py{39,310,311,312,38,37}
23+
deps = ruff
24+
set_env =
25+
CLICOLOR_FORCE = 1 # Set NO_COLOR to override this.
26+
commands = ruff format --check .
1627

1728
[testenv:mypy]
1829
description = Typecheck with mypy
1930
base_python = py{39,310,311,312,38,37}
31+
set_env =
32+
MYPY_FORCE_COLOR = 1
2033
commands = mypy -p git
2134
ignore_outcome = true
2235

@@ -28,3 +41,10 @@ allowlist_externals = make
2841
commands =
2942
make BUILDDIR={env_tmp_dir}/doc/build -C doc clean
3043
make BUILDDIR={env_tmp_dir}/doc/build -C doc html
44+
45+
[testenv:misc]
46+
description = Run other checks via pre-commit
47+
base_python = py{39,310,311,312,38,37}
48+
set_env =
49+
SKIP = ruff-format,ruff
50+
commands = pre-commit run --all-files

0 commit comments

Comments
 (0)