This is obviously a bug:
It can’t show zero errors for New Code and 4 errors for Overall Code.
With my setting and taken into account that my repository was created only 2 months ago, ALL code is new.
So, it should include all errors.
New Code is a subset of Overall code, and New Code metrics represent subsets of Overall code metrics. Having a Bug show up in “Overall” does not mean that it is not considered a New bug.
I believe this is a question of how you’ve configured your Quality Gate. If you look, I suppose you’ll find that you’ve set conditions on Overall code rather than on New Code. Thus you see failing conditions on Overall code.
Would you mind sharing a screenshot of your Quality Gate configuration?
Yes, you should see equal numbers of bugs for both New and Overall code. But the “errors” you’re referring to are failing Quality Gate conditions, not Bugs. That’s why that line starts with “4 Failing Conditions”
Then you need to have set the same conditions in your Quality Gate on New Code as you set on Overall code.
Again, would you care to share a screenshot of your Quality Gate conditions?
The first is the distinction that needs to be made between Bugs - a type of issue in your code that could cause a runtime problem - and Failing Conditions - Quality Gate conditions that are unmet.
The “4 Failing Conditions” screenshot you’ve posted repeatedly is about the latter. The “Overall Code 4” in that same screenshot relates to your Quality Gate - you’ve only set conditions on Overall Code, so you can only see Failing Conditions on the Overall Code tab.
Regarding the bug, can you click through on it, and then click on the code margin to show the commit information on the relevant line? Like so: