1

We are using SonarQube 5.6 for a code base with a lot of legacy code.

We defined a quality gate which checks that new code should be covered by at least 75%. Unfortunately there are classes which are not testable at all and minor code changes (e.g. logging) shouldn't fail the quality gate.

So the idea was to "tag" those classes with an annotation to exclude them for the quality gate analysis.

I have had a look at the extension guide but I'm still uncertain where to start. What options do I have and which would be the best way to go?

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
Tobi
  • 47
  • 6

1 Answers1

1

These files should be excluded from coverage measures by using the property "Analysis Scope > Coverage Exclusions". See http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-IgnoreCodeCoverage.

Simon Brandhof
  • 5,137
  • 1
  • 21
  • 28
  • But this would remove those files completely from code coverage, right? Is there a way to exclude them just for the quality gate? Probably not, as the quality gates only reuse existing measures (as far as I get it). So I guess I need to create a new/custom measure... – Tobi Nov 16 '16 at 08:39
  • Exact, Quality gate is based on measures. – Simon Brandhof Nov 16 '16 at 15:29