Skip to content

Commit

Permalink
ci: added flake8 linter
Browse files Browse the repository at this point in the history
addresses reanahub#456
  • Loading branch information
audrium committed Nov 18, 2020
1 parent 570cc1c commit 86e1c8b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
20 changes: 20 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[flake8]
max-line-length = 89

exclude =
build
modules
dist
docs
coverage.xml
reana_job_controller.egg-info
.*/
env/
.git
__pycache__

ignore = E203, E231, E266, E501, W503, F403, F401

max-complexity = 18

select = B,C,E,F,W,T4,B9
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ jobs:
pip install black==19.10b0
./run-tests.sh --check-black
lint-flake8:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Check compliance with pep8, pyflakes and circular complexity
run: |
pip install --upgrade pip
pip install flake8
./run-tests.sh --check-flake8
lint-pydocstyle:
runs-on: ubuntu-20.04
steps:
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include *.html
include *.yaml
include *.yml
include *.sh
include .flake8
include pytest.ini
prune docs/_build
recursive-include reana *.py
Expand Down
6 changes: 6 additions & 0 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ check_black () {
black --check .
}

check_flake8 () {
flake8 .
}

check_pydocstyle () {
pydocstyle reana
}
Expand All @@ -43,6 +47,7 @@ check_helm () {
check_all () {
check_script
check_black
check_flake8
check_pydocstyle
check_manifest
check_sphinx
Expand All @@ -60,6 +65,7 @@ do
case $arg in
--check-shellscript) check_script;;
--check-black) check_black;;
--check-flake8) check_flake8;;
--check-pydocstyle) check_pydocstyle;;
--check-manifest) check_manifest;;
--check-sphinx) check_sphinx;;
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

# Get the version string. Cannot be done with import!
with open(os.path.join("reana", "version.py"), "rt") as f:
version = re.search('__version__\s*=\s*"(?P<version>.*)"\n', f.read()).group(
version = re.search(r'__version__\s*=\s*"(?P<version>.*)"\n', f.read()).group(
"version"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/benchmark/locustfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def setup(self):
@task
def ping(self):
"""Ping reana instance."""
self.client.get(f"/api/ping")
self.client.get("/api/ping")

@task
def get_worflows(self):
"""Get workflows."""
self.client.get(f"/api/workflows", params=(("access_token", TOKEN),))
self.client.get("/api/workflows", params=(("access_token", TOKEN),))

@task
def get_worflow_logs(self):
Expand Down

0 comments on commit 86e1c8b

Please sign in to comment.