Repository navigation
Fix lint findings and check indexed access in src/ (D1, D3) - #22
Merged
Merged
Conversation
Turns on noUncheckedIndexedAccess for src/ (tsconfig.json only; tests keep their config). Index reads, destructured elements, and regex groups are now checked. Mandatory regex groups go through a captured() helper. The flag found a real bug: matchToProblem passed a non-participating optional file group, undefined despite an in-range index, to path.normalize, which threw and dropped every result of that problem-matching pattern. Other fixes: - SingleFlight swallowed a rejection whose reason was undefined. Outcomes are now flagged. - reparse() could reject unhandled from watcher and editor events. It now reports its own failures, and fire-and-forget refresh() calls are marked void. - runPlan's selection map was implicitly any; it is now typed. - normalizePatterns() and readCppUnitReport() take unknown and narrow it, instead of trusting types that user JSON and parsed XML don't guarantee. - ProcessRunner keeps callback-shared state in one object. The non-null assertions are gone, and the controller passes the TestController to its item builders. - Error interpolation uses util.format. Type-only imports are marked. Redundant assertions, the async-without-await activate(), and the unused ProblemMatchingPattern re-export are removed. Discovery's line lookup is a binary search. Deliberate patterns are marked inline with reasons: sequential awaits, /proc's synchronous snapshot, a Unity-verbatim regex escape, split()'s undefined pieces, and a TypeScript control-flow false positive. require-await is off for test doubles. Lint goes from 121 findings to 9. The 9 remaining are the engine's sync I/O and sequential discovery, which the async performance work addresses. Co-Authored-By: Claude Opus 5.5 <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.
This PR applies approved decisions D1 (compiler strictness) and D3 (lint triage) from the findings report.
Stacked on #21.
Results:
D1:
noUncheckedIndexedAccessforsrc/The flag is on in
tsconfig.json; tests keep their own config. All 34 compile errors are resolved:captured()helper, with a comment on why each is guaranteed.The flag also removes the seven false alarms in which the linter called real runtime guards impossible.
It found a real bug.
matchToProblem()checked group indexes against the array length, but a custom pattern's optional file group that didn't participate isundefinedat an in-range index. That value reachedpath.normalize(), which threw, and the whole pattern's results were dropped. Two failing tests came first.D3: lint triage
Fixes:
SingleFlightdropped a rejection whose reason wasundefined. It now records outcomes as a flag. A failing test came first.reparse()could reject unhandled. It runs from watchers and editor events without being awaited; it now catches and logs its own failures. The deliberate fire-and-forgetrefresh()calls are markedvoid.runPlan's untypednew Map()made the whole selectionany. It's now typed.normalizePatterns()andreadCppUnitReport()takeunknownand narrow it, instead of trusting types that user JSON and parsed XML don't guarantee. Their shape checks are now meaningful to the compiler.CeedlingRunnerkeeps the state it shares with its exit callback in one object, and its non-null assertions are gone.TestControllerto its item builders instead of usingthis.controller!.resolveLaunchConfig()returns a typedDebugConfiguration.dispose()callbacks use block bodies.util.formatfor interpolated errors,import type, removal of redundant assertions and of theasynconactivate(), removal of the deadProblemMatchingPatternre-export, and binary-search line lookup in discovery.Marked inline with reasons:
awaits that are deliberate (the run plan, clean and clobber,SingleFlight);/procsnapshot taken on cancellation;split()'sundefinedpieces, which the library typing hides;Tuning:
require-awaitis off for test doubles.🤖 Generated with Claude Code