refactor: resolve SonarCloud findings on develop - #377
Merged
Merged
Conversation
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
HuiJun
marked this pull request as ready for review
September 18, 2026 01:11
devin-ai-integration
Bot
force-pushed
the
fix/sonarcloud-develop-findings
branch
8 times, most recently
from
September 19, 2026 04:01
7c08602 to
881c3e2
Compare
Address the SonarCloud issues reported against develop without changing behavior: duplicated string literals become named constants, shadowed builtins are renamed, unused parameters and useless assignments are dropped, and shell, Python and TypeScript findings are fixed in kind. Methods over the cognitive-complexity threshold are split into focused helpers: action-graph edge lowering (actionEdgeLowerer), state-graph region collection and initial validation, fork footprints, reachable-set traversal (reachSet), carried verdict collection, query value conformance, diagram action edges, LSP debug node location, and the fUML driver's activity runner and structured-value serialisation. The fUML driver source moves under scripts/fuml-driver/io/opensysml/fuml/ to match its package; the committed expected record is byte-identical. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration
Bot
force-pushed
the
fix/sonarcloud-develop-findings
branch
from
September 19, 2026 04:17
881c3e2 to
0cca971
Compare
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
… python client Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.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.
What and why
Resolves the SonarCloud findings reported against
develop, in kind and without changing behavior. Quality-gate breakers first (the nightly workflow's shell quoting, a non-volatileshared field in the fUML driver), then the plain findings across Go, shell, Python, Java, GitHub Actions and the VS Code extension, and last the cognitive-complexity findings. The branch carries currentdevelop, so the finding set it addresses is the one reported on the latestdevelopscan.Plain findings, by rule family:
internal/translate/migrate,internal/exec/runtime,internal/frontend/grpc,internal/doc/docrender,tools/gen/snapshot,tools/referee/exec,tools/referee/fuml, scripts, and the earlierinternal/fuml,internal/pssm,internal/stressmodel,internal/erratasites).copy,real,min,any,go_, ...) are renamed.!= nilguards and index-then-compare patterns are dropped (strings.ContainsAny,.at(-1), optional chaining,classListover the deprecatedclassName,Quantity | int | floatoverUnion[...]).kit.Unioninterface is renamedkit.Regathererafter its method; intentionally empty functions say why they are empty.tools/oracle/repo.DevelopCommitresolvesgitwithexec.LookPathbefore running it; the nightly VS Code packaging step runsnpm ci --ignore-scripts; the shell fixtures copy"$@"into a local array before iterating.queryexec.Error.Error()splits its message switch intocolumnMessage/sessionMessageso no switch exceeds the case limit.One finding is deliberately left:
typescript:S7747oneditors/vscode/src/diagram.ts(for (const old of Array.from(this.panels.values()))). The loop body disposes and re-creates panels inthis.panels, so iterating the liveMapiterator would visit the entries it inserts; the array snapshot is load-bearing and the comment above it says so.Cognitive-complexity findings (threshold 30) are addressed by extracting focused helpers, keeping every loop and error path in place:
lower.ToActionGraphWith(73)collectActionNodes+actionEdgeLowerer{member, initial, successionEdge, controlFlowEdge, transition, objectFlowEdge, usage, successionUsage}lower.ToStateGraphWithEndpoints(33)StateGraph.collectRegions,StateGraph.recordRegionInitials,StateGraph.noInitialStatelower.(*stateFootprintBuilder).pseudostatefork case (32)stateFootprintBuilder.forkruntime.(*StateExecutor).reachable(40)reachSet{add, stop, visit, settled}runtime.(*Context).carriedVerdicts(31)carriedVerdictsOfper typequeryexec.(*executor).valueConforms(34)quantityConforms,scalarConforms,declaredByConformsqueryexec.(*executor).evaluateColumnExpression(45)rowPropertyValues,objectRowValues,carrierRowValues→verdictRowValues/stateRowValues/eventRowValuesview.(*Renderer).actionNode(35)actionEdges,successionLabellsp.(*debugSession).locate(34)locateStates,locateActions,nestmigrate.(*migration).visibleFromvisibility{members, imported}migrate.(*migration).association(37)associationEndmigrate.(*migration).feature(56)featureVisibility,featureModifiers,portPayload,featureTyping,featureRedefinitions,featureShadow,featureDefault,portPayloadLinemigrate.(*stateRegion).transition(32)triggerAccept,writeTransitionEffectmigrate.(*activity).objectFlow(31)objectFlowTarget,objectFlowSourcepasses.VariableFeaturePass.Run(43)variableFeatureCheck{symbol, crossFeature, usage}FumlExpected.main/structuredValue(Java, 36 / 33)ActivityRunner.runwith anOutcomeenum;structuredKindThe fUML driver source moves from
scripts/fuml-driver/FumlExpected.javatoscripts/fuml-driver/io/opensysml/fuml/FumlExpected.javaso the path matches theio.opensysml.fumlpackage it declares;scripts/fuml-expected.shanddocs/project/fuml-referee.mdfollow.How it was verified
go build ./...,go vet ./...,gofmt -l .(empty),make lint(staticcheck + gosec) andgo test ./...withOPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1pass on the branch merged with currentdevelop.gocognit -over 30reports none of the functions SonarCloud flagged.FUML_EXPECTED_OUT=... ./scripts/fuml-expected.shregenerates the referee record from the relocated driver: 55 activities, 51 executed, byte-identical todocs/project/fuml-referee-expected.json.client/python:pytest tests/test_document.pypasses against a locally builtsysml-grpc.editors/vscode:npm run typecheckandnpm testpass.python3 scripts/changelog.py checkandpython3 scripts/check-doc-ids.pypass.Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (no count moved)F4,K5) in the body, docs, or changelog