Repository navigation
fix(vscode): sort the diagram panel's relationship kinds with an explicit code-unit comparator - #1335
Merged
Merged
Conversation
…icit code-unit comparator Sonar typescript:S2871 flags the bare Array.prototype.sort at showRelations. The kinds are the renderer's ASCII identifiers and the list's order should not depend on the webview's locale, so it uses the byCodeUnit comparator layout.ts already keeps for the same reason. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
4 of 6 tasks
6 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.
What and why
develop's SonarCloud quality gate failsnew_reliability_rating = 4(threshold 1) on one new-code bug:typescript:S2871ateditors/vscode/src/webview/diagram.ts:511— the diagram panel's relationship-kind list was built with a bare[...kinds.keys()].sort(). Verified unauthenticated:api/issues/search?componentKeys=Open-MBEE_OpenSysML&branch=develop&resolved=false&sinceLeakPeriod=true&impactSoftwareQualities=RELIABILITY(and&types=BUG) returns exactly this one issue, so with it and the three security issues of #1329 fixed, no new-code condition is left red on develop.Which order. The kinds are the renderer's ASCII identifiers shown as checkbox labels; what the list needs is a stable order that does not depend on the webview's locale, which is what the bare sort gave (code-unit order, every locale) and what
layout.tsalready namesbyCodeUnitfor its own sort. The fix exports that comparator and passes it, rather than switching the list tolocaleCompare(locale-dependent, and not what the code relied on). The order of the list is unchanged for today's kinds.In-flight overlap
#1330 (
f26e19977) edits the same file at lines 98, 314 and 846; this branch touches lines 35 and 512.git merge --no-commit --no-ff refs/remotes/pr/1330on this head: auto-merge clean, no conflicting files. No other open PR or PR-less branch toucheslayout.ts'sbyCodeUnit.How SonarCloud will see this
The scan runs only on
main/develop(CircleCIscan,filters: *integration-branches), so there is no Sonar analysis on this PR; develop's first branch-mode run after this and #1329 land is the proof that bothnew_reliability_ratingandnew_security_ratingreturn to A.How it was verified
byCodeUnit orders strings by code unit, unlike a locale-aware comparisonadded tosrc/webview/layout.test.ts: pins the code-unit order (Transitionbeforebinding) and that it differs fromlocaleCompare.editors/vscode:npm run typecheck(three tsconfigs) ok;npm test373 pass / 0 fail;npm run buildok.python3 scripts/changelog.py checkok.Checklist
make testandmake lintpass locally — the extension's own lint/typecheck/test/build; no Go changechanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build) — none movedF4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/2ce4197c3a6c4c13982380aaf8d6f857
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/2ce4197c3a6c4c13982380aaf8d6f857?variant=devin
Requested by: @HuiJun