Test page - kevin-hinz/sonarlint-docs-migration-render GitHub Wiki

ATTN

The SonarLint documentation has moved! Please visit https://docs.sonarsource.com/sonarlint/xxxxxxxx/ to have a look at the new documentation website. We’ve improved the documentation as a whole, integrated the four SonarLint IDE extension docs together, and moved everything under the sonarsource.com domain to share a home with the SonarQube docs (SonarCloud to come in Q3 of 2023).

More specifically, the content on this page now lives here: https://docs.sonarsource.com/sonarlint/xxxxxxxx/yyyyyyyy

These GitHub wikis will no longer be updated after XX.XX.2023 but no worries, we’ll keep them around for a while for those running previous versions of SonarLint for _____ vX.XX



Supported languages

Language             IntelliJ IDEA & Android Studio CLion Rider (DataGrip, Php Storm, PyCharm, RubyMine, and WebStorm)
C#
C++
CSS
Go ✅ (GoLand)
HTML
Java
JavaScript
Kotlin
PHP
Python
Ruby
TypeScript
XML

In addition, SonarLint for IntelliJ supports the IaC domains for:

Language IntelliJ IDEA & Android Studio CLion Rider (DataGrip, Php Storm, PyCharm, RubyMine, and WebStorm)
Cloud formation
Docker
Kubernetes
Terraform

You can unlock Scala and Swift when using Connected Mode with SonarQube or SonarCloud.

For more details about languages and new features under consideration for the JetBrains family IDEs, you can refer to the SonarLint roadmap where we list all of our coming soon and newly released features.

First taste of SonarLint

Let's analyze a first source file and see what SonarLint can bring.

Copy paste this Java code snippet in a project. It contains a code smell because of duplicated methods:

package org.mycompany;

class MyClass {
  private static final String CODE = "XXX";

  public String calculateCode() {
    doTheThing();
    return CODE;
  }

  public String getName() {
    doTheThing();
    return CODE;
  }

  private void doTheThing() {
    // do it
  }
}

If you open this Java file within the editor, you should see SonarLint reporting the issue by highlighting the text range.

You can hover on the highlight to get a short description of the issue. Clicking on the lightbulb that appears in the left margin will reveal a tooltip containing one or more options, including the option to open a detailed Sonar Rule Description.

Sonar Rule Descriptions

Simply select an issue in the SonarLint view or choose SonarLint: Show rule description from the tooltip to open the Rule tab. Here you will find a brief explanation of the rule as well as Noncompliant and Compliant code samples.

insert IMAGE and/or GIF here

SonarLint for IntelliJ supports syntax highlighting. In addition, users are able to visualize a diff view for the non & compliant code sample which should help you fix your issue.

Some small change.