Only scan modified or new files

Sonarqube version 10.7 Community

I want to scan a folder than contains over 3000 sql files.

I scanned it the first time from cmd using sonar scanner.

Now I have modified a file and want to rescan the folder again. However, there is no need to rescan all the files.

I only want to rescan the modified file to save time.

I tried using sonar.inclusions but it overridden the previous scan and can only see the modified file in the code tab.

So how can I in the same project, rescan only new files or modified files.

Hi,

Welcome to the community!

Only the latest version of SonarQube Community Build is considered active, so you’ll need to upgrade and see if the situation is still replicable before we can help you.

Your upgrade path is:

10.7 → 25.3

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your question, in Community Build every file is analyzed every time.

 
HTH,
Ann

Hi,

I upgraded to sonar 25.3, however same issue only the files in the sonar.inclusions are being scanned but the previous scan is being overridden and I cannot check the issues of the other files.

So to sum up, I scanned 3000 sql files and have for each file its issues.
I modified a file and want to re run the scanner to check if the issues are fixed.
However the other 2999 sql files are still untouched so there is no need to rescan them.
When I ran the scanner on the directory that contains these sql files in rescanned all of them.
I tried scanning another time but this time I specified in the sonar.inclusions what file to scan and it only scanned the file I want, but removed the analysis of the other files

Hi,

In versions, you could use pull request analysis for this.

In Community Build you’re going to need to carefully craft your sonar.inclusions each time.

That said,

analyses are not additive. If you run an analysis of only the one or two changed files, then all the rest of the files will disappear from your project.

You should carefully consider the tradeoffs here.

 
HTH,
Ann