Stop writing every label's wording twice - #189
Merged
Merged
Conversation
The mechanical pass left each string in two places - once in the constructor and once in the registration - so the long hint sentences appeared twice in the file, and flattening the multi-line ones onto a single line read like a missing comma. Sonar flagged 45 of those, and it was right on both counts. bind() now sets the text as well as recording the key, so the widget is built empty and the wording is written once, in its original multi-line shape.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | -12 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Building the widget and registering it were two lines of identical shape
repeated 236 times, and Sonar's duplication check called it at 7.3 percent
against a 3 percent gate - fairly, since that is what boilerplate is.
tr() sets the text, registers the key and hands the widget back, so it reads as
one assignment:
self.hint_label = tr(QLabel(), "signage_hint", "Presets are saved from ...")
The longer sentences keep their line breaks rather than being flattened into a
single over-long implicit concatenation.
|
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.



Cleanup of the mechanical conversion in #188. Sonar raised 45 findings on it and both kinds were fair.
What was wrong
The generated shape put each string in two places:
"a " "b" "c", which reads like a missing comma.The fix
bind()now sets the text as well as recording the key — it already computed the string, it just wasn't applying it. So the widget is built empty and the wording is written once, keeping its original multi-line shape:236 widgets converted, 7 now-unused imports removed, and the flattened one-liners are gone (0 remain).
Verified
Switching still works exactly as before: all seven languages in sequence and back to English, 0 strings left in the previous language each time, whiteboard still open, page state byte-identical.
858 passed, pyflakes silent.
Note on sequencing
I merged #188 while these 45 were outstanding — the quality gate passed, so the checks were green, but green gate is not the same as no findings, and I should have read them first. Doing that here instead.