Skip to content

Commit

Permalink
Allow using tox to reformat the working copy
Browse files Browse the repository at this point in the history
By default, tox should check that the code is correctly formatted
CI-style. However it can be useful to use it to *fix* the code as
well. By using `--diff` as an overridable default,

    tox -eblack --

becomes an easy way to reformat the working copy. Technically it's not
that much shorter than `ruff format`, but if the previous command was
`tox -eblack` (to check formatting) then it becomes a smaller change,
and I don't have to remember the ruff invocation.
  • Loading branch information
masklinn committed Feb 28, 2024
1 parent 5595b2b commit 1d1abc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ commands = ruff check {posargs}
[testenv:black]
package = skip
deps = ruff
commands = ruff format --diff {posargs:.}
commands = ruff format {posargs:--diff}

[testenv:typecheck]
package = skip
Expand Down

0 comments on commit 1d1abc4

Please sign in to comment.