Is there any way to purposefully increase Code Coverage value in SonarQube by excluding some classes.
Is there any way to purposefully increase Code Coverage value in SonarQube by excluding some classes.
Try to use sonar.coverage.exclusions.
As sonar.coverage.exclusions is Comma-delimited list of file path patterns to be excluded from coverage calculations. Your pattern should be like this:
sonar.coverage.exclusions=com/abc/demo/presentation/beans/**/*, com/abc/demo/presentation/interfaces/**/*, com/abc/demo/presentation/validator/**/*, com/abc/utility/**/*
Note: Documentation for this option was removed in 7.3 (Google: site:docs.sonarqube.org "sonar.coverage.exclusions"). But you can still see them when you open the administration pages for the project on Sonar -> "General Settings" -> "Analysis Scope". Look for the values after "Key:"
You can exclude certain files in sonar-project.properties file:
sonar.exclusions=**/*.js,**/*.json,**/*.xml,**/*.png,**/*.sh,**/*.h,**/*.m,**/*.c,**/*.cpp,**/*.pdf,**/*.plist,Pods/**/*
sonar.swift.excludedPathsFromCoverage=.*Tests.*
Also, you can include specific files using:
sonar.test.inclusions=**/*Test*/**
sonar.test.inclusions=*.swift