Hello,
I found a lot of new issues are reported from old files without any change over the last few years.
Pls advise on this
Hello,
I found a lot of new issues are reported from old files without any change over the last few years.
Pls advise on this
Hi,
You’ll have to give more details on the files, the issues and the underlying rules.
Ann
Hi @ganncamp ,
Here is an example. there is no change on those files but still got some issues, which is committed several months ago.
Hi,
You’re saying that BaseAccountDashboardFragment.kt
hasn’t changed in longer than 3 months? And if so, how long has the file been under analysis? Is it possible that 3 months ago was when sonar.sources
or your exclusions were changed to bring it under analysis?
Ann
Hi @ganncamp
That file hasn’t changed for 3 months, and there is no change in exclusions.
It’s quite weird. And I have spent a lot of time investigating, but I can’t find out the reason why.
Hi,
Let’s focus on that first ‘Remove this unused import’ issue. Could you click through on it to get to the issue in context, and then click on the left margin of the line the issue is raised on to get the last modified date as SonarCloud understands it? And then post a screenshot (obvs redacted as necessary)?
Ann
Hi,
Thanks for the screenshot. It’s exactly what I was looking for!
It shows that the line in question was modified 3 months ago, which is when the issue was raised. So analysis is acting correctly.
If you believe no changes were made to the line in early December, you should probably dig into your SCM to see why it’s reporting that there were.
HTH,
Ann
Hi @ganncamp ,
But that file isn’t changed in the scanned branch/PR.
I expect that the issues only raise on the new codes or the files have changed code.
Hi,
Okay, let’s get the context and set expectations.
Is this a branch analysis? If so, it’s going to show all issues in the code. Is it a PR analysis? If so, it should only show issues on new lines.
Your OP said:
But that’s not actually true. Your screenshot shows that the issue we’re focusing on is properly raised on code that was changed 3 months ago.
Ann
Hi @ganncamp ,
Sorry if my wording is not clear.
That is a PR analysis (short-lived branch), so it should only show issues on the new code. But in the screenshot, the issue is raised in the code, which was committed 3 months ago
Hi,
Could you share a screenshot of the branch homepage, please?
Ann