Skip to content

[Misc] Fix various mechanical SonarQube issues in the rendering modules - #396

Merged
vmassol merged 1 commit into
masterfrom
claude/peaceful-archimedes-f9ddtn
Aug 1, 2026
Merged

[Misc] Fix various mechanical SonarQube issues in the rendering modules#396
vmassol merged 1 commit into
masterfrom
claude/peaceful-archimedes-f9ddtn

Conversation

@claude

@claude claude Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Jira URL

None — this is a [Misc] SonarQube cleanup commit.

Changes

Description

Mechanical SonarCloud cleanup. 9 open issues resolved, no behaviour change:

Rule Count Change
java:S2209 4 Access the static PARAMETERS_PRINTER statically instead of through this
java:S3012 2 Replace a manual copy loop with Arrays.asList(...).subList(...) / Collections.addAll
java:S3024 2 Chain StringBuilder.append instead of concatenating inside append
java:S1264 1 for (; cond; )while (cond)

Clarifications

  • S2209: PARAMETERS_PRINTER is a protected static final field of the xwiki/2.0
    XWikiSyntaxResourceRenderer; the xwiki/2.1 subclass was reading it through this..
  • Sites deliberately not changed (left open in SonarCloud):
    • All 13 java:S6126 (text block) issues. Every one of them is a parser test string with either
      meaningful trailing whitespace on a content line (text blocks strip it unconditionally),
      \r\n line terminators (a text block cannot produce \r), or a leading-indentation profile
      whose minimum indent cannot be reproduced without \s escapes. Converting any of them would
      change the expected string.
    • The two java:S6035 issues ("^(?:d|F)ownload:.*""^[dF]ownload:.*"). These are
      public static final String compile-time constants, so changing their value is a Revapi
      java.field.constantValueChanged break even though the regex is equivalent.
    • java:S3824 in AbstractXHTMLImageTypeRenderer — the guarded block does more than a single
      put, so computeIfAbsent is not an equivalent rewrite.

Screenshots & Video

N/A — no UI change.

Executed Tests

mvn install -Plegacy,quality -pl \
  xwiki-rendering-api,\
  xwiki-rendering-wikimodel,\
  xwiki-rendering-syntaxes/xwiki-rendering-syntax-xwiki21

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches: None — cleanup only, no need to backport.

Related

Part of the same SonarCloud sweep as the sibling PRs in xwiki-commons and xwiki-platform.


Generated by Claude Code

* 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>
@claude claude Bot added the llm-agent label Aug 1, 2026
@claude claude Bot assigned vmassol Aug 1, 2026
@claude claude Bot locked as resolved and limited conversation to collaborators Aug 1, 2026
@vmassol
vmassol merged commit d319185 into master Aug 1, 2026
3 checks passed
@vmassol
vmassol deleted the claude/peaceful-archimedes-f9ddtn branch August 1, 2026 08:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant