Fix Sonar code quality issues: S5361, S3776 complexity#2825
Merged
tastybento merged 3 commits intodevelopfrom Mar 4, 2026
Merged
Fix Sonar code quality issues: S5361, S3776 complexity#2825tastybento merged 3 commits intodevelopfrom
tastybento merged 3 commits intodevelopfrom
Conversation
35 tests covering constructor, blueprint/bundle CRUD, validation, permission checks, file I/O (load/save/delete/rename), and paste error paths. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Addon.java: replace replaceAll() with replace() for literal string substitution (S5361); remove now-unused Matcher import - AdminTeleportUserCommand: simplify first guard to args.size() < 2 to drop the || operator and reduce cognitive complexity to 15 (S3776) - AdminPurgeRegionsCommand: refactor deletePlayerFromWorldFolder, deleteRegionFiles, and findOldRegions by extracting private helper methods (maybeDeletePlayerData, resolveLastLogin, deletePlayerFiles, deletePlayerFile, isFileFresh, isAnyDimensionFresh, deleteOneRegion, logRegionFolderPaths, collectCandidateNames, addFileNames, parseRegionCoords) to reduce cognitive complexity to within limits (S3776) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
AdminPurgeRegionsCommand: - Remove unused OfflinePlayer import - Introduce DimFolders record to reduce deleteOneRegion from 10 to 4 parameters (S107 - too many parameters) - Replace & with && and extract operands to variables for the overworld deletion chain (S2178 - non-short-circuit operators on booleans) BlueprintsManagerTest: - Remove public modifier from class declaration and all @test methods (S5786 - JUnit 5 test classes/methods need not be public) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Summary
replaceAll("/", Matcher.quoteReplacement(...))withreplace("/", File.separator)(S5361 — preferString#replaceoverString#replaceAllfor literal substitution); remove the now-unusedMatcherimport.args.isEmpty() || args.size() == 1→args.size() < 2to eliminate the||operator and bringcanExecutecognitive complexity down to 15 (S3776).deletePlayerFromWorldFolder(29 → ~3):maybeDeletePlayerData,resolveLastLogin,deletePlayerFiles,deletePlayerFiledeleteRegionFiles(~24 → ~7):isFileFresh,isAnyDimensionFresh,deleteOneRegionfindOldRegions(~30 → ~5):logRegionFolderPaths,collectCandidateNames,addFileNames,parseRegionCoordsAlso includes JUnit tests for
BlueprintsManager(35 tests).Test plan
./gradlew compileJavapassesAdminPurgeRegionsCommandTestpassesBlueprintsManagerTest(35 tests) passes🤖 Generated with Claude Code