Is there a way to not need to build every time I run sonar-scanner

scanner
sonarcfamily
(Daniel Dolfie) #1

I’m using sonar-scanner to decorate pull-requests on Bitbucket. I can scan without first building again
as long as the short-lived branch isn’t adding new files. In this case the scanner is smart enough to know the differences in my branches without having to build. However, if the short-lived branch gets a new file added to it, that file is not included in “compilation units analyzed” and bugs in the new file aren’t in pull request decoration. The new file would be added if I were to build again. However, this takes a long time. Is there a way to add new files to “compilation units analyzed” without having to rebuild. (I’m using SonarQube 7.7 and sonar-scanner CLI)

Below is the command I’m doing. I’d like to do this for each PR without also having to build:
sonar-scanner -D sonar.projectKey=my:test -D sonar.projectName=test -D sonar
.projectVersion=1.0 -D sonar.sources=src -D sonar.cfamily.build-wrapper-output=bw_output -D sonar.sourceEncoding=UTF-8 -D sonar.cfamily.threads=8 -D sonar.pullrequest.branch=story/testSonar -D sonar.pullrequest.key=1428 -D sonar.pullrequest.base=epic/testSonar

(Massimo Paladin) #2

Hi @Danimal,

for the time being the only supported way is to have a full build before analysis, we do have some plans to make progress in this topic but nothing coming out shortly. You could always setup ccache to speedup the build, would that work for you?

1 Like
(Daniel Dolfie) #3

Thanks Massimo. I’ll look into that.