Skip to content

Commit c26dc5d

Browse files
📝 PEP8: Add code quality configuration files (ruff, flake8, mypy)
1 parent 3e8cbe7 commit c26dc5d

File tree

7 files changed

+151
-0
lines changed

7 files changed

+151
-0
lines changed

.code_quality/.flake8

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[flake8]
2+
extend-ignore = E203
3+
exclude =
4+
.git,
5+
__pycache__,
6+
docs,
7+
old,
8+
build,
9+
dist,
10+
./venv,
11+
.venv,
12+
migrations,
13+
alembic
14+
max-complexity = 12
15+
show-source = True
16+
statistics = True
17+
count = True
18+
max-line-length = 79

.code_quality/.gitkeep

Whitespace-only changes.

.code_quality/black.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[tool.black]
2+
line-length = 79
3+
target-version = ['py312']
4+
include = '\.pyi?$'
5+
extend-exclude = '''
6+
/(
7+
# directories
8+
\.eggs
9+
| \.git
10+
| \.hg
11+
| \.mypy_cache
12+
| \.tox
13+
| \.venv
14+
| venv
15+
| _build
16+
| buck-out
17+
| build
18+
| dist
19+
| migrations
20+
| alembic
21+
)/
22+
'''

.code_quality/isort.cfg

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[isort]
2+
profile = black
3+
line_length = 79
4+
multi_line_output = 3
5+
include_trailing_comma = True
6+
force_grid_wrap = 0
7+
use_parentheses = True
8+
ensure_newline_before_comments = True
9+
skip_gitignore = True
10+
11+
known_first_party = app
12+
13+
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
14+
15+
skip_glob =
16+
*/migrations/*
17+
*/alembic/*
18+
*/build/*
19+
*/dist/*
20+
*/.venv/*
21+
*/venv/*

.code_quality/mypy.ini

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[mypy]
2+
python_version = 3.12
3+
4+
warn_return_any = True
5+
warn_unused_configs = True
6+
disallow_untyped_defs = False
7+
disallow_incomplete_defs = False
8+
check_untyped_defs = True
9+
disallow_untyped_decorators = False
10+
no_implicit_optional = True
11+
warn_redundant_casts = True
12+
warn_unused_ignores = True
13+
warn_no_return = True
14+
warn_unreachable = True
15+
strict_equality = True
16+
show_error_codes = True
17+
18+
exclude = build/,dist/,venv/,.venv/,migrations/,alembic/
19+
20+
[mypy-mkdocs.*]
21+
ignore_missing_imports = True
22+
23+
[mypy-mkdocs_simple_blog.*]
24+
disallow_untyped_defs = False
25+
26+
[mypy-tests.*]
27+
disallow_untyped_defs = False

.code_quality/ruff.toml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Ruff configuration
2+
# Modern and fast Python linter
3+
4+
# Line length
5+
line-length = 79
6+
7+
# Target Python version
8+
target-version = "py312"
9+
10+
# Exclude patterns
11+
exclude = [
12+
".git",
13+
"__pycache__",
14+
".venv",
15+
"venv",
16+
"build",
17+
"dist",
18+
"migrations",
19+
"alembic",
20+
"*.egg-info",
21+
]
22+
23+
# Lint configuration
24+
[lint]
25+
# Enable specific rule sets
26+
select = [
27+
"E", # pycodestyle errors
28+
"W", # pycodestyle warnings
29+
"F", # pyflakes
30+
"I", # isort
31+
"B", # flake8-bugbear
32+
"C4", # flake8-comprehensions
33+
"UP", # pyupgrade
34+
"ARG", # flake8-unused-arguments
35+
"SIM", # flake8-simplify
36+
]
37+
38+
# Ignore specific rules
39+
ignore = [
40+
"E501", # Line too long (handled by formatter)
41+
"B008", # Do not perform function calls in argument defaults
42+
"E203", # Whitespace before ':' (flake8 compatibility - handled separately)
43+
]
44+
45+
# Allowed configurations for specific rules
46+
[lint.per-file-ignores]
47+
"__init__.py" = ["F401"] # Allow unused imports in __init__.py
48+
"tests/**" = ["ARG001", "S101"] # Allow unused arguments and assert in tests
49+
50+
# Import sorting (isort)
51+
[lint.isort]
52+
known-first-party = ["mkdocs_simple_blog"]
53+
force-single-line = false
54+
55+
# Formatting (alternative to black)
56+
[format]
57+
quote-style = "double"
58+
indent-style = "space"
59+
skip-magic-trailing-comma = false

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,7 @@ dmypy.json
127127

128128
# Pyre type checker
129129
.pyre/
130+
131+
132+
# Configuration files
133+
.vscode

0 commit comments

Comments
 (0)