walkmod-sonar-plugin

Walkmod plugin to automatically fix Sonar rule violations

License

License

GroupId

GroupId

org.walkmod
ArtifactId

ArtifactId

walkmod-sonar-plugin
Last Version

Last Version

1.2.3
Release Date

Release Date

Type

Type

jar
Description

Description

walkmod-sonar-plugin
Walkmod plugin to automatically fix Sonar rule violations
Project URL

Project URL

https://github.com/walkmod/walkmod-sonar-plugin
Source Code Management

Source Code Management

https://github.com/walkmod/walkmod-sonar-plugin

Download walkmod-sonar-plugin

How to add to project

<!-- https://jarcasting.com/artifacts/org.walkmod/walkmod-sonar-plugin/ -->
<dependency>
    <groupId>org.walkmod</groupId>
    <artifactId>walkmod-sonar-plugin</artifactId>
    <version>1.2.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.walkmod/walkmod-sonar-plugin/
implementation 'org.walkmod:walkmod-sonar-plugin:1.2.3'
// https://jarcasting.com/artifacts/org.walkmod/walkmod-sonar-plugin/
implementation ("org.walkmod:walkmod-sonar-plugin:1.2.3")
'org.walkmod:walkmod-sonar-plugin:jar:1.2.3'
<dependency org="org.walkmod" name="walkmod-sonar-plugin" rev="1.2.3">
  <artifact name="walkmod-sonar-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.walkmod', module='walkmod-sonar-plugin', version='1.2.3')
)
libraryDependencies += "org.walkmod" % "walkmod-sonar-plugin" % "1.2.3"
[org.walkmod/walkmod-sonar-plugin "1.2.3"]

Dependencies

compile (4)

Group / Artifact Type Version
org.walkmod : javalang-compiler jar [2.2, 3.0)
org.walkmod : walkmod-core jar [2.0.0,4.0.0)
org.walkmod : walkmod-refactor-plugin jar [2.3.3,3.0.0)
com.mashape.unirest : unirest-java jar 1.4.9

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.walkmod : walkmod-cfg jar 2.0

Project Modules

There are no modules declared in this project.

walkmod-sonar-plugin

Build Status

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

Usage

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

Contributing

If you want to hack on this, fork it, improve it and send me a pull request.

To get started using it, just clone it and call mvn install.

org.walkmod

walkmod

Versions

Version
1.2.3
1.2.2
1.2.1
1.2.0
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.0