chore: code-quality audit fixes (#651–#656)#660
Merged
Conversation
) Remove Black, standalone isort, and flake8 entirely — their config blocks, dev dependencies, and scripts/lint.sh steps. Ruff now owns lint + format + import order (the `I` rules); mypy and bandit run alongside. This resolves the three-formatter conflict and the Black 24-vs-26 pin skew (#452). Enable a strict mypy subset on the package (disallow_untyped_defs, warn_return_any) and wire the now-green Python lint gate (ruff check + ruff format --check + mypy + bandit) into backend CI. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Remove the misleading "Real implementation lands in PR #2" note on the shipped _PackageSettings dataclass and a dead `# noqa: ARG002` line in views.py that suppressed nothing (#654). (audit.py dead-code removal landed in the preceding lint-stack commit.) - Type the admin_site view helpers as AdminSite (type-only import, so the package still works with django.contrib.admin removed) and add the missing `from typing import Any` to tests/test_spa_index.py (F821) (#655). - Normalize residual lint debt (import order + slice/assert formatting) across tests and templatetags now that the gate is green (#651). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Repoint or remove docstring / comment / pre-commit citations to docs that no longer exist (docs/ux/pwa.md, pwa.md, theming.md, ACCEPTANCE.md, REVIEW_CHECKLIST.md, docs/threat-model.md) so they target the surviving ARCHITECTURE.md / SECURITY.md sections. (conf.py's docs/ux/pwa.md cites were fixed alongside the comment cleanup in the preceding commit.) Add tests/test_doc_refs.py plus a pre-commit hook that fails when a *.md file or §N section cited in the package source, tests, or .pre-commit-config.yaml no longer exists, so this defect class can't recur. Also drop the black + isort pre-commit hooks per #651/#652. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Flip @typescript-eslint/no-explicit-any from 'off' to 'error' to lock in the existing zero-`any` state; no violations surfaced. - Remove the stale .eslintrc.cjs entry from the flat-config ignores. - Add /** JSDoc to the Checkbox, Input, Spinner, EmptyState, and DateHierarchyBar primitives for doc consistency. Verified: pnpm lint:js, pnpm lint:css, pnpm typecheck all pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
#656) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Code-quality audit fixes from the Python + frontend audits. Addresses #651–#656; #657 (DetailPage/ListPage split) is deferred and not touched. No PyPI version bump, no release.
Per-fix
[tool.*]blocks,[tool.poetry.group.dev.dependencies]entries, pre-commit hooks, andscripts/lint.shsteps). Ruff now owns lint + format + import order (Irules already inselect); mypy + bandit run alongside. Resolves the three-formatter conflict and the Black 24-vs-26 pin skew (CI stability: the test suites don't run in CI — test regressions merge undetected (only CodeQL gates) #452). Ranpoetry lock+poetry install, thenruff check --fix+ruff formatto clear the existing debt and normalize the tree. Wired the now-green Python lint gate into backend CI (was pytest-only).docs/ux/pwa.md,pwa.md,theming.md,ACCEPTANCE.md,REVIEW_CHECKLIST.md,docs/threat-model.md) to survivingARCHITECTURE.md/SECURITY.mdsections. Addedtests/test_doc_refs.py+ a pre-commit hook that fails on a*.mdfile or§Nsection cited in source that doesn't exist._PackageSettings"lands in PR PR #2 — docs(agents): autonomous PR workflow + autonomy policy #2" docstring; removed the dead# noqa: ARG002line inviews.py; deleted the unused, 0%-coveragedjango_admin_react/audit.py(confirmed imported nowhere).from typing import Anytotests/test_spa_index.py(F821); typed theadmin_siteview helpers asAdminSite(type-only import so the package still works withdjango.contrib.adminremoved); enabled thedisallow_untyped_defs+warn_return_anymypy subset on the package.@typescript-eslint/no-explicit-anyoff→error(no violations); removed the stale.eslintrc.cjsignore; added/**JSDoc toCheckbox,Input,Spinner,EmptyState,DateHierarchyBar.Verification (all green)
Python:
ruff check✓,ruff format --check(27 files) ✓,mypy django_admin_react✓,bandit -r django_admin_react -c pyproject.toml(0 issues) ✓,pytest✓ (66 passed).pre-commit run✓ on all changed in-scope files.Frontend:
pnpm lint:js✓,pnpm lint:css✓,pnpm typecheck✓ (all 13 projects).Decisions
disallow_untyped_defs+warn_return_anysubset rather than fullstrict = true— full strict would also require typing the test suite (gaps tracked in Type-hint coverage: 3 package gaps + 139 untyped defs in tests/ + enable an ANN/strict-defs gate #318). The package passes the subset cleanly today.no-explicit-any: flipping toerrorsurfaced zero violations.AdminSiteimport isTYPE_CHECKING-only so the runtime "admin removed from INSTALLED_APPS" path is preserved.examples/*/migrations/0001_initial.pyand pre-existingexamples/lint debt were intentionally left untouched / uncommitted.Closes #651
Closes #652
Closes #653
Closes #654
Closes #655
Closes #656
🤖 Generated with Claude Code