Skip to content

[Misc] Fix SonarQube issues java:S1066 and java:S5778 - #403

Open
claude[bot] wants to merge 1 commit into
masterfrom
claude/peaceful-archimedes-20sved
Open

[Misc] Fix SonarQube issues java:S1066 and java:S5778#403
claude[bot] wants to merge 1 commit into
masterfrom
claude/peaceful-archimedes-20sved

Conversation

@claude

@claude claude Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Jira URL

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

Changes

Description

Fixes the two remaining mechanical SonarCloud issues in this repository.

Rule Fixed What was done
java:S1066 1 merged the nested if (this.content == null) into its enclosing if (isContentChecked()) in AbstractBoxMacro, keeping both explanatory comments above the merged condition
java:S5778 1 extracted new WordBlock("not existing") out of the assertThrows lambda in BlockTest so only replaceChild() can throw inside it

Open issues for these rules on SonarCloud

Clarifications

  • The java:S1066 change is behaviour-preserving: the inner if was the only statement in the
    outer one and there is no else on either, so A && B is exactly the original control flow.
  • The rest of the repository's open issues were reviewed and deliberately not touched, because
    they are refactors or API changes rather than cleanups: java:S127 (13, loop-counter
    reassignment), java:S3252 (34, static-access qualifier — renaming the qualifier loses which
    parser's escape char is meant), java:S5961 (assertion counts), java:S6035 (2 — the flagged
    regexes are public static final String constants, so changing their value is a Revapi
    constantValueChanged break), java:S3415 (2 — one of the two files already carries a
    @SuppressWarnings("java:S5785") comment explicitly warning that swapping those arguments would
    stop testing the equals() contract), and the single src/main java:S1130.

Screenshots & Video

N/A

Executed Tests

mvn install -Plegacy,quality -fae -pl xwiki-rendering-api,xwiki-rendering-macros/xwiki-rendering-macro-box

BUILD SUCCESS440 tests run, 0 failures, 0 errors, 0 skipped.

Expected merging strategy

Squash and merge into master. No backport needed.

Related

Part of one SonarQube sweep across the three repositories:


Generated by Claude Code

* Merged a nested `if` with its enclosing one
* Extracted the extra invocation out of an `assertThrows` lambda

Co-Authored-By: Vincent Massol <vincent@massol.net>
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