Does Sonar analyze codes incrementally with publish mode?

java
sonarqube

(Shuai Cao) #1

I’m using SonarQube version 7.1 community edition for Java code analysis.
As Incremental mode in sonar.analysis.mode has already been deprecated, just want to know if publish and preview mode also analyze code incrementally( i.e. ignore the unchanged code and files)?


(Nicolas Bontoux) #2

Hi there,

Before I comment on sonar.analysis.mode, a quick background: at all times, and for all SonarQube versions, any analysis that would submit its results to the SonarQube server would be a full analysis. There has never been a way to run a partial analysis (inspecting just a few files) and have the related (partial) findings submitted in SonarQube (for good reasons actually, as most of the complex rules can’t be checked by looking at a diff alone, new rules/settings might have been added/updated on the server side etc. so the full codebase is always reinspected).

At this stage also note that sonar.analysis.mode is deprecated and should no longer be used. Various features are now available to cover each use-case. At a high-level:

  • local analysis for on-the-fly feedback in the IDE: this is where SonarLint shines ! (fyi this only analyzes file being edited)

  • Branch & Pull-Request analysis: to validate the quality of ongoing work (e.g. feature branches and pull requests). This is a commercial feature available in Developer Edition, and it does perform a complete analysis (for the same reasons I just outlined).

  • and of course full project analysis with SonarQube