Skip to content

Commit

Permalink
Adding new features in tox.ini (#1457)
Browse files Browse the repository at this point in the history
The scripts/fmt.sh script has been replaced with a new tox command: tox -e fmt.
It behaves exactly the same way, except that it's executed in a venv.

Another new command, tox -e style, also checks for formatting mistakes.
It returns a code error, if an error has been found in one of the files.
It does not edit any files. It would be suitable for a CI.

The file Makefile has been modified so that "make format" still works.
  • Loading branch information
I2SAM7 committed Nov 23, 2022
1 parent 048ee12 commit d06f4dc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ test:
# Format code
.PHONY: format
format:
./scripts/fmt.sh
tox -e fmt
10 changes: 0 additions & 10 deletions scripts/fmt.sh

This file was deleted.

26 changes: 25 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,28 @@ usedevelop = True
deps =
-rrequirements.txt
pytest
commands = pytest tests
commands = pytest tests

[testenv:fmt]
allowlist_externals =
bash
deps =
black
autoflake
pyupgrade
isort
commands =
bash -c 'find tuxemon/ -iname "*.py" -type f | parallel pyupgrade --exit-zero-even-if-changed --py38-plus --keep-runtime-typing'
autoflake -r -i --imports=tuxemon,pygame --ignore-init-module-imports tuxemon/
isort tuxemon tests
black tuxemon tests

[testenv:style]
deps =
black
autoflake
isort
commands =
autoflake -r -i --imports=tuxemon,pygame --ignore-init-module-imports --check-diff --quiet tuxemon/
isort --check --diff --quiet tuxemon tests
black --check --diff --quiet tuxemon tests

0 comments on commit d06f4dc

Please sign in to comment.