test(codeql): clear all 70 test-code CodeQL alerts (real fixes)#185
Merged
Conversation
…preserving) Resolves all 70 open CodeQL alerts located in the test suite, with real fixes (no suppressions, no threshold changes); production src and coverage scope are untouched, so the 100% line+branch .NET coverage gate is unaffected. - cs/missed-using-statement (14): manual try/finally Dispose -> `using var`. - cs/useless-upcast (14): `(T)null` cast -> `default(T)` (preserves params-array element typing / overload selection; not a cast, so the alert clears). - cs/useless-assignment-to-local (16): drop dead locals / discard, keep calls. - cs/dereferenced-value-may-be-null (18): `... as JsonObject` -> `!.AsObject()`; other `as T` derefs guarded with `?? throw` so flow is provably non-null. - cs/missed-using / cs/local-not-disposed / cs/dispose-not-called-on-throw (4): `using var` for accessor/CTS/freeze-service instances. - cs/empty-catch-block (2) + cs/catch-of-all-exceptions (1): document intent / catch specific IOException + UnauthorizedAccessException for best-effort cleanup. - cs/linq/missed-select (1): foreach immediate-map -> `.Select(...)`. The 1 src alert (cs/call-to-unmanaged-code in ProcessMemoryScanner: P/Invoke ReadProcessMemory) is dismissed as by-design via code-scanning (no managed cross-process memory-read API exists). Verified: solution builds with 0 errors; 1,306 modified-class tests pass.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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.
Drives code-scanning to 0. Fixes all 70 open CodeQL alerts in the test suite with real, behavior-preserving changes (no suppressions, no threshold changes). Production
src/and coverage scope are untouched, so the 100% line+branch .NET coverage gate is unaffected.Rule breakdown: missed-using (14)→
using var; useless-upcast (14)→default(T); useless-assignment (16)→drop dead locals/discard; dereferenced-may-be-null (18)→!.AsObject()/as T ?? throw; dispose/local-not-disposed (4)→using var; empty-catch (2)+catch-all (1)→specific catches w/ intent comments; linq/missed-select (1)→.Select().The single
src/alert (cs/call-to-unmanaged-code: P/InvokeReadProcessMemoryin ProcessMemoryScanner) is dismissed as by-design (no managed cross-process memory-read API exists).Local verification:
dotnet build0 errors; 1,306 modified-class tests pass, 0 failures. Full suite + nightly CodeQL rescan confirmed by CI.