Skip to content

feature: deepen code smell and maintainability precision checks - #71

Merged
alxxjohn merged 5 commits into
mainfrom
feature/deep-code-smells-maintainability-precision
Jul 27, 2026
Merged

feature: deepen code smell and maintainability precision checks#71
alxxjohn merged 5 commits into
mainfrom
feature/deep-code-smells-maintainability-precision

Conversation

@alxxjohn

Copy link
Copy Markdown
Contributor

Summary

This branch deepens CodeGuard’s production-readiness and maintainability review coverage beyond baseline lint-style checks. It adds deterministic, multi-language detectors for structural code smells, naming/vocabulary drift, function responsibility quality, error contracts, defensive boundary handling, and remaining reliability parity gaps across Go, Python, TypeScript, JavaScript, and C++.

It also reconciles rule metadata, fix templates, profile/config behavior, docs, and the checks glossary so user-facing docs advertise shipped checks rather than roadmap-only ideas.

What changed

Reliability parity hardening

  • Expanded parity for existing reliability rules across Python, TypeScript, JavaScript, and C++.
  • Added/deepened detection for:
    • reliability.missing-cancellation
    • reliability.missing-graceful-shutdown
    • reliability.missing-concurrency-limit
    • reliability.resource-leak for TS/JS stream/file cleanup paths
    • reliability.missing-timeout for common C++ outbound dependency calls
    • reliability.swallowed-error for C++ catch blocks
    • reliability.lost-error-context across Python, TS, JS, and C++
  • Added focused multi-language tests in tests/checks/reliability_multilang_test.go.

Structural smell rules

  • Added structural smell detectors and scanner wiring for Go, Python, TypeScript, JavaScript, and C++.
  • Added rule metadata and fix templates for:
    • smell.god-object
    • smell.feature-envy
    • smell.middle-man
    • smell.message-chain
    • smell.data-clump
    • smell.switch-on-type
  • Added multi-language structural smell tests.
  • Deferred smell.refused-bequest because reliable inheritance/no-op evidence needs stronger parser support to avoid noisy findings.

Naming and vocabulary precision

  • Added/deepened naming precision checks:
    • naming.behavior-mismatch
    • naming.boolean-not-predicate
    • naming.domain-vocabulary-drift
    • naming.unknown-abbreviation
    • naming.cardinality-mismatch
    • naming.implementation-leak
    • naming.missing-unit
    • naming.role-suffix-overuse
    • naming.cross-layer-inconsistency
  • Added optional repository glossary support through quality_rules.naming.glossary.
  • Added config/defaults/validation and SDK aliases for naming configuration.

Function responsibility metrics

  • Added/deepened function-level maintainability checks:
    • function.hidden-mutation
    • function.inconsistent-return-contract
    • function.multiple-responsibilities
    • function.orchestration-domain-mix
    • function.partial-result
  • Kept existing function precision coverage integrated with the new responsibility metrics.

Error contract and defensive programming checks

  • Added error-contract rules covering:
    • logged-and-returned / logged-and-ignored errors
    • lost context and generic messages
    • abstraction-level leaks
    • inconsistent wrapping
    • retryable/permanent distinction
    • user-facing internal leaks
    • hidden partial failures
    • ignored cleanup errors
    • panic/exception control-flow patterns
  • Added defensive boundary/invariant checks covering:
    • unvalidated boundary input
    • invalid state representation
    • null assumptions
    • unchecked type assertions
    • unsafe numeric conversions / overflow
    • bounds assumptions
    • unsafe defaults
    • non-exhaustive branches
    • unchecked external responses
    • missing schema validation
    • missing resource limits
    • invalid state transitions
    • fail-open authorization
  • Added multi-language tests for the error and defensive rule families.

Docs, metadata, and profile/config reconciliation

  • Updated rule catalog metadata and fix templates for shipped smell, naming, function, error, defensive, maintainability, and reliability parity IDs.
  • Updated docs/checks.md and docs/features.md so the shipped checks are visible and roadmap-only rules are not over-advertised.
  • Added SDK metadata/profile/config tests, including naming glossary YAML/validation coverage.
  • Updated the branch task board and removed completed old task boards.

Validation

Validation reported by the branch workers and final integration pass:

go test ./tests/checks -run Reliability
go test ./tests/cli -run Metadata
go test ./tests/checks ./tests/cli
go test ./tests/checks ./tests/cli ./internal/codeguard/config ./internal/codeguard/rules -count=1
make ci
make codeguard-ci
git diff --check

Final CodeGuard dogfood result:

  • Code Quality: pass
  • Performance: pass
  • Design Patterns: pass
  • CI/CD: pass
  • Supply Chain: pass
  • Agent Context: pass

Notes / deferred follow-up

  • smell.refused-bequest remains deferred until inheritance/no-op detection can be made precise enough.
  • Some checks are intentionally conservative static heuristics, not semantic proofs. Deeper future precision would benefit from richer type information, CFG/state-machine modeling, and stronger parser support.

@alxxjohn alxxjohn changed the title Deepen code smell and maintainability precision checks feature: deepen code smell and maintainability precision checks Jul 27, 2026
@alxxjohn
alxxjohn merged commit d554347 into main Jul 27, 2026
16 checks passed
alxxjohn added a commit that referenced this pull request Jul 27, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.3.0](v1.2.2...v1.3.0)
(2026-07-27)


### Features

* add abstraction quality checks
([fc5a7ec](fc5a7ec))
* add change safety diff detectors
([ebc2f80](ebc2f80))
* add change safety PR summary metrics
([5b10ecd](5b10ecd))
* add delivery governance checks
([eb1b803](eb1b803))
* add local quality precision rules
([dd75b79](dd75b79))
* add local quality precision rules
([00c493e](00c493e))
* add observability and operations checks
([3e8713c](3e8713c))
* add operability, design, and delivery governance checks
([#70](#70))
([a52199a](a52199a))
* add opt-in recommended check defaults
([1680b21](1680b21))
* add opt-in recommended check defaults
([#66](#66))
([67510e3](67510e3))
* add production readiness rule families
([d58e8eb](d58e8eb))
* Add production reliability and data-readiness checks across languages
([#67](#67))
([c243ead](c243ead))
* add refused bequest smell detection
([053cb1a](053cb1a))
* add refused bequest smell detection
([#72](#72))
([4423aa4](4423aa4))
* add structural smell quality rules
([eefd8bd](eefd8bd))
* change safety testability refactors
([#69](#69))
([9081ad3](9081ad3))
* deepen code smell and maintainability precision checks
([#71](#71))
([d554347](d554347))
* deepen reliability parity checks
([fc8d769](fc8d769))
* expand production readiness language coverage
([588bf19](588bf19))
* scaffold change safety checks
([0b313d9](0b313d9))


### Bug Fixes

* dogfood production readiness coverage
([1110f4f](1110f4f))
* restore change testability detectors
([88f6df0](88f6df0))
* satisfy strict lint for change safety
([311716c](311716c))
* satisfy strict lint for operability governance
([abc9fd1](abc9fd1))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
@alxxjohn
alxxjohn deleted the feature/deep-code-smells-maintainability-precision branch July 28, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant