diff --git a/pyproject.toml b/pyproject.toml index b78e8bd0e3c..2f8207d97e4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,8 +28,11 @@ src_paths = [ "tests/integration", ] -sections=["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "ANSIBLE_CORE", "ANSIBLE_AMAZON_AWS", "ANSIBLE_COMMUNITY_AWS", "LOCALFOLDER"] -known_third_party=["botocore", "boto3"] -known_ansible_core=["ansible"] -known_ansible_amazon_aws=["ansible_collections.amazon.aws"] -known_ansible_community_aws=["ansible_collections.community.aws"] +sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "ANSIBLE_CORE", "ANSIBLE_AMAZON_AWS", "ANSIBLE_COMMUNITY_AWS", "LOCALFOLDER"] +known_third_party = ["botocore", "boto3"] +known_ansible_core = ["ansible"] +known_ansible_amazon_aws = ["ansible_collections.amazon.aws"] +known_ansible_community_aws = ["ansible_collections.community.aws"] + +[tool.flynt] +transform-joins = true diff --git a/tox.ini b/tox.ini index 4d68c5069ee..e425f3a6494 100644 --- a/tox.ini +++ b/tox.ini @@ -3,10 +3,13 @@ skipsdist = True envlist = clean,ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints},linters # Tox4 supports labels which allow us to group the environments rather than dumping all commands into a single environment labels = - format = black, isort - lint = complexity-report, black-lint, isort-lint, flake8-lint + format = flynt, black, isort + lint = complexity-report, black-lint, isort-lint, flake8-lint, flynt-lint units = ansible{2.12,2.13}-py{38,39,310}-{with_constraints,without_constraints} +[common] +format_dirs = {toxinidir}/plugins {toxinidir}/tests + [testenv] description = Run the test-suite and generate a HTML coverage report deps = @@ -34,34 +37,48 @@ deps = commands = -flake8 --select C90 --max-complexity 10 --format=html --htmldir={posargs:complexity} plugins [testenv:black] +depends = + flynt, isort deps = black >=23.0, <24.0 commands = - black {toxinidir}/plugins {toxinidir}/tests + black {[common]format_dirs} [testenv:black-lint] deps = {[testenv:black]deps} commands = - black -v --check --diff {toxinidir}/plugins {toxinidir}/tests + black -v --check --diff {[common]format_dirs} [testenv:isort] deps = isort commands = - isort {toxinidir}/plugins {toxinidir}/tests + isort {[common]format_dirs} [testenv:isort-lint] deps = {[testenv:isort]deps} commands = - isort --check-only --diff {toxinidir}/plugins {toxinidir}/tests + isort --check-only --diff {[common]format_dirs} [testenv:flake8-lint] deps = flake8 commands = - flake8 {posargs} {toxinidir}/plugins {toxinidir}/tests + flake8 {posargs} {[common]format_dirs} + +[testenv:flynt] +deps = + flynt +commands = + flynt {[common]format_dirs} + +[testenv:flynt-lint] +deps = + flynt +commands = + flynt --dry-run {[common]format_dirs} [testenv:linters] deps =