Is there any way to disable certain metrics from selected packages in Sonar? I use Sonar to analyze my project and in Entity and DTO packages I have some code that is equal - the same field ID with annotations, etc is being reported as a duplication by Sonar. It has absolutely no sense to me so I'd like to disable it. How can I achieve this? Using the global exclusions option disables all metrics on selected package but how to do it just for code duplications?
With a newer SonarQube installation, you can use sonar.cpd.exclusions
to exclude certain files only from duplicate checks.
See: https://docs.sonarqube.org/display/SONAR/Analysis+Parameters
Example:
sonar.cpd.exclusions=**/AssemblyInfo.cs,**/*.g.cs,**/Mappings/*.cs