[Misc] Fix various mechanical SonarQube issues in the rendering modules - #392
Merged
Conversation
* java:S6397: drop redundant single-character regex character classes * java:S6485: use the HashMap/LinkedHashMap.newXxx() factory methods * java:S6208: merge fall-through case labels into comma-separated labels * java:S6204: use Stream.toList() instead of collect(Collectors.toList()) * java:S2864: iterate entrySet() instead of keySet() + get() * java:S1161: add a missing @OverRide annotation * java:S1481/java:S1068: remove an unused local variable and an unused private field * java:S1126: replace an if-then-else returning booleans with a single return 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.
Mechanical SonarCloud cleanup across
xwiki-rendering-api,xwiki-rendering-wikimodel,xwiki-rendering-transformation-linkchecker— 22 issues, no behaviour change:XWikiSerializer2("[IJ]"→"IJ","[\\.]"→"\\.").LinkedHashMap.newLinkedHashMap(n)instead of the constructor taking aninitial capacity.
caselabels into comma-separated labels.Stream.toList()instead ofcollect(Collectors.toList()). Both sites aresafe:
ListenerRegistryalready returns an unmodifiableList.of()on its other branch, and theXhtmlHandlerlist is copied by theWikiParameters(Collection)constructor.entrySet()instead ofkeySet()+get().@Override.Verified with
mvn install -Plegacy,qualityonxwiki-rendering-api,xwiki-rendering-wikimodel,xwiki-rendering-transformation-linkcheckerandxwiki-rendering-syntax-xhtml(the module whosetests exercise the wikimodel XHTML parser changes) — all green.
Related (same sweep, one PR per repo):
Generated by Claude Code