Skip to content

Commit

Permalink
Provide flake8 CI with some teeth
Browse files Browse the repository at this point in the history
Add flake8 config through setup.cfg
  • Loading branch information
CasperWA committed Sep 28, 2020
1 parent 8f5383f commit 731ff8a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U pip
pip install flake8
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
flake8 . --count --statistics
pre-commit:

Expand All @@ -46,7 +46,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U pip
pip install -U setuptools
pip install pre-commit
Expand All @@ -72,7 +72,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -U pip
pip install -U setuptools
pip install -e .[testing]
Expand Down
24 changes: 12 additions & 12 deletions optimade_client/subwidgets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# pylint: disable=undefined-variable
from .filter_inputs import *
from .multi_checkbox import *
from .output_summary import *
from .periodic_table import *
from .provider_database import *
from .results import *
from .filter_inputs import * # noqa: F403
from .multi_checkbox import * # noqa: F403
from .output_summary import * # noqa: F403
from .periodic_table import * # noqa: F403
from .provider_database import * # noqa: F403
from .results import * # noqa: F403


__all__ = (
filter_inputs.__all__ # noqa
+ multi_checkbox.__all__ # noqa
+ output_summary.__all__ # noqa
+ periodic_table.__all__ # noqa
+ provider_database.__all__ # noqa
+ results.__all__ # noqa
filter_inputs.__all__ # noqa: F405
+ multi_checkbox.__all__ # noqa: F405
+ output_summary.__all__ # noqa: F405
+ periodic_table.__all__ # noqa: F405
+ provider_database.__all__ # noqa: F405
+ results.__all__ # noqa: F405
)
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[flake8]
ignore =
# Line to long. Handled by black.
E501
# Line break before binary operator. This is preferred formatting for black.
W503
# Whitespace before ':'
E203
4 changes: 3 additions & 1 deletion tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
def update_file(filename: str, sub_line: Tuple[str, str], strip: str = None):
"""Utility function for tasks to read, update, and write files"""
with open(filename, "r") as handle:
lines = [re.sub(sub_line[0], sub_line[1], l.rstrip(strip)) for l in handle]
lines = [
re.sub(sub_line[0], sub_line[1], line.rstrip(strip)) for line in handle
]

with open(filename, "w") as handle:
handle.write("\n".join(lines))
Expand Down

0 comments on commit 731ff8a

Please sign in to comment.