Skip to content

Commit

Permalink
github: switch the python checker CI to use something that is maintained
Browse files Browse the repository at this point in the history
The python-lint action was last updated 3 years ago. It contains very
old versions of the lint tools, including pre-1.0 versions of mypy. It
doesn't allow installing dependencies for mypy to robustly typecheck.

Simply installing the tools ourselves and running them directly is
simpler, shorter, easier, and provides better linting analysis. So, do
so.

In the process, we can remove a `# type: ignore` from lddtree.py;
argcomplete has typing info. So does pyelftools, but only in git master.
  • Loading branch information
eli-schwartz committed Jan 3, 2024
1 parent b71d01d commit 25823ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# NB: v1.4.0 covers Python 3.8.
- uses: ricardochaves/python-lint@v1.4.0
- uses: actions/setup-python@v5
with:
python-root-list: lddtree.py pylint
use-pylint: true
use-pycodestyle: false
use-flake8: false
use-black: true
use-mypy: true
use-isort: true
extra-pylint-options: ""
extra-pycodestyle-options: ""
extra-flake8-options: ""
extra-black-options: ""
extra-mypy-options: ""
extra-isort-options: ""
python-version: '3.x'
- name: install dependencies
run: |
python -m pip install pylint mypy black 'isort[colors]'
# mypy dependencies for following imported types
python -m pip install argcomplete
- run: pylint --output-format colorized lddtree.py
- run: mypy lddtree.py
env:
TERM: xterm-color
MYPY_FORCE_COLOR: 1
- run: black --check --diff --color lddtree.py
- run: isort --check --diff --color lddtree.py
2 changes: 1 addition & 1 deletion lddtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
# Disable import errors for all 3rd party modules.
# pylint: disable=import-error
try:
import argcomplete # type: ignore
import argcomplete
except ImportError:
argcomplete = cast(Any, None)

Expand Down

0 comments on commit 25823ba

Please sign in to comment.