Skip to content

Commit 9283bdf

Browse files
authored
Merge pull request #57 from ulgens/flake8-precommit
Wrap flake8 in pre-commit hooks
2 parents ca531e4 + 1c44e6b commit 9283bdf

File tree

3 files changed

+12
-20
lines changed

3 files changed

+12
-20
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,3 @@ jobs:
4949
# - name: Upload coverage to coveralls
5050
# run: |
5151
# coveralls
52-
53-
lint:
54-
runs-on: ubuntu-latest
55-
56-
steps:
57-
- uses: actions/checkout@v4
58-
59-
- name: Set up Python 3.12
60-
uses: actions/setup-python@v5
61-
with:
62-
python-version: '3.12'
63-
64-
- name: Install tox and flake8 packages
65-
run: pip install tox tox-gh-actions flake8
66-
67-
- name: Lint
68-
run: tox -e flake8

.github/workflows/prek.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Check pre-commit hooks
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
prek:
7+
runs-on: ubuntu-24.04
8+
steps:
9+
- uses: actions/checkout@v5.0.0
10+
- uses: j178/prek-action@v1.0.11

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
22

3-
import io
43
import os
54
import re
65
import sys
@@ -41,7 +40,7 @@ def read(fname, fail_silently=False):
4140
filepath = os.path.join(os.path.dirname(__file__), fname)
4241
with open(filepath, encoding="utf8") as f:
4342
return f.read()
44-
except:
43+
except Exception:
4544
if not fail_silently:
4645
raise
4746
return ""
@@ -65,7 +64,7 @@ def extra_requirements(cls, glob_pattern):
6564
pattern = os.path.join(os.path.dirname(__file__), glob_pattern)
6665
requirements = {}
6766
for path in glob.glob(pattern):
68-
name = path[len(before) : -len(after)]
67+
name = path[len(before): -len(after)]
6968
requirements[name] = cls.requirements(path)
7069
return requirements
7170

0 commit comments

Comments
 (0)