Start Free
10.6 | Analyzing source code | Languages | C/C++/Objective-C | Analysis modes

Was this page helpful?

Analysis modes

On this page

The analysis can operate in Automatic Configuration (AutoConfig) or Manual Configuration (Compilation Database) modes. 

AutoConfig is activated by default, while the Compilation Database can be activated by supplying a compile_commands.json to the SonarScanner.

The analyzer must understand the code's intended compilation options to ensure an accurate static analysis of the CFamily code. 

  • In Compilation Database mode, these options are provided to the analyzer through Compilation Database: a JSON file introduced by the LLVM project.
  • In AutoConfig mode, the analyzer attempts to deduce these options automatically. A set of high-level AutoConfig properties can tune the automatic deduction process. See the "AutoConfig-specific properties" section in Customizing the analysis.

Choosing the right analysis mode

AutoConfig mode is recommended if:

  • Your projects use compilers that don’t meet the supported compiler prerequisite of Compilation Database mode.
  • Your projects use compilation environments where generating a compilation database is not feasible (see Prerequisites).
  • You desire a swift analysis setup without the need to allocate human resources for the generation and maintenance of the Compilation Database.
  • Your projects have a low CFamily code percentage.

Compilation Database mode is recommended if:

  • You seek the highest CFamily analysis quality SonarQube can provide. Please note that in rare instances, AutoConfig may result in some issues being overlooked.
  • You want to have finer control over the analysis configuration. For example, if you want to analyze a specific build variant or several variants (see "Analyzing code variants" in Customizing the analysis).
  • You have projects with Objective-C code: Objective-C analysis is not supported in AutoConfig mode.

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License