Repository navigation
refactor(view): clear the Sonar findings in the draw.io writer and reader - #1707
Merged
Merged
Conversation
…ader The draw.io writer owns its cell indentation through openCell/closeCell, openObject/closeObject and openGeometry/closeGeometry instead of repeating the indentation literals; the page scanner and model reader of the import are a struct each with one method per token kind and per element, so no function passes the cognitive-complexity threshold; the matcher indexes the baseline in a helper of its own; identifiers that shadowed the predeclared any and real are renamed. The emitted bytes and every golden are unchanged. 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
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
SonarCloud flagged the draw.io export/import code that landed this week (#1668, #1679, #1695) on
develophead0c1fd6dbd. This clears every finding ininternal/ir/view/drawio.go,drawio_import.go,drawio_import_diff.goandcmd/sysml/import_diagram_test.goby refactoring only: no emitted byte, parsed value or diagnostic changes, and no test or golden moved. The sibling files (drawio_route.go,route/,form.go,tree.go) are untouched.drawioCellIndent/drawioCellBodyIndent/drawioWrappedBodyIndentand theopenCell/closeCell,openObject/closeObject,openGeometry/closeGeometryhelpers; the plain, wrapped, port and edge paths call them instead of repeating the literals.any→found(gopls rename).if d := cx - box.X; d < best→if cx-box.X < best(checked by eye; the snippet analyzer does not rungodre:*).drawioPageskeeps the decoder loop; the per-token state machine isdrawioPageScannerwithtoken/start/end/chars/encode.readDrawioModelkeeps the decoder loop;drawioModelReaderhasstart/endper token kind andopenCell/geometry/rectangle/pointper element.drawioMalformedXML(err), for the five"malformed XML"errors.real→realPath.drawioMatcher.matchindexes the baseline throughbaselineIndex.real→realPath.No dispositions; everything is fixed in code. No changelog fragment: refactor only.
How it was verified
Pull requests get no Sonar analysis; the proof that the findings are gone is the post-merge branch analysis of
develop. Pre-verified locally with the project's own quality profile (analyze_code_snippet, language go) on eachdevelopfile as a control and on this branch's file:The draw.io goldens and
TestDrawioRoundTrippass unchanged (run without-racelocally; CI runs the race suite):Gate:
Checklist
make testandmake lintpass locally (go build,go vet,gofmt -l,go testabove)make docs-countsrun if a gate count moved — no count movedF4,K5) in the body, docs, or changelog