Exclude Generated Files From Sonar Analysis
January 26, 2015
I use SonarQube to scan my projects and check for issues. One of the things you don’t want is it reporting on issues in files you didn’t create. For example I don’t think there’s much point in reporting issues in JAXB generated content.
In Sonar you can exclude these from the scan as follows
1. Log in as administrator
The default password is admin/admin
2. Click on settings
3. Go to Exclusions
4. Go to the issues part of exclusions
5. Add in the regex that identifies the files you want to skip. For the case of JAXB it’s
.*file was generated by the JavaTM Architecture for XML Binding\(JAXB\).*
You can add as many pattern’s as you like
Written by David Kerwick who lives and works Dublin as a Java Technical Lead.