[Misc] Fix various mechanical SonarQube issues in the rendering modules - #393
Merged
Conversation
* java:S5361: use replace() instead of replaceAll() for plain literal patterns (8) * java:S1066: merge collapsible nested if statements (1) Co-authored-by: Vincent Massol <vincent@massol.net>
This was referenced Jul 31, 2026
Merged
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
Fixes 9 open SonarCloud issues in
xwiki-rendering, all purely mechanical andbehaviour-preserving.
java:S5361replaceAll()→replace()where the pattern is a plain literal (the accent-transliteration table inXWikiSerializer2)java:S1066ifinParserUtilsOpen issues for this project on SonarCloud
Clarifications
"\uXXXX"patterns, andreplaceAll("\\.", "")which becomesreplace(".", "")— the escapedregex dot is the literal dot. None of the replacement strings contain
$or\, which are theonly characters whose meaning differs between
replaceAllandreplace. The remainingreplaceAllcalls in that method use real character classes and were left alone.ParserUtilsmerge foldsif (block instanceof MacroBlock macro) { if (!macro.isInline()) }into a single condition; the inner
ifwas the sole statement of the outer one and there is noelse.Screenshots & Video
No UI change.
Executed Tests
mvn install -Plegacy,qualityofxwiki-rendering-apiandxwiki-rendering-wikimodel—BUILD SUCCESS, 562 tests, 0 failures, 0 errors.
Expected merging strategy
Related
Part of the same SonarQube sweep:
Generated by Claude Code