Molecule: devel: consolidate linting into a single job (tox target)

Created on 17 Nov 2018  路  5Comments  路  Source: ansible-community/molecule

Issue Type

  • Feature request

Molecule and Ansible details

At this moment in order to preform only linting a developer would have to run this command:

tox -e py27-lint,py36-lint,py37-lint,format-check

This is insanely long command and I really doubt anyone is actively using it.

Also is takes a huge amount of disk space as it creates 4 different environments without any practical reasons, especially as it makes no sense to run linting with 3 different intepretes, using the latest supported version is more than enough.

PS. Please note that the alternative of using the oldest interpreter (py27) is not as good as the newest one because it is known that the parsing ability of the newer ones is greatlly improved.

Also CI job should be updated to assure the same execution, matching local development usage.

Proposed command

tox -e lint

This approach is also future proof as we could add new linters or swap exiting ones without changing the user interface, the job would still have the same name regardless what internal tools are used at a moment.

enhancement

Most helpful comment

py27-lint,py36-lint,py37-lint,format-check

you can do:

[testenv:lint]
commands =
    {[testenv:py37-lint]commands}
    {[testenv:format-check]commands}

To achieve this.

All 5 comments

I'd like to see separate envs for different checks. I'd default to the current python executable, not bound to version. In CI we use Python 3.7, specified on the config level.

Oh, and another thought: I tend to use https://pre-commit.com tool to consolidate linters in one place and then, additionally to CI, users may optionally set that up as a pre-commit or pre-push hook in their local repo with just a single one-time command.

py27-lint,py36-lint,py37-lint,format-check

you can do:

[testenv:lint]
commands =
    {[testenv:py37-lint]commands}
    {[testenv:format-check]commands}

To achieve this.

Done, long time ago.

Was this page helpful?
0 / 5 - 0 ratings