Rules and languages
The rules and languages supported by SonarQube for VS Code.
The Sonar rules catalog is the entry point where you can discover all the existing rules. While running an analysis, SonarQube for IDE raises an issue every time a piece of code breaks a coding rule. Software quality classification and severity show the impact of the issue on your code. To see a full list of Sonar rules, check the Rules page of your SonarQube Server instance or in your SonarQube Cloud organization.
See Software qualities for more information.
Overview
SonarQube for VS Code currently supports the following programming languages:
Supported out of the box: SonarQube for IDE automatically checks your code in these languages and formats.
Connected Mode required: Running in Connected mode with SonarQube unlocks analysis for these languages and formats.
Apex rules
Azure Resource Manager rules
C rules
C++ rules
C# rules
COBOL rules
CSS rules
Go rules
HTML rules
Java rules
JavaScript rules
PHP rules
PL/SQL rules
Python and IPython notebook rules
Secrets detection rules
Text
TypeScript rules
T-SQL rules
XML
In addition, SonarQube for VSCode supports the IaC domains for:
Ansible
CloudFormation
Docker
GitHub Actions
Kubernetes
Terraform
The full list of available rules can be found in the VS Code UI. See the article below about Using Sonar rules for details. Open the Supported language versions expandable to learn how to see which versions are supported for a given language.
There are commercial-level rules available in SonarQube Cloud (all plans) and in SonarQube Server. For these rules to appear in SonarQube for IDE, it must be in connected mode. See Commercial-level rules for more information.
For more details about languages and new features under consideration for VS Code, check out the SonarQube for IDE roadmap where we list our coming soon and newly released features.
Sonar Rule Descriptions
Simply right-click an issue in the PROBLEMS Panel, and choose SonarQube: Show issue details for `…` to open the SonarQube Rule Description webview. Here you will find a brief explanation of the rule, along with a noncompliant and compliant code example. For more information, see the server documentation about quality profiles:
Managing quality profiles in SonarQube Server.
Managing quality profiles in SonarQube Cloud.
For some SonarQube Rule Descriptions, you can visualize a diff view for the noncompliant and compliant code sample, which should help you fix your issue.

An issue’s coding attribute, software qualities, and severity are found when opening the SonarQube Rule tab. Below the rule title, you will find the coding attributes that highlight an issue’s classification. Check the SonarQube glossary for details about coding attributes, and the Software qualities page to better understand how they help classify your issue.

When in Connected Mode
If you’re running SonarQube for VS Code while in connected mode with SonarQube Server or SonarQube Community Build, your view will change according to the server settings. Standard Experience mode encompasses the use of rule types such as bugs, code smells, and vulnerabilities. Alternatively, if SonarQube Server is set to Multi-Quality Rule mode, you will more accurately represent the impact an issue has on all software qualities.
Please see the pages about the MQR mode and Standard Experience for detailed information about the available rule modes for your instance:
Choosing a mode for your instance in SonarQube Server
Choosing a mode for your instance in SonarQube Community Build
Applying rules while in connected mode
Connected mode syncs your SonarQube quality profile with the local analysis to suppress issues reported in the IDE. See the Connected mode documentation for more information.
Language-specific requirements
See the Language-specific requirements on the Requirements page.
Rules for AI CodeFix
A select set of rules are eligible for AI CodeFix when running in connected mode. Please see the Rules covered with AI CodeFix article for a full list.
Other rule types
Using Sonar rules
When not running in connected mode (also known as standalone mode), all Sonar rules for your language can be configured in the IDE. In addition, some Sonar rules have parameters that you can modify. Here are a few reasons you might want to edit a rule locally:
Disable a rule that is enabled by default. Maybe the rule doesn't apply to your specific project. See Rule selection for more information.
Enable a rule that is disabled by default. By reviewing which rules are disabled, you might notice that some rules could be useful in the context of your project. See Rule selection for more information.
To improve a rule. In some cases rules have parameters. For example, regarding cognitive complexity, you can customize the threshold at which the rule will raise issues. See Edit rules for more information.
Rule selection
The full list of available rules is found by navigating to the SONARQUBE SETUP > RULES view in the VS Code Activity Bar. There, Sonar Rules can individually be toggled on or off while running SonarQube for IDE in standalone mode; each rule is clearly marked as on or off, and it’s possible to filter the visible list by an Active, All, and Inactive status.
When your project is bound to SonarQube Server or SonarQube Cloud using Connected mode, the rule set is managed on the server side as defined by the quality profile. See Applying rules while in connected mode, for details.
Edit rules
To edit a rule in SonarQube for VS Code, navigate to the SONARQUBE SETUP > RULES view and select the rule you want to edit. Select or deselect any rule in the list to enable or disable it. If a rule has options, you’ll see them at the bottom of the rule description.
Navigate to the SONARQUBE SETUP > RULES view.
Select any rule to open the rule description. Use the filter if desired, or under the three-dots there’s an option to select Find Rule By Key.
Look for Parameters at the bottom of the rule description. In the screenshot below, giraffes are added to the list of at-rules to ignore in rule css:S4662. When edited, the parameters will show both the Current value and the Default value.
To edit a rule, navigate to Settings… > Extensions > SonarLint > User menu, search for
Sonarlint: rules, and select the Edit in settings.json link to open. The code sample provided in the User settings shows two examples: to turn rule javascript:S1481 “off”, and to edit the maximum line length checked by javascript:S103.

Unsupported rules
Some rules are simply too advanced to run locally, in SonarQube for IDE. Because some rules report issues at the project level, apply to the architecture of your code base, or require extensive resources to analyze, they are not included when SonarQube for IDE runs an analysis. Unsupported rule types include architecture, injection vulnerabilities, and some advanced bug detection rules.
However, these advanced issues will be reported in the IDE when you are running in connected mode with SonarQube. See these links for more information:
Sonar https://app.gitbook.com/s/B4UT2GNiZKjtxFtcFAL7/architecture in SonarQube Cloud
Injection vulnerabilities in SonarQube for VS Code
Rules while in Connected Mode
Connected Mode syncs your SonarQube Server or SonarQube Cloud Quality Profile with the local analysis to suppress issues reported in the IDE. Therefore, when running in Connected Mode, SonarQube for VS Code will ignore rule settings that are defined locally. See the Connected mode page for more information about running connected mode and the Benefits it brings when working in teams.
Edit rules in connected mode
If you’re running in Connected mode with SonarQube, you can share customized active rules with your team because you’ll all be using the same quality profile to share rule sets. Please see the relevant instructions for the server you are connecting to:
Understanding quality profiles in SonarQube Cloud
Understanding quality profiles in SonarQube Server
Understanding quality profiles in SonarQube Community Build
Last updated
Was this helpful?

