Skip to content

fix: resolve the SonarCloud findings from the latest develop scan - #484

Open
devin-ai-integration[bot] wants to merge 7 commits into
developfrom
fix/sonarcloud-develop-round3
Open

devin-ai-integration[bot] wants to merge 7 commits into
developfrom
fix/sonarcloud-develop-round3

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

What and why

The latest SonarCloud analysis of develop fails its quality gate on new-code reliability and security, and reports 149 open findings. This resolves them, gate-breakers first and cognitive complexity last.

Gate breakers

  • ProjectTextExporter.containsDocument compared Optional<String> with a String, so it was always false and two SysON resources with the same file name were exported under one name. Now name().filter(name::equals).isPresent(); a test pins the foo.sysml / foo-1.sysml outcome.
  • Java client: Condition.equal(...) is renamed Condition.equalTo(...) (it shadowed Object.equals in every reader's eye). Callers, docs and a changelog fragment updated.
  • The two SysON frontend workflow installs run npm ci --ignore-scripts (as the VS Code job already did), and install:syson passes --ignore-scripts too; the build needs no lifecycle scripts.

Other findings

  • RunResult gets a Builder in place of its 14- and 13-argument constructors.
  • Nested ternaries, deep nesting, unused props and duplicated literals across the SysON backend/frontend, the Java client, the migrate package, docpdf and the toolchain script are replaced with named constants and small helpers; diagnostic text is unchanged.
  • RunVerdictSummaryTest moves to the directory of its package; FakeElement.getName delegates to getDeclaredName; unused imports, an unnecessary throws, blank-import comments, and print/any shadowing are cleaned up.
  • The 17 Go and 1 Java functions flagged for cognitive complexity are split into cohesive helpers with no behaviour change; none is above Sonar's threshold now.
  • .gitignore covers editors/syson/**/target/.

Intentionally left (recorded so the next scan is not a surprise): java:S1452 in syson-api-stubs mirrors the real Sirius signature and no IRepresentationEventProcessor stub exists; java:S6539 on Model is informational; java:S1165 on EditException.referrers cannot be final because readObject assigns it.

How it was verified

  • go build ./..., go vet ./..., gofmt -l ., make lint, and go test ./... with all four OPENSYSML_REQUIRE_* corpus variables set.
  • gocognit -over 15 over cmd/sysml and internal/translate/migrate: none of the flagged functions remain.
  • client/java: mvn install; editors/syson/backend: mvn test (27 tests, including the new duplicate-name test).
  • editors/syson/frontend: npm ci --ignore-scripts && npm run typecheck && npm run format:check && npm test && npm run build.
  • python3 scripts/changelog.py check; bash -n on the toolchain script.
  • The fUML driver under scripts/fuml-driver was syntax-checked with javac only; its Maven dependencies could not be downloaded here.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

devin-ai-integration Bot and others added 5 commits September 21, 2026 02:02
- syson: compare exported document names by value so duplicates get -1 suffixes\n- java client: rename Condition.equal to Condition.equalTo\n- workflows: npm ci --ignore-scripts for the SysON jobs

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Builder for RunResult, verdict-label helper, hoisted asserts, duplicated-literal constants, interface/empty-func/import fixes, CSS rule merge, frontend prop narrowing and handler hoists

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Structural extraction only: flagged functions decomposed into named helpers; export split into documentName/exportResource.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Edit.java uses a private requireTarget over a public constant; input collection returns on first error; outcome keys disambiguate repeats; Maven target dirs ignored

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun marked this pull request as ready for review September 21, 2026 05:45
devin-ai-integration[bot]

This comment was marked as resolved.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant