I’m using SonarQube 8.7, sonar-scanner-msbuild 5.1.0 and JetBrains dotCover 2020.2.4.
I’m running SonarQube on C# projects, some of these project don’t have any unit tests. I changed some source code formatting, e.g. source code comments, line spacings, tabs and white spaces.
SonarQube detects new code on these changes, this is as expected because I changed the code recently.
The SonarQube quality gate fails too because new code coverage is below 80%.
Is there any way to exclude changes with white spaces and white lines from new code detection?
Thank you for pointing me to the ticket. If I’m not mistaken this ticket is about setting a minimum amount lines of new code before evaluating the quality gate. Outlining source code (adding white spaces and / or line feeds) may take a lot of changed lines.
Do you think my use case will be covered with this ticket?
Instead of considering the number of lines, conditions on coverage-related metrics should be ignored based a minimum number of new lines to cover.
I.e. ignore vertical whitespace.
Now if you change the indenting in the file, that will show up as changed code → lines of code marked new by your SCM. But otherwise, this is what you’re looking for, isn’t it?