SonarCloud detects code smell in Feature Branch but fails to detects in the Master Branch

Template for a good new topic, formatted with Markdown:

  • ALM used (GitHub, Bitbucket Cloud, Azure DevOps)
  • CI system used (Bitbucket Cloud, Azure DevOps, Travis CI, Circle CI
  • Scanner command used when applicable (private details masked)
  • Languages of the repository
  • 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

We are scanning code in CPP language using sonarcloud. But, for the same code SonarCloud detects code smell in Feature Branch but fails to detects in the Master Branch / main branch. Please suggest

Hi,

Is the compilation and analysis of both branches run exactly the same? Or are the complete flags and/or #DEFINEs different from one to the other?

 
Ann

Hi Ann,

Yes both branches runs the exactly same code. But, main branch fails to detect the code smell which feature branch is showing. Also, the rules ( The right-hand operands of && and || should not contain side effects) are not depreciated.

Hi,

Could you provide the two different analysis logs, please?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Thx,
Ann