Merge pull request #216 from alan-turing-institute/update-python-requ… #109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint all repository code | |
on: | |
# Run workflow on PRs to main | |
pull_request: | |
branches: [main] | |
# Run on merge to main because caches are inherited from parent branches | |
push: | |
branches: | |
- main | |
# checkout needs 'contents:read' | |
permissions: | |
contents: read | |
jobs: | |
# Note that we have to ignore a *lot* of cases as in many places the modules are deliberately showing incorrect code | |
lint_notebooks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install linters | |
run: pip install -r requirements.txt | |
- name: Run black | |
run: nbqa black module*/*.ipynb --nbqa-diff --verbose | |
- name: Run isort | |
run: nbqa isort module*/*.ipynb --nbqa-diff | |
- name: Run pycodestyle | |
run: nbqa pycodestyle module*/*.ipynb --nbqa-diff --ignore=E203,E402,E501,E712,E722,E731,W503 | |
- name: Run flake8 | |
run: nbqa flake8 module*/*.ipynb --nbqa-diff --ignore=E203,E402,E501,E712,E722,E731,F403,F405,F632,F811,F821,W503 |