This is a walkmod plugin to automatically fix sonar rule violations. Currently, the supported rules are:
- sonar:AddCurlyBrackets - sonar:AddSwitchDefaultCase - sonar:ArrayDesignatorOnType - sonar:CollapsibleIfStatements - sonar:DeclarationsShouldUseCollectionInterfaces - sonar:LocalVarsShouldComplyWithNamingConvention - sonar:PrimitiveInstantiationForToString - sonar:RedundantCastsShouldNotBeUsed - sonar:RemoveCodeComment - sonar:RemoveEmptyMethod - sonar:RemoveEmptyStatement - sonar:RemoveLiteralBoolean - sonar:RemoveUnusedMethodParameters - sonar:RemoveUselessImports - sonar:RemoveUselessParentheses - sonar:RemoveUselessVariables - sonar:StaticInitializedFieldToFinal - sonar:StringCheckOnLeft - sonar:UseCollectionIsEmpty - sonar:UseStringEquals - sonar:VariableImmediatelyReturned
1) Verify that your walkmod version is > = 2.3.2 and your project is Maven or Gradle.
2) Execute the following command to add this code transformation plugin as part of your conventions.
walkmod add sonar:CollapsibleIfStatements
3) Now, You see the results, executing:
walkmod apply
Or, alternatively, you can also check which would be the modified classes typing:
walkmod check