Quality Gate and new code definition settings :
For new code definition we have set for Previous Version and the quality gate rules are copy of Sonar Way.
Hi @mickaelcaro , There is ongoing development process,
so after every few hours there might be a new analysis version.
Following is the activity tab of main branch (develop)
This Project was on-boarded on SonarCloud on 3rd March, 2021. This is the first version that is on-boarded. Since then, this version hasn’t been changed.
This sounds like typical Sonar behaviour to me. If the code you start with is already failing, you’d better hope you never have to change it, not even to make improvements, because as soon as you try to make one improvement in the code, the quality gate will kick you in the balls for not fixing every other issue in the same area.
Some classic examples of this from recent memory:
I removed a warning suppression and Sonar failed the quality gate complaining about suppressing warnings.
I made a line of code shorter and Sonar quality gate complained about the line of code being too long.
I fixed the indenting on a line and Sonar quality gate complained about some existing issue that happened to have code on the same line.
I think Sonar is just not current designed in a way to encourage people to improve code quality because most of the time, when trying to do so, the quality gate prevents you making the change.
Rather than doing warning accounting on a line by line basis, it should be looking at the total warnings before and after and only complaining if the total went up.