Skip to content

luceda/python-lint-annotate

Repository files navigation

python-lint-annotate

Zero-configuration GitHub Action to maintain code quality with push and PR annotations.

On every push and pull request git diffs will get inline annotated with found errors from selected linters.

Screenshot of annotations

Features

  • Zero configuration based: Add a single line in your CI and done!
  • GitHub Annotations on PR: Highlights issues inline on the PR diff.
  • Most of the popular community trusted linters in one place.

Linters supported

Usage

Basic:

steps:
  - uses: actions/checkout@v1
  - uses: marian-code/python-lint-annotate@v2

Options:

steps:
  - uses: actions/checkout@v1
  - uses: marian-code/python-lint-annotate@v2
    with:
      python-root-list: "src/ tests/*"  # accepts wildcards
      use-pycodestyle: false
      use-mypy: false
      use-vulture: true
      extra-pylint-options: "--output-format="colorized"
      conda-python-version: "3.7"

Details

Uses conda environment with user selected python version. Only python 3.6 - 3.9 version are tested since they are by far most common now. Other python 3.x versions should also work. Any python 2.x versions are unsupported!

The lintner versions are:

pycodestyle==2.6.0
pydocstyle==5.1.1
pylint==2.6.0
mypy==0.800
black==20.8b1
flake8==3.8.4
vulture==2.3
isort==isort-5.7.0

IMPORTANT - test environment

The python version you set up in your action script with actions/setup-python@v2 or by other means will not affect the linting process. The python version used by the linters can be set up only by conda-python-version argument! This also means that if you modify the system conda environment it might affect the lintnig process. So it is best to keep the lintnig action separated from others. It is also recomended to run this on ubuntu-latest. Example:

on:
  push:
  pull_request:
name: Lint Python
jobs:
  lintpython:
    name: Lint Python
    runs-on: ubuntu-20.04
    steps:
    - uses: actions/checkout@v1
    - uses: marian-code/pyaction@v2
      with:
        python-root-list: "./tests/*.py"
        use-black: true
        use-isort: true
        use-mypy: true
        use-pycodestyle: true
        use-pydocstyle: true
        extra-pycodestyle-options: "--max-line-length=88"
        use-pylint: false
        use-flake8: false
        use-vulture: true
        conda-python-version: "3.8"

License

The scripts and documentation in this project are released under the MIT License

Contributions

Contributions are welcome through PRs.

TODO

Wait until this is resolved: PR646 so we can implement better python version control

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published