Reporting Code Smells - QualInsight/qualinsight-plugins-sonarqube-smell GitHub Wiki
The @Smell
annotation can be placed on Java packages, types, methods, constructors, fields, parameters, local variables in order to report a single smell.
For instance :
@Smell(minutes=10,reason="This class should be redesigned in order to ...", type=SmellType.BAD_DESIGN)
public class MyClass {
...
}
It takes three mandatory parameters :
Parameter | Type | Mandatory | Example |
---|---|---|---|
minutes | int | yes | 10 |
reason | String | yes | This class should be redesigned in order to... |
type | SmellType | yes | SmellType.BAD_DESIGN |
Multiple Smells can be declared using the @Smells
annotation as follows:
@Smells({
@Smell(minutes=20,reason="This class should be redesigned in order to ...", type=SmellType.BAD_DESIGN),
@Smell(minutes=5,reason="This class should be renamed in order to highlight its responsibility", type=SmellType.UNCOMMUNICATIVE_NAME)
})
public class MyClass {
...
}
For more information, please check the API's Javadoc.