Skip to content

Commit dd1ac80

Browse files
heysamtexasclaude
andcommitted
feat: add comprehensive code quality toolkit
Add complete Python code quality analysis tools: - mypy for static type checking with Django stubs - radon for code complexity analysis - vulture for dead code detection - Update CLAUDE.md with usage examples All tools configured for Django development with appropriate exclusions for tests and migrations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fade87c commit dd1ac80

File tree

3 files changed

+154
-0
lines changed

3 files changed

+154
-0
lines changed

CLAUDE.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ uv run ruff format .
7272

7373
# Run tests
7474
uv run src/manage.py test
75+
76+
# Security scanning
77+
uv run bandit -r src/
78+
79+
# Code complexity analysis
80+
uv run radon cc src/ --show-complexity # Cyclomatic complexity
81+
uv run radon mi src/ # Maintainability index
82+
uv run radon raw src/ # Raw metrics (SLOC, comments, etc.)
83+
84+
# Dead code detection
85+
uv run vulture src/ --min-confidence 80 # Find unused code (high confidence)
86+
uv run vulture src/ --min-confidence 60 # Find unused code (medium confidence)
87+
88+
# Type checking
89+
cd src && DJANGO_SETTINGS_MODULE=config.settings uv run mypy organizations/ myapp/ config/ --ignore-missing-imports --disable-error-code=var-annotated
7590
```
7691

7792
## Development Workflow

pyproject.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ dev = [
3939
"pre-commit==4.2.0",
4040
"commitizen>=3.0.0",
4141
"bandit==1.8.0",
42+
"radon==6.0.1",
43+
"vulture==2.14",
44+
"mypy==1.11.2",
45+
"django-stubs[compatible-mypy]==5.1.0",
4246
]
4347

4448
[tool.hatch.build.targets.wheel]
@@ -81,6 +85,20 @@ exclude = [
8185
exclude = ["src/**/tests/**", "src/**/migrations/*"]
8286
skips = ["B106"]
8387

88+
[tool.mypy]
89+
python_version = "3.12"
90+
plugins = ["mypy_django_plugin.main"]
91+
exclude = [
92+
".*/migrations/.*",
93+
".*/tests/.*",
94+
"manage.py",
95+
]
96+
# Suppress some Django-related errors for cleaner output
97+
disable_error_code = ["import-untyped", "var-annotated"]
98+
99+
[tool.django-stubs]
100+
django_settings_module = "config.settings"
101+
84102
[tool.commitizen]
85103
name = "cz_conventional_commits"
86104
version = "0.1.4"

uv.lock

Lines changed: 121 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)