Analyse new Code only in pullrequests

Template for a good new topic, formatted with Markdown:

  • ALM used (Azure DevOps)
  • CI system used (Azure DevOps)
  • Scanner command used when applicable (private details masked)
  • Languages of the repository (C#)

Hi,

I have an existing projects, so naturally I configured the project to ignore the old code (New Code : code changed last 1 days).

It’s working fine except for one repository, on the pullrequests it continue showing the whole analyses, the whole issues, on the main branch (develop) I can see that the new code tab contains only the new issues, it’s not the case of my pullreques on this project, any idea where the issue comes from?

Thank you in advance.
Regards,

Hey there.

Setting a New Code Period to 1 day is not reccomended. If you commit some code on a Friday, and don’t come back until Monday… all that code is no longer in your New Code Period! When using number of days, we suggest about 30 days.

Are you regularly analyzing the target branch (develop), everytime there’s a commit? These symptoms sound like what happens when the target branch / main branch isn’t regularly being analyzed.

We are analysing the main branch (develop) each time we merge a pull request, that’s why I find that strange, the symptom is present only for one project, all projects are using the same template (Analyse the PR, ask the User to fix the warning related to the new code) after merge we perform a new analyse.
I’ll change the the value to 30 days and push a commit via pull request to check, I let you know.

Another element, the symprom is present only on the PR, on the main branch I see that the new code analyse contains only issues from the new code, which is not the case on my PR, on the PR I see the whole list.

FInally the issue is gone, I changed to 30 the number of days, in my pipelie I also add (I’m using ADO):
steps:

  • checkout: self
    fetchDepth: 0

Not sure which modification has resolve the issue.