Skip to content

Commit

Permalink
Flynt lint/format
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Oct 13, 2023
1 parent d7fae9d commit 2f3d4f5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
13 changes: 8 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 24 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit 2f3d4f5

Please sign in to comment.