[Misc] Fix various mechanical SonarQube issues in the rendering modules - #396
Merged
Conversation
* Access static members statically instead of through an instance (java:S2209) * Replace manual copy loops with Arrays/Collections helpers (java:S3012) * Chain StringBuilder.append instead of concatenating inside append (java:S3024) * Replace a for loop with no initializer nor update by a while loop (java:S1264) Co-Authored-By: Vincent Massol <vincent@massol.net>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Jira URL
None — this is a
[Misc]SonarQube cleanup commit.Changes
Description
Mechanical SonarCloud cleanup. 9 open issues resolved, no behaviour change:
java:S2209staticPARAMETERS_PRINTERstatically instead of throughthisjava:S3012Arrays.asList(...).subList(...)/Collections.addAlljava:S3024StringBuilder.appendinstead of concatenating insideappendjava:S1264for (; cond; )→while (cond)Clarifications
S2209:PARAMETERS_PRINTERis aprotected static finalfield of the xwiki/2.0XWikiSyntaxResourceRenderer; the xwiki/2.1 subclass was reading it throughthis..java:S6126(text block) issues. Every one of them is a parser test string with eithermeaningful trailing whitespace on a content line (text blocks strip it unconditionally),
\r\nline terminators (a text block cannot produce\r), or a leading-indentation profilewhose minimum indent cannot be reproduced without
\sescapes. Converting any of them wouldchange the expected string.
java:S6035issues ("^(?:d|F)ownload:.*"→"^[dF]ownload:.*"). These arepublic static final Stringcompile-time constants, so changing their value is a Revapijava.field.constantValueChangedbreak even though the regex is equivalent.java:S3824inAbstractXHTMLImageTypeRenderer— the guarded block does more than a singleput, socomputeIfAbsentis not an equivalent rewrite.Screenshots & Video
N/A — no UI change.
Executed Tests
Expected merging strategy
Related
Part of the same SonarCloud sweep as the sibling PRs in
xwiki-commonsandxwiki-platform.Generated by Claude Code