Different issues found on a same file

I have a Java project which has a lot of issues(more than 6K). I found the rule S1874 scan result is different on the same file. The issue only be reported a few at first, but when I change some code in other files and it had noting to do with this function, then more of the issue would be reported in some other files. And I noticed actually there should be hundreds of this issue for the whole project(I have called the deprecated function hundreds times), but only 6 issues was reported at first time, 9 issues was reported at the next time.

what could cause this issue? Why didn’t the scanner report all issues?

version information: Sonarqube version Community Build v25.2.0.102705, SonarQube Scanner for Jenkins 2.18

Hi,

Welcome to the community!

What were the changes?

And can you share the 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.

 
Thx,
Ann

I believe the change is not important. It appears in different files, has nothing to do with the deprecated functions. Just some logic changed.

here is the log

sonarscanner.log (3.7 MB)

Hi,

Thanks for the log.

There are nearly 1k lines like this:

This tells me analysis doesn’t have all the information it needs to be thorough. And that can explain fluctuating issues.

So let’s back up a bit. It seems that you’re using the SonarScanner CLI? Why was this your choice for a Java project? What are you building with? Presumably you’re using either Maven or Gradle. If you were to use the SonarScanner that corresponded to your build system, it would automatically pick up from your build environment nearly all of the data analysis needs.

 
Ann

Regarding syntax errors, this issue was caused by some code not scanning(It’s more like a library from IDE).

But this issue(Different issues found on a same file) happened on the file has nothing to do with the changed files. Will the syntax errors change of A file affect the scan result of B file? B file never use A file?

Hi,

Syntax errors in a file will keep the file - and its classes - from being understood. That can impact the understanding of the application as a whole.

 
Ann

Thanks.

I will try solve these syntax errors first