Hi we are using sonarqube + C# for projects. When I pushed the new PR, the sonarqube asks me to add unit tests to cover the new lines, however, those lines are for swagger examples which we do not necessarily need a test for them. Thus, I added the //NOSONAR to ignore sonarqube for those lines but the sonarqube check still fails, as the picture below shows.
Also, is there any way we can ignore multiple lines/files instead of adding //NOSONAR at every single line of code?
//NOSONAR works to disable false-positive issues, not code coverage. To disable the code coverage for these particular files, you can set the sonar.coverage.exclusions parameter at project level (in SonarQube 7.9, go to your project dashboard > Administration > General Settings > Analysis Scope) or global level (in SonarQube 7.9, go to Administration > Configuration > General Settings > Analysis Scope) and add your exclusion pattern there.