Skip to content

Commit

Permalink
Feat/set up flake8 (#749)
Browse files Browse the repository at this point in the history
* Modify flake8 config for Black compatibility

* Add flake8 pre-commit

* Pin flake8 requirement

* Add flake8 Github action

* Modify test command to include linting

* Ignore flake8 issues fix in git blame

* Mention flake8 pre-commit linting
  • Loading branch information
tomasvanpottelbergh authored Jan 21, 2022
1 parent 96125f8 commit d94428a
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Migrate code style to Black
3416fc7fb1986687d800ab06594c901f93879e44
# Fix flake8 issues
96125f839c115e49d44699ab7d911e8413d4d0b6
4 changes: 4 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ repos:
rev: 21.12b0
hooks:
- id: black-jupyter
language_version: python3
language_version: python3

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
language_version: python3
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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
2. Black will automatically format all files before committing
3. This will also enable flake8 linting
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ testfixtures==6.17.1
pytest-cov

# linters
flake8
flake8==4.0.1
black[jupyter]==21.12b0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ exclude =
__pycache__,
.pytest_cache,
__init__.py
ignore = W503
max-line-length = 120
extend-ignore = E203

0 comments on commit d94428a

Please sign in to comment.