0

my project generates at runtime source code from thrift file. Is there a way to avoid Sonarqube analyzes this source code automatically generated? This because I have some code smell and bug detected by Sonarqube in that generated code I can't modify and correct.

C.S.
  • 77
  • 2
  • 9
  • 1
    "*This because I have some code smell and bug detected by Sonarqube in that generated code I can't modify and correct.*" -- Actually you can, in a way. If you think the code smells found are legit, why not [file a ticket](https://issues.apache.org/jira/projects/THRIFT) so the Thrift compiler can be improved by someone? And if you really want, you could even implement the patch yourself and [send us a pull request](https://thrift.apache.org/docs/HowToContribute.html). How cool is that? It's called Open Source ;-) – JensG Nov 10 '20 at 16:40

1 Answers1

0

Yes. Excluding the source files or any other files from sonar analysis is possible, by using sonar.exclusions property in your sonar.properties

For example, if your source file generated is xyz.java in some folder say target, so you can exclude the file, like this

sonar.exclusions=**/target/*.java

or you can give the file name directly

sonar.exclusions=**/target/xyz.java

You can find more details here: https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/

Sourav
  • 3,025
  • 2
  • 13
  • 29