Skip to content

Commit 54909bd

Browse files
committed
feat: add code quality tools and pre-commit configuration
- Add pre-commit hooks with Black, Flake8, isort, and MyPy - Configure pyproject.toml for consistent code formatting - Set up automated code quality checks on commits - Include trailing whitespace and file formatting hooks - Configure type checking and import sorting standards
1 parent 517ae78 commit 54909bd

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 23.12.1
4+
hooks:
5+
- id: black
6+
language_version: python3
7+
args: ['--line-length=88']
8+
9+
- repo: https://github.com/pycqa/flake8
10+
rev: 7.0.0
11+
hooks:
12+
- id: flake8
13+
args: ['--max-line-length=88', '--ignore=E203,W503']
14+
15+
- repo: https://github.com/pycqa/isort
16+
rev: 5.13.2
17+
hooks:
18+
- id: isort
19+
args: ["--profile", "black"]
20+
21+
- repo: https://github.com/pre-commit/mirrors-mypy
22+
rev: v1.8.0
23+
hooks:
24+
- id: mypy
25+
additional_dependencies: [types-all]
26+
args: [--ignore-missing-imports, --no-strict-optional]
27+
28+
- repo: https://github.com/pre-commit/pre-commit-hooks
29+
rev: v4.5.0
30+
hooks:
31+
- id: trailing-whitespace
32+
- id: end-of-file-fixer
33+
- id: check-yaml
34+
- id: check-added-large-files
35+
- id: check-merge-conflict
36+
- id: debug-statements

pyproject.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[tool.black]
2+
line-length = 88
3+
target-version = ['py38']
4+
include = '\.pyi?$'
5+
extend-exclude = '''
6+
/(
7+
# directories
8+
\.eggs
9+
| \.git
10+
| \.mypy_cache
11+
| \.tox
12+
| \.venv
13+
| build
14+
| dist
15+
)/
16+
'''
17+
18+
[tool.isort]
19+
profile = "black"
20+
multi_line_output = 3
21+
line_length = 88
22+
known_first_party = ["coderag"]
23+
24+
[tool.mypy]
25+
python_version = "3.8"
26+
ignore_missing_imports = true
27+
disallow_untyped_defs = false
28+
warn_unused_ignores = true
29+
warn_redundant_casts = true
30+
check_untyped_defs = true

0 commit comments

Comments
 (0)