Skip to content

Commit e3e4190

Browse files
committed
Add flake config file for pre-commit
1 parent 3903b42 commit e3e4190

3 files changed

Lines changed: 37 additions & 10 deletions

File tree

.flake8

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
[flake8]
2+
# Python version target
3+
python-version = 3.10
4+
5+
# Maximum line length (matches black's default, but we allow longer for URLs/paths)
6+
max-line-length = 127
7+
8+
# Select only critical errors that would cause runtime issues
9+
# E9: Runtime errors (e.g., IndentationError, SyntaxError)
10+
# F63: Placeholder for assertions in pytests
11+
# F7: Various errors (e.g., two starred expressions in assignment)
12+
# F82: Undefined names
13+
select = E9,F63,F7,F82
14+
15+
# Ignore specific error codes
16+
# E203: Whitespace before ':' (conflicts with black)
17+
# W503: Line break before binary operator (conflicts with black)
18+
extend-ignore = E203,W503
19+
20+
# Directories to exclude from linting
21+
exclude =
22+
.git,
23+
__pycache__,
24+
.venv,
25+
venv,
26+
build,
27+
dist,
28+
*.egg-info
29+
30+
# Show source code for each error
31+
show-source = true
32+
33+
# Show statistics (number of each type of error)
34+
statistics = true

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ repos:
99
rev: 6.1.0
1010
hooks:
1111
- id: flake8
12-
args: ['--exit-zero', '--show-source', '--statistics'] # Show all warnings with details
12+
# Use .flake8 for configuration (separate file to avoid TOML parsing issues)
13+
# --exit-zero: show warnings but don't fail pre-commit
14+
args: ['--config', '.flake8', '--exit-zero']

pyproject.toml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,6 @@ exclude = '''
2828
)/
2929
'''
3030

31-
[tool.flake8]
32-
python-version = '3.10'
33-
max-line-length = 127
34-
select = ['E9', 'F63', 'F7', 'F82']
35-
extend-ignore = ['E203', 'W503']
36-
exclude = ['.git', '__pycache__', '.venv', 'venv', 'build', 'dist', '*.egg-info']
37-
show-source = true
38-
statistics = true
39-
4031
[tool.pytest.ini_options]
4132
testpaths = ["tests"]
4233
python_files = ["test_*.py"]

0 commit comments

Comments
 (0)