Most of our project written in java uses EMF (Eclipse Modeling Framework) to generate java code. Generated classes and method are tagged with ‘@generated’ and must be ignored. Here are the sample snapshot of generated method:
/*
* This is a sample java function
*
* @generated
*/
public void myFunction(){
...
}
We only want to skip classes or method with ‘@generated’ tag and not the whole file since the file has modified methods that are tagged as ‘@generated NOT’ and must be included in sonar analysis. We are aware of using ignore blocks to ignore parts of a file, but it seems that it will not be a suitable solution since it would require to update thousand of java file.
We are using the following in our environment:
- SonarQube Scanner 3.0.3.778
- Java 1.8.0_241 Oracle Corporation (64-bit)
- SonarQube server 7.9.1
Please advice if there are other way to ignore blocks of code or if it this scenario is possible in sonarqube. Thanks!