Skip to content

Commit

Permalink
CI: added flake8 github action (#364)
Browse files Browse the repository at this point in the history
* CI: added flake8 github action
Handles #352

* minor: change path for flake8 action

* minor: fix spaces in ignore of flake8 action

* minor: add more ignore in flake8 action

* minor: try to add per-file-ignore to flake8 action

* minor: added flake8 to setup.cfg and makefile
  • Loading branch information
mrava87 authored Apr 13, 2022
1 parent 7a4d3a3 commit 8e73eb9
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/flake8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This workflow runs Flake8 on the PR
# For more information see: https://github.com/marketplace/actions/python-flake8-lint
name: PyLops-flake8

on: [push, pull_request]

jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Set up Python environment
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
ignore: "E203,E501,W503,E402"
max-line-length: "88"
path: "pylops"
args: "--per-file-ignores=__init__.py:F401,F403,F405"
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ doc:

docupdate:
cd docs && make html && cd ..

lint:
flake8 docs/ examples/ pylops/ pytests/ tutorials/
15 changes: 12 additions & 3 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,26 @@ that the both old and new tests pass successfully:
>> make tests
7. Commit your changes and push your branch to GitLab:
7. Run flake8 to check the quality of your code:

.. code-block:: bash
>> git add .
>> make lint
Note that at this point we are not enforcing flake8, rather this is used as a guideline and will also be run as
part of our CI. Make sure to limit to a minimum flake8 warnings before making a PR.

8. Commit your changes and push your branch to GitHub:

.. code-block:: bash
>> git add .
>> git commit -m "Your detailed description of your changes."
>> git push origin name-of-your-branch
Remember to add ``-u`` when pushing the branch for the first time.

8. Submit a pull request through the GitHub website.
9. Submit a pull request through the GitHub website.


Pull Request Guidelines
Expand Down
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ dependencies:
- sphinx-gallery
- nbsphinx
- image
- flake8
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ pre-commit
autopep8
isort
black
flake8
6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ test=pytest
[tool:pytest]
addopts = --verbose
python_files = pytests/*.py

[flake8]
ignore = E203, E501, W503, E402
per-file-ignores =
__init__.py: F401, F403, F405
max-line-length = 88

0 comments on commit 8e73eb9

Please sign in to comment.