diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index 629c7049ed..3dc0aaf40a 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,4 @@ # Migrate code style to Black 3416fc7fb1986687d800ab06594c901f93879e44 +# Fix flake8 issues +96125f839c115e49d44699ab7d911e8413d4d0b6 diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 97917307f4..d132b33038 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -15,6 +15,10 @@ jobs: uses: psf/black@stable with: version: "21.12b0" + - name: "3. Lint using flake8" + uses: py-actions/flake8@v2 + with: + flake8-version: "4.0.1" tests: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/merge.yml b/.github/workflows/merge.yml index 24039b1a9d..60b57aba1e 100644 --- a/.github/workflows/merge.yml +++ b/.github/workflows/merge.yml @@ -15,6 +15,10 @@ jobs: uses: psf/black@stable with: version: "21.12b0" + - name: "3. Lint using flake8" + uses: py-actions/flake8@v2 + with: + flake8-version: "4.0.1" tests: runs-on: ${{ matrix.os }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8639492b7e..e6af8eb1f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,4 +3,10 @@ repos: rev: 21.12b0 hooks: - id: black-jupyter - language_version: python3 \ No newline at end of file + language_version: python3 + + - repo: https://github.com/PyCQA/flake8 + rev: 4.0.1 + hooks: + - id: flake8 + language_version: python3 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1592392d3e..5084cfce69 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ and discuss it with some of the core team. * `refactor/` * … * Work on your update -7. Check that your code passes all the tests and design new unit tests if needed: `./gradlew unitTest_all`. +7. Check that your code passes all the tests and design new unit tests if needed: `./gradlew test_all`. 8. Verify your tests coverage by running `./gradlew coverageTest` * Additionally you can generate an xml report and use VSCode Coverage gutter to identify untested lines with `./coverage.sh xml` @@ -64,4 +64,5 @@ To ensure you don't need to worry about formatting when contributing, it is reco - [Black integration in your editor](https://black.readthedocs.io/en/stable/integrations/editors.html) - [Black integration in Git](https://black.readthedocs.io/en/stable/integrations/source_version_control.html): 1. Install the pre-commit hook using `pre-commit install` - 2. Black will automatically format all files before committing \ No newline at end of file + 2. Black will automatically format all files before committing + 3. This will also enable flake8 linting diff --git a/requirements/dev.txt b/requirements/dev.txt index a88bb52dd5..6021c6651a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -6,5 +6,5 @@ testfixtures==6.17.1 pytest-cov # linters -flake8 +flake8==4.0.1 black[jupyter]==21.12b0 diff --git a/setup.cfg b/setup.cfg index 2be03f1e09..e2706b5057 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,5 +4,5 @@ exclude = __pycache__, .pytest_cache, __init__.py -ignore = W503 max-line-length = 120 +extend-ignore = E203