Skip to content

Commit

Permalink
Add option for unsafe formatting in tox
Browse files Browse the repository at this point in the history
`tox -e format-unsafe` allows to format unsafe that fixes more linter
errors but might alter code logic.
  • Loading branch information
agoscinski authored and PicoCentauri committed May 27, 2024
1 parent b4ad773 commit 14ba881
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,21 @@ commands =
-i "{toxinidir}/docs/src/examples" \
{[tox]lint_folders} "{toxinidir}/README.rst"

[testenv:format]
# Abuse tox to do actual formatting. Users can call `tox -e format` to run
# formatting on all files
[testenv:{format,format-unsafe}]
description =
format: Formats files in working directory.
format-unsafe: Formats files in working directory. Fixes more linter errors
but might alter code logic. Result of this formatting should
be double checked.
skip_install = true
deps =
ruff
black
blackdoc
isort
commands =
ruff check --fix {[tox]lint_folders}
format: ruff check --fix {[tox]lint_folders}
format-unsafe: ruff check --fix --unsafe-fixes {[tox]lint_folders}
black {[tox]lint_folders}
blackdoc {[tox]lint_folders}
isort {[tox]lint_folders}
Expand Down

0 comments on commit 14ba881

Please sign in to comment.