feat(enrichment): add unsafe-any TypeScript counter analyzer - #3339
Closed
jaso0n0818 wants to merge 1 commit into
Closed
feat(enrichment): add unsafe-any TypeScript counter analyzer#3339jaso0n0818 wants to merge 1 commit into
jaso0n0818 wants to merge 1 commit into
Conversation
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3339 +/- ##
=======================================
Coverage 93.88% 93.88%
=======================================
Files 280 280
Lines 30534 30534
Branches 11120 11120
=======================================
Hits 28666 28666
Misses 1211 1211
Partials 657 657
🚀 New features to boost your workflow:
|
Contributor
|
Important 🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪 🔍 Gittensory is reviewing…AI analysis is in progress. This comment will update when the review is complete. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing |
This was referenced Jul 5, 2026
JSONbored
reviewed
Jul 5, 2026
JSONbored
left a comment
Owner
There was a problem hiding this comment.
Merge conflicts:
This branch has conflicts that must be resolved
Use the [web editor](https://github.com/JSONbored/gittensory/pull/3339/conflicts) or the command line to resolve conflicts before continuing.
.env.example
apps/gittensory-ui/src/lib/rees-analyzers.ts
review-enrichment/analyzer-metadata.json
review-enrichment/src/analyzers/registry.ts
review-enrichment/src/render.ts
review-enrichment/src/types.ts
review-enrichment/test/analyzer-registry.test.ts
src/review/enrichment-analyzer-names.ts
test/unit/enrichment-wire.test.ts
10 tasks
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.
Closes #2017
What
A new local REES analyzer,
unsafeAny, that counts and locates explicitanyusage a PR ADDS in TypeScript — a: anyannotation, anas anycast, or an<any>assertion/type-argument. A type-safety-erosion signal a reviewer can weigh. Structural regex only (no type-checker), pure, no network.Detection
.ts/.tsx/.mts/.ctsfiles are scanned, so JS or prose can't false-positive on the wordany.\bany\bsoanyOf/anything/Companynever match:annotation—: anycast—as anyassertion— an explicitanyinside an angle-bracket type-argument / assertion list, not only the bare<any>:Record<string, any>,Map<string, any>,Promise<any[]>, andArray<any>are all surfaced (a nested generic matches on its innermost<…>group)secret-log.ts'scodeOnly, same-line/* */and trailing//comments are stripped, and a JSDoc/comment continuation line is skipped — but ONLY the*/bare-*/*/continuation shapes, not a generator method like*load(): any {}whose*is followed by an identifier (its: anyis still counted). So"cast as any"in a string,// treat as any value, and* @param p : anyare not counted, whileconst v: any = load(); // TODOstill is. Known limitation (documented in the source, not claimed as a guarantee): cross-line block-comment state is not tracked, so ananyon a continuation line of a multi-line/* … */comment that does not begin with*can still be counted — a rare, accepted false positive of the cheap-strip approach the issue explicitly scopes to "where cheaply detectable".\ No newlineline-counter fix; findings capped (maxFindings: 25) per file and globally.Registration
Registered as a local descriptor (category
quality, costlocal, requires["files"]) with an inlinerender(), following theredos/todoMarkerdescriptor shape. All wiring updated:types.ts(UnsafeAnyFinding+unsafeAny?key),render.ts,analyzer-registry.test.ts, rootsrc/review/enrichment-analyzer-names.ts, roottest/unit/enrichment-wire.test.ts, and the generatedanalyzer-metadata.json/rees-analyzers.ts/.env.examplevianode scripts/generate-analyzer-metadata.mjs.Tests
review-enrichment/test/unsafe-any.test.ts(13 tests) covers: annotation vs cast vs assertion (includingArray<any>),anyinside multi-argument / compound / nested generic type arguments (Record<string, any>,Promise<any[]>,Map<string, any>,Map<K, Set<any>>) surfaced as assertions while a no-anygeneric (Record<string, number>) is not, multiple distinct kinds on one line de-duplicated, word-boundary rejection (anyOf/anything/Company), string/line-comment/block-comment/JSDoc suppression, a real annotation with a trailing comment still counted, non-TS files skipped (.js/.md), added-line scanning with exact locations, added-lines-only with line-number accuracy across mixed hunks, the per-file cap +maxFindings: 0, the entrypoint's TS-only gating + global cap across files, the no-files case, and the rendered brief section. Analyzer metadata is regenerated and committed.