Repository navigation
fix: resolve findings from the new SonarQube 26.9 rules - #246
Merged
Merged
Conversation
The Sonar way profiles gained about 50 rules on 2026-10-12; existing code violated 23 of them and blocked the pre-push gate. - sketch-facts: drop the redundant whitespace inside the array-size group, which caused super-linear backtracking; the group is trimmed anyway - scripts: startsWith, optional chains, explicit reduce seeds, safe stringification of unknown errors and ws RawData - tests: toHaveLength and getBy* presence assertions with the same expectations (approved by the owner) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 tasks done
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.
Why
The local SonarQube server was updated to 26.9 on 2026-10-12; "Sonar way" gained ~50 TypeScript/JavaScript rules. Existing code (April–October) violated 23 of them, and because the new-code period runs since version 1.0, they counted as new and blocked every push in the pre-push gate.
Changes
server/services/tutor/curriculum/sketch-facts.ts(S8786): the array-size group\s*\[\s*([^\]]*)\s*\]had overlapping whitespace quantifiers (super-linear backtracking). Now\s*\[([^\]]*)\]; the captured size is trimmed before parsing, so results are unchanged. Curriculum tests green.startsWithinstead of regex/slice (S6557), optional chains (S6582), explicitreduceseeds (S6959), safe stringification of unknown errors andwsRawData (S6551),if (!directory)(S3403). A follow-up commit replaces a nested ternary I introduced (S3358).toHaveLength(...)instead of.length+toBe(...)(S5906), one presence check usesgetByRoleinstead ofqueryByRole(S9027). Same expectations, better failure messages.Test plan
./run-tests.sh– all tests green (Docker 32/32, E2E 28/28)Note:
run-tests.shonly shows the last server-side gate unlessREQUIRE_RELEASE_GATE=1; the fresh scan happens in the pre-push hook.🤖 Generated with Claude Code