Sonar detecting old code smells as new on PR decoration

Hello team,

We have SonarCloud up and running in our environment for 1 month now, and last week, we encountered with some code smells being detected while creating a PR into one of our longer branches (develop).

Our PR was raised on August 7th, and it was detecting code smells that were pushed on June 26th.

I checked other topics

and there are some suggestion of upgrading Sonar, but in our case, this is only being affected when PR decorations are executed.

We have the new code definition based on previous version.

What could be the cause of this new behavior, and how can we fix it?

  • ALM used AWS CodePipeline with Github Actions
  • Scanner command used when applicable (private details masked)
  • Languages of the repository: Python

Let me know if you need additional details.
Thank you.
Christian.

Hi Christian,

PR analysis isn’t actually based on the New Code Definition, but on what’s new in the PR. I suspect this is a problem with the SCM data available to analysis. What’s your fetch-depth when you check out?

Can you share your analysis log?

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.

 
Ann

Hi,

Thanks for the log.

Here’s the problem:

INFO: SCM Publisher is disabled

All the data is there, but you didn’t allow analysis to read it. :smiley:

 
HTH,
Ann

Hey Ann,

Thank you so much for the analysis. What’s the best way to enable it for good? by adding sonar.scm.provider on our sonar-project.properties ?

This is how it looks like so far on our UI

Thanks again Ann!
Christian.

Hi Christian,

It’s on by default. I would just Reset it here. You shouldn’t need to add an analysis property.

 
HTH,
Ann

Hey Ann,

Reset only the first option? Or the second one as well?

Thanks.

Hi,

I hadn’t noticed the second one, to be honest. But yes, reset them both. If analysis can’t automatically detect from your filesystem that you’re using Git, telling it that you’re using Git isn’t going to help. :smiley:

To be honest, that second one is vestigial, and I have no idea why we haven’t removed it yet.

 
HTH,
Ann

Hey Ann,

thank you so much. I’ll apply that change then. If I have the same issue after that, I’ll let you know.

As per usual, could you please help me deleting the post where I put the logs (to avoid sharing sensitive info).

Thank you so much for the kind attention always, Ann!

Hi,

I’m glad this helped.

Please feel free to edit your posts to redact any sensitive information.

 
Ann

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.