Skip to content

fix: reduce precision false positives - #79

Merged
alxxjohn merged 1 commit into
mainfrom
fix/v133-precision-false-positive-followup
Jul 28, 2026
Merged

fix: reduce precision false positives#79
alxxjohn merged 1 commit into
mainfrom
fix/v133-precision-false-positive-followup

Conversation

@alxxjohn

Copy link
Copy Markdown
Contributor

Summary

This PR hardens CodeGuard’s precision rules to reduce false positives in TypeScript/JavaScript-heavy application code, especially React/Next/API/
connector-style codebases.

It improves rule behavior for local builders, parser helpers, domain command functions, adapter/orchestration functions, data contracts, and
validated boundary handling so users do not need broad waivers for normal production patterns.

Changes

  • Refined function.hidden-mutation, function.command-query-mix, and quality.hidden-side-effect

    • Allows local Map/Set/array/object accumulation in builder/parser/collector functions.
    • Preserves findings for actual parameter, collaborator, module/global, or external state mutation.
    • Allows domain side-effect names such as loadAbuseConfig, evaluateActionAbuse, and maybeAlert.
  • Reduced noisy duplicated-knowledge findings

    • Ignores CSS/style literals, sentinel values, enum/status-like literals, and table/config value strings where centralizing would add noise.
    • Keeps stronger business-domain literal detection intact.
  • Improved naming precision

    • Allows valid predicate/conventional names such as areStickerPlacementsEqual, asRecord, cached, keys, thresholds, and source.
    • Reduces value noise when local context makes the role clear.
  • Improved design/smell precision

    • Allows DTO mappers, serializers, CSV/export helpers, prompt builders, adapters, and CRUD/orchestration functions.
    • Allows packages/api/src as a persistence boundary.
    • Ignores persistence vocabulary in comments, tests, fixtures, mocks, and stubs.
    • Reduces smell.message-chain and smell.feature-envy noise for normal traversal/mapping code.
  • Improved defensive-pattern recognition

    • Recognizes helper-based validation and zod safeParse.
    • Recognizes new URL(...) with protocol allowlist checks.
    • Recognizes Content-Length preflight before formData().
    • Recognizes byte-length checks after bounded response reads.
    • Treats P2002 retry loops for unique external ID allocation as guarded sequence-collision handling, not integer overflow.
  • Improved TypeScript semantic design checks

    • Skips large data-contract and React prop interfaces for design.typescript.max-interface-members.
    • Keeps true large behavior/policy interfaces eligible for findings.

Validation

  • go test ./tests/checks -count=1
  • go test ./...
  • golangci-lint run
  • make codeguard-ci

@alxxjohn
alxxjohn merged commit 7a42827 into main Jul 28, 2026
16 checks passed
@alxxjohn
alxxjohn deleted the fix/v133-precision-false-positive-followup branch July 28, 2026 13:59
alxxjohn added a commit that referenced this pull request Jul 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.3.4](v1.3.3...v1.3.4)
(2026-07-28)


### Bug Fixes

* reduce precision false positives
([7c52ee1](7c52ee1))
* reduce precision false positives
([#79](#79))
([7a42827](7a42827))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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