fix: resolve sort comparator and code quality issues (@ennajari)#7805
Open
ennajari wants to merge 4 commits intomonkeytypegame:masterfrom
Open
fix: resolve sort comparator and code quality issues (@ennajari)#7805ennajari wants to merge 4 commits intomonkeytypegame:masterfrom
ennajari wants to merge 4 commits intomonkeytypegame:masterfrom
Conversation
- Use localeCompare in sort calls to ensure consistent ordering across locales (setters.ts, Sidebar.tsx, connections.ts, themes.ts) - Add initial value 0 to reduce() in stdDev to handle empty arrays safely - Use explicit undefined check for cached Promise in memoize utility - Add NOSONAR annotations for intentional patterns (thenable object, CharacterCounter side-effect instantiation) - Add .scannerwork/, .claude/, sonar-project.properties to .gitignore
fehmer
reviewed
Apr 10, 2026
backend/src/dal/connections.ts
Outdated
| function getKey(initiatorUid: string, receiverUid: string): string { | ||
| const ids = [initiatorUid, receiverUid]; | ||
| ids.sort(); | ||
| ids.sort((a, b) => a.localeCompare(b)); |
Member
|
We don't use sonar, please remove sonar instructions and .ignore |
fehmer
reviewed
Apr 10, 2026
frontend/src/ts/config/setters.ts
Outdated
| } else { | ||
| newConfig.push(funbox); | ||
| newConfig.sort(); | ||
| newConfig.sort((a, b) => a.localeCompare(b)); |
Member
There was a problem hiding this comment.
I think we want consistent sorting here and not depend on the users locale.
Author
There was a problem hiding this comment.
Changed to a locale-independent comparator: (a, b) => (a < b ? -1 : a > b ? 1 : 0). Same for Sidebar.tsx and themes.ts.
Member
|
Hi @ennajari , thanks for the changes. The pr summary doesn't match the or content anymore |
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.
Summary
(a, b) => (a < b ? -1 : a > b ? 1 : 0)in.sort()calls for consistent ordering regardless of runtime locale (setters.ts,Sidebar.tsx,themes.ts)0toreduce()instdDevto safely handle edge cases!== undefinedcheck instead of truthy check for cachedPromisein memoize utilityTest plan
stdDev([])returns0instead ofNaN