PR checks dont match main branch

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps): Github
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI: Github Actions
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: Typescript/Python
  • Only if the SonarCloud project is public, the URL
    • And if you need help with pull request decoration, then the URL to the PR too
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
  • Steps to reproduce
  • Potential workaround

Hi,
I’ve had instances where I have a PR that would pass the Sonar checks but then fail in the main branch when merged. The last instance was the duplicated lines check (set as 3% ) and this is based on new code. I disabled the setting to ignore small changes (less than 20 lines of code) but when I look at the PR summary, it says there is no condition for the duplicated lines. How do I ensure PR builds go through the same checks as on main? The PR summary did correctly predict there would be over 3% duplication on merge so why didnt it fail?

Hi,

Could I have a screenshot of your failing quality gate, so I can see what conditions are failing, as well as one of your PR, both redacted as necessary?

 
Thx,
Ann

So here is the passing PR gate which identified the target is 3% but upon merge it will cause the duplication to be 3.8%

I unfortunately cannot get the main build as the developers have since reduced this duplication and I can only retrieve the last run (which is passing).

The issue is in the screenshot above however that the checks are passing despite knowingly introducing what will be a failure in the main branch

Hi,

Your screenshot shows 0% duplications, so it’s quite natural that this PR would pass the Quality Gate. Only conditions on new code are applied in PRs, and your screenshot shows 0% duplications on new code. 0% < 3% so it passes.

That “3.8% Estimated after merge” presumably reflects the duplication percentage that already exists in the code base since this PR won’t be adding any duplications.

 
HTH,
Ann