Skip to content

Commit 2f3a67d

Browse files
authored
Merge pull request #18 from QuLogic/flake8
Add flake8 CI, and drop exceptions
2 parents 479fa0e + 0f57c41 commit 2f3a67d

File tree

3 files changed

+45
-19
lines changed

3 files changed

+45
-19
lines changed

.github/workflows/lint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
3+
name: Linting
4+
on: [pull_request]
5+
6+
jobs:
7+
flake8:
8+
name: flake8
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up Python 3
14+
uses: actions/setup-python@v1
15+
with:
16+
python-version: 3.8
17+
18+
- name: Install flake8
19+
run: pip3 install 'flake8>=3.8'
20+
21+
- name: Set up reviewdog
22+
run: |
23+
mkdir -p "$HOME/bin"
24+
curl -sfL \
25+
https://github.com/reviewdog/reviewdog/raw/master/install.sh | \
26+
sh -s -- -b "$HOME/bin"
27+
echo "$HOME/bin" >> $GITHUB_PATH
28+
29+
- name: Run flake8
30+
env:
31+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
set -o pipefail
34+
flake8 | \
35+
reviewdog -f=pep8 -name=flake8 \
36+
-tee -reporter=github-check -filter-mode nofilter

mpl_sphinx_theme/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from ._version import version_info, __version__
1+
from ._version import version_info, __version__ # noqa: F401
22

33
from pathlib import Path
44

@@ -8,7 +8,8 @@ def get_html_theme_path():
88
return [str(Path(__file__).parent.parent.resolve())]
99

1010

11-
# See https://www.sphinx-doc.org/en/master/development/theming.html#distribute-your-theme-as-a-python-package
11+
# For more details, see:
12+
# https://www.sphinx-doc.org/en/master/development/theming.html#distribute-your-theme-as-a-python-package
1213
def setup(app):
1314
app.add_html_theme("mpl_sphinx_theme",
1415
str(Path(__file__).parent.resolve()))

setup.cfg

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,9 @@
33
# https://flake8.readthedocs.io/en/latest/user/configuration.html
44
# https://flake8.readthedocs.io/en/latest/user/error-codes.html
55

6-
# Aligned with black https://github.com/psf/black/blob/main/.flake8
7-
extend-ignore = E203, E266, E501
8-
# Note: there cannot be spaces after commas here
9-
exclude = __init__.py,versioneer.py
10-
ignore =
11-
E4, # Import formatting
12-
E731, # Assigning lambda expression
13-
W503, # line break before binary operator
14-
15-
per-file-ignores =
16-
**/tests/*:
17-
# local variable is assigned to but never used
18-
F841,
19-
# Ambiguous variable name
20-
E741,
21-
22-
max-line-length = 88
6+
exclude =
7+
.git
8+
build
9+
# External files.
10+
.tox
11+
.eggs

0 commit comments

Comments
 (0)