Running an analysis
How you run a SonarQube for IDE analysis in your VS Code IDE.
Now that you’ve installed the SonarQube for IDE extension in your IDE, running an analysis is straight-forward. For the most part, new analyses are automatically triggered when you open a file, as you type, or with each file save following a change in the code. Below we’ve outlined other ways to trigger a SonarQube for IDE analysis.
Triggering an analysis
First, open a project using one of the Rules and languages. Some languages can only be unlocked when running in Connected mode. For C and C++, check the Analyze C and C++ code section below.
New analyses are automatically triggered in VS Code when you open or save a file; with Autosave configured, new issues will be reported as you type.
Check the Investigating issues page for details about how to recognize issues in your IDE.
Enable or disable automatic analysis
It is possible to manually enable or disable automatic analysis. In the VS Code Status Bar, select SonarQube to toggle the setting. Alternatively, from the SONARQUBE panel, select the dual-arrow refresh icon to toggle automatic analysis.
How it works
With Auto Save enabled in VS Code, SonarQube for IDE continuously analyzes the code while you type. Simply open any source file, start coding, and you will start seeing issues reported by SonarQube for IDE. Issues are highlighted in your code and also listed in the PROBLEMS panel.

You can access the detailed rule description directly from your editor, using the provided contextual menu.

Analyze changed files
This is a SonarQube for IDE Labs feature. Update your SonarQube for VS Code installation to the latest version, then sign up for IDE Labs to get early access to our newest features and help shape the future of SonarQube for IDE!
Open the SONARQUBE FOR IDE LABS panel from the right side of your SONARQUBE panel. See the SonarQube for IDE Labs article for details.
Navigate to the SOURCE CONTROL > Changes view container and select the Analyze Changed Files with SonarQube () icon to trigger an analysis on all files changed since the last commit to ensure fewer issues reach your remote repository. This is especially useful if automatic analysis is disabled for your development project. It can be your last check on changes you made before creating a pull request.
Analyze C and C++ code
Prerequisites
To analyze C and C++ code, you need to satisfy both of these conditions:
Generate a compilation database and
be on one of the Supported environments
See below for details.
Generate a compilation database
Compilation database is a JSON file format introduced by the LLVM project. It contains the compile commands used to build a project. For instructions on how to generate a compilation database, choose the appropriate collapsible below. The preferred option is to use the build system.
Supported environments
Activating C and C++ Analysis
The analysis can be activated by simply pointing to a compilation database that describes the project to be analyzed. This can be done through a notification that pops up when a folder that contains a file named compile_commands.json is opened, or through the SonarQube for VS Code embedded action that lists all compilation database files in the folder, or by manually assigning the sonarlint.pathToCompileCommands option in the settings to the full path of the compilation database.
Note that the SonarQube for IDE embedded action can be used to switch the active compilation database.
Troubleshooting C and C++ Analysis
Troubleshooting C and C++ Analysis
Check out the C and C++ Analysis examples in the Resources section.
Analyze JavaScript and TypeScript
If you’re experiencing issues when analyzing TypeScript or TypeScript, check this JavaScript and TypeScript analysis troubleshooting article about problems related to memory usage.
Last updated
Was this helpful?

