This is a fork of Ricardo Chaves python-lint action but I added some tools that I like to use.
This action may be used to execute the following applications:
- black
- yapf
- isort
- docformatter
- pycodestyle
- autopep8
- pydocstyle
- mypy
- pylint
- flake8
- mccabe
- radon
- rstcheck
- check-manifest
- pyroma
The default for each tool is check only, not make automatic changes. It's recommended that the tools you use in this action be used in-line with your editor or IDE and/or as pre-commit hooks. This action just verifies you didn't forget to do that.
However, you could choose to have fixes applied by each tool. If you do, it's recommended that the autoformatters come first, followed by the style checking tools to verify the autoformatter results. After this, the type checkers and linters can be run.
All tools are enabled by default with the exception of black and yapf. It's certainly your prerogative to use as many autoformatters as you'd like, but I recommend using only one. Which you choose should be enabled with the use-black or use-yapf input.
See action.yml
Basic:
steps:
- uses: actions/checkout@v2
- uses: weibullguy/python-lint-plus@master
Options:
steps:
- uses: actions/checkout@v2
- uses: weibullguy/python-lint-plus@master
with:
python-root-list: "tests"
use-black: false
use-yapf: false
use-isort: false
use-docformatter: false
use-pycodestyle: false
use-autopep8: false
use-pydocstyle: false
use-mypy: false
use-pylint: false
use-flake8: false
use-mccabe: false
use-radon: false
use-rstcheck: false
use-check-manifest: false
use-pyroma: false
extra-black-options: ""
extra-yapf-options: ""
extra-isort-options: ""
extra-docformatter-options: ""
extra-pycodestyle-options: ""
extra-pydocstyle-options: ""
extra-mypy-options: ""
extra-pylint-options: ""
extra-flake8-options: ""
extra-mccabe-options: ""
extra-radon-options: ""
extra-rstcheck-options: ""
extra-manifest-options: ""
extra-pyroma-options: ""
Command build logic list:
black --check $(extra-black-options) $(python-root-list)
yapf $(extra-yapf-options) $(python-root-list) --diff
isort $(extra-isort-options) $(python-root-list) -c --diff
docformatter $(extra-docformatter-options) $(python-root-list)
pycodestyle $(extra-pycodestyle-options) $(python-root-list)
autopep8 $(extra-autopep8-options) $(python-root-list)
pydocstyle $(extra-pydocstyle-options) $(python-root-list)
mypy $(extra-mypy-options) $(python-root-list)
pylint $(extra-pylint-options) $(python-root-list)
flake8 $(extra-flake8-options) $(python-root-list)
python -m mccabe $(extra-mccabe-options) $(python-root-list)
radon $(extra-radon-options) $(python-root-list)
rstcheck $(extra-rstcheck-options) $(python-root-list)
check-manifest $(extra-manifest-options) .
pyroma $(extra-pyroma-options) .
When using radon, you will have to specify which check (cc, raw, mi, or hal) you want to run in the extra-radon-options argument. For example, the following snippet will cause radon to run the Cyclomatic Complexity check on the files.
steps:
- uses: actions/checkout@v2
- uses: weibullguy/python-lint-plus@master
with:
python-root-list: "python_alelo tests"
use-radon: true
extra-radon-options: "cc -s"
To run multiple radon checks, you'll need to add a step for each in your workflow file.
To identify the version used you must consult the CHANGELOG.md of the image used in the Dockerfile.
The scripts and documentation in this project are released under the MIT License
Contributions are welcome! See CONTRIBUTING.md
Thanks to Ricardo Chaves for writing the python-lint action and giving me a solid starting point for this action.