Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4c034db

Browse files
committed
Split tox "lint" env into three envs, all safe
It makes sense for ruff linting and ruff autoformatting to beeasily runnable individually and to have their results be shownseparately. Splitting them out in tox.ini also makes it so tox cando the other tests corresponding to those in lint.yml on CI in anenvironment that requries no custom behavior from pre-commit otherthan skipping the ruff checks.The ruff linting ("ruff") and ruff format checking ("format") toxenvironments specify ruff as a dependency and call it directlyrather than through pre-commit, invoking it in such a way that itdoes not attempt to modify any files in the working tree.Seeb059cd5 (#1868) for context. All three of these tox envs that"lint" has been split into are listed in the env_list and thus runautomatically when tox is run with no arguments, since no tox envsunexpectedly (or at all) modify files in the working tree anymore.One limitation of the current approach is that new pre-commit hooksconfigured in .pre-commit-config.yml will automatically be run aspart of the "misc" tox environment, which means that new unexpectedmutating operatons could be added if the impact on tox is notconsidered. The benefit of having it work this way is that mosthooks that are likely to be added to GitPython would not modifyfiles and would be wanted as part of "misc". But this may benefitfrom further refinement.
1 parentf788418 commit4c034db

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

‎tox.ini

Lines changed: 18 additions & 4 deletions
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,10 +9,17 @@ extras = test
99
pass_env = SSH_*
1010
commands = pytest --color=yes {posargs}
1111

12-
[testenv:lint]
13-
description = Lintvia pre-commit
12+
[testenv:ruff]
13+
description = Lintwith Ruff
1414
base_python = py{39,310,311,312,38,37}
15-
commands = pre-commit run --all-files
15+
deps = ruff
16+
commands = ruff check .
17+
18+
[testenv:format]
19+
description = Check formatting with Ruff
20+
base_python = py{39,310,311,312,38,37}
21+
deps = ruff
22+
commands = ruff format --check .
1623

1724
[testenv:mypy]
1825
description = Typecheck with mypy
@@ -28,3 +35,10 @@ allowlist_externals = make
2835
commands =
2936
makeBUILDDIR={env_tmp_dir}/doc/build -C doc clean
3037
makeBUILDDIR={env_tmp_dir}/doc/build -C doc html
38+
39+
[testenv:misc]
40+
description = Run other checks via pre-commit
41+
base_python = py{39,310,311,312,38,37}
42+
set_env =
43+
SKIP = ruff-format,ruff
44+
commands = pre-commit run --all-files

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp