New code does not include all errors it should

I have GitHub project created 2 months ago.
So, it does not have code older than 2 months.

I have configured New Code like this:

And this is what I see in summary:
image

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.

Hi,

Welcome to the community!

Would you mind sharing screenshots of what those 4 failing conditions on Overall Code are?

 
Ann

It is 3 now, but the problem is the same (new code should have the same count as overall):

Hi,

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?

 
Ann

In my case New Code is not a subset of Overall code.
In my case New Code should be EQUAL to Overall code, because:

  1. My repo does not have code older than 2 months
  2. I have configured New Code to use specific date that is 2 years in the past:

The bug I am referring to is that:
New Code SHOULD be equal to Overall Code in my case and it is obviously not.

Hi,

Can you show me where there are no bugs in New Code?

 
Ann

Here there are no bug in new code:
https://sonarcloud.io/summary/new_code?id=ilyub_eslint-plugin-misc

Hi,

I don’t see any bugs at all, in either of your branches, on new or overall code.

 
:woman_shrugging:
Ann

I don’t see any bugs at all, in either of your branches, on new or overall code.

You asked to show where there are no bugs.
I showed.

The issue I describe is in another repo that is private.
For it I sent a screenshot.

I have configured New Code like this:

Summary shows this:
image

My repo does not have code older than 2 months
I have configured New Code to use specific date that is 2 years in the past

Because ALL my code is less than 2 years it should all be considered NEW.
So, New code = All code.
So, I should see EQUAL number of bugs for new and all code.
And it is different:
image

The above screenshot contains two buttons: “New Code” and “Overall Code”
You can see “4” number next to “Overall Code”.
So, I expect to see the same “4” number next to “New Code”.

Hi,

This started with:

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?

 
Ann

I don’t see how quality gate is related to not showing bugs in New Code tab in a situation when ALL code should be considered new. But I sent 4 screenshots.

Hi,

There are two things going on here.

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:

 
Ann

I have added exactly the same Gate conditions for New and Overall code and rescanned.
Now the two figures should be the same in your opinion?
They don’t:
image

Maybe we can ask somebody like Senior Support about this issue?

Also, passing or not passing threshold has nothing to do with showing bugs.

If New Code = All Code, then I should see SAME bugs for both regardless of passing or not passing Quality Gate.
And I see different.