Windows 10 10.0 amd64
SonarScanner 4.8.0.2856
SonarQube Enterprise 9.9.1.69595
I am trying to get incremental Sonar scans by populating $files with only the changes made by the pull request. But if the pull request only changes documentation or scripts or configs, Sonar will have no files to scan. The result is a failure. Can this be changed to successful somehow?
As of SonarQube v9.9.1, SonarQube now natively (and officially) supports incremental analysis, without trying to manipulate sonar.inclusions (something that was never supported). From the SonarQube 9.9 LTS announcement:
Pull Request (PR) analysis gets a significant speed boost. With the implementation of incremental analysis and server-side caching, only the changed files are analyzed.
No matter the programming language, your PR analysis will be considerably faster – the same high-precision results; just delivered faster. For example, a mid-size project with approx 300,000 Lines of Code is now analyzed more than twice as fast as before. This means that a PR that would have taken 5 minutes to be analyzed on SQ 8.x, now takes under 2 minutes.
There’s nothing special you need to do to enable this as long as the target branch is analyzed.