Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Before any pull request can be accepted, you must do the following:
`tools/.github-cla-signers`_
* Add or update any `unit tests`_ accordingly
* Add or update any `integration tests`_ (if applicable)
* Format code (using black and isort) with `tox -e format`
* Format code (using black and isort) with `tox -e do_format`
* Ensure unit tests and linting pass using `tox`_
* Submit a PR against the `main` branch of the `cloud-init` repository

Expand Down
53 changes: 33 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,52 @@ setenv =
passenv=
PYTEST_ADDOPTS

[flake_env]
envdir = {toxworkdir}/.flake_env
deps =
flake8==3.9.2
pylint==2.11.1
black==21.12b0
isort==5.10.1
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
[format_deps]
flake8==3.9.2
pylint==2.11.1
black==21.12b0
isort==5.10.1

[testenv:flake8]
envdir = {[flake_env]envdir}
deps = {[flake_env]deps}
deps =
flake8=={[format_deps]flake8}
commands = {envpython} -m flake8 {posargs:cloudinit/ tests/ tools/ setup.py}

[testenv:pylint]
envdir = {[flake_env]envdir}
deps = {[flake_env]deps}
deps =
pylint=={[format_deps]pylint}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
commands = {envpython} -m pylint {posargs:cloudinit tests tools}

[testenv:black]
envdir = {[flake_env]envdir}
deps = {[flake_env]deps}
deps =
black=={[format_deps]black}
commands = {envpython} -m black . --check

[testenv:isort]
envdir = {[flake_env]envdir}
deps = {[flake_env]deps}
deps =
isort=={[format_deps]isort}
commands = {envpython} -m isort . --check-only

[testenv:format]
envdir = {[flake_env]envdir}
deps = {[flake_env]deps}
[testenv:check_format]
deps =
flake8=={[format_deps]flake8}
pylint=={[format_deps]pylint}
black=={[format_deps]black}
isort=={[format_deps]isort}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/integration-requirements.txt
commands =
Comment thread
holmanb marked this conversation as resolved.
{[testenv:black]commands}
{[testenv:isort]commands}
{[testenv:flake8]commands}
{[testenv:pylint]commands}

[testenv:do_format]
deps =
black=={[format_deps]black}
isort=={[format_deps]isort}
commands =
{envpython} -m isort .
{envpython} -m black .
Expand Down