fix: resolve 3 SonarQube issues in naming and collection checks#49
Open
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Open
fix: resolve 3 SonarQube issues in naming and collection checks#49sonarqube-agent[bot] wants to merge 1 commit intomainfrom
sonarqube-agent[bot] wants to merge 1 commit intomainfrom
Conversation
Fixed issues: - AZZjJ27ISTHyJcTACtx2 for java:S1155 rule - AZZjJ2_gSTHyJcTACtyl for java:S100 rule - AZZjJ2_gSTHyJcTACtym for java:S100 rule Generated by SonarQube Agent (task: c91726b4-fa52-4ef5-9e26-a7365404cb88)
Author
|
|
|
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.



Renamed method calls to follow camelCase naming conventions (getZipExtension and getTxtExtension) and replaced size() check with isEmpty() for better clarity and performance. These changes improve code quality by adhering to Java naming standards and using collection API best practices.
View Project in SonarCloud
Fixed Issues
java:S100 - Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. • MINOR • View issue
Location:
src/main/java/fr/ans/psc/pscextract/controller/ExtractionController.java:233Why is this an issue?
Shared naming conventions allow teams to collaborate efficiently.
What changed
This hunk renames the call from
getZIP_EXTENSION()togetZipExtension(), which is part of fixing the method naming convention violation wheregetZIP_EXTENSION()does not match the required pattern^[a-z][a-zA-Z0-9]*$. By updating all call sites to use the new compliant namegetZipExtension(), the old non-compliant method can be renamed or removed.java:S100 - Rename this method name to match the regular expression '^[a-z][a-zA-Z0-9]*$'. • MINOR • View issue
Location:
src/main/java/fr/ans/psc/pscextract/controller/ExtractionController.java:237Why is this an issue?
Shared naming conventions allow teams to collaborate efficiently.
What changed
This hunk updates the call from
getTXT_EXTENSION()togetTxtExtension(), fixing the method naming convention violation wheregetTXT_EXTENSION()does not match the required pattern^[a-z][a-zA-Z0-9]*$. By renaming the call site to use the compliant camelCase namegetTxtExtension(), the old non-compliant method can be renamed accordingly.java:S1155 - Use isEmpty() to check whether the collection is empty or not. • MINOR • View issue
Location:
src/main/java/fr/ans/psc/pscextract/service/utils/FileNamesUtil.java:66Why is this an issue?
When you call
isEmpty(), it clearly communicates the code’s intention, which is to check if the collection is empty. Usingsize() == 0for this purpose is less direct and makes the code slightly more complex.What changed
Replaces
listOfFiles.size() > 0with!listOfFiles.isEmpty(), which is the recommended way to check whether a collection is empty. UsingisEmpty()is clearer in intent, and is guaranteed to be an O(1) operation, whereassize()may be O(n) depending on the collection implementation.SonarQube Remediation Agent uses AI. Check for mistakes.