SonarLint Documentation
What is SonarLint?
SonarLint is a free and open-source IDE plugin for static code analysis brought to you by Sonar. It’s your first line of defense, designed to detect coding issues in real-time for 25 languages, frameworks, and IaC platforms. Your code is checked against an extensive set of rules that cover many attributes of code, such as maintainability, reliability, and security issues. It’s possible to analyze more rules, assign issues, share quality profiles, and more, with your team when running in connected mode with SonarQube or SonarCloud. See the Connected Mode benefits list for more details.
Sonar’s IDE extensions are available for IntelliJ (and other JetBrains IDEs), Visual Studio, VS Code, and Eclipse, and can be installed directly from your IDE's plugin marketplace. SonarLint leverages over 5,000 language-specific Clean Code rules.
The approach to Clean Code
Clean Code is the standard for all code that results in secure, reliable, and maintainable software therefore, writing clean code is essential to maintaining a healthy codebase. This applies to all code: source code, test code, infrastructure as code, glue code, scripts, and more.
Sonar's Clean as You Code approach is a software development practice based on the principle that new code (code that you added or modified recently) needs to comply with SonarQube and SonarCloud quality standards. The Sonar solution implements Clean as You Code by warning you whenever issues are detected in your new code, helping you maintain high standards and focus on code quality by incrementally improving the entire code base.
SonarQube and SonarCloud come with built-in quality profiles designed for each supported language, called the Sonar Way profile. The Sonar way activates a set of rules that should be applicable to most projects and is a starting point to help you implement clean code practices in your organization.
The Sonar Solution
Sonar products are designed to help you achieve a state of Clean Code. By linking SonarLint with SonarQube or SonarCloud, checks are performed at every stage of the development process; we call this the Sonar solution. This means your project settings, new code definitions, and quality profiles are applied locally to an analysis in the IDE. The Sonar solution is designed to help you achieve a state of Clean Code. Your project settings, new code definitions, and the quality profiles managed in SonarCloud are applied locally to an analysis in the IDE
- SonarLint provides immediate feedback in your IDE as you write code so you can find and fix issues before a commit.
- Then, SonarQube and SonarCloud analyze your pull requests before you merge them, providing another layer of protection against code issues.
- Finally, SonarQube and SonarCloud analyze your code on each build as part of your CI/CD workflow and, together with Sonar Quality Gates, prevent code with issues from being released to production.
The Sonar solution helps you incorporate the Clean as You Code methodology by helping engineers pay attention to new code. Focusing on writing new, clean code during development ensures that all code released for production will be incrementally improved over time.
Connected Mode
Connected Mode joins SonarLint with SonarQube and SonarCloud to deliver the full Sonar solution. SonarLint and SonarQube 9.9+ or SonarCloud analyses help to ensure only clean code makes it into your project.
Be sure to check out all of the Connected Mode benefits.
Getting started
Now that you've heard about how SonarLint can help you write clean code, you are ready to try out SonarLint for yourself. After installing SonarLint for your IDE from the Marketplace, open a project using a supported language and let SonarLint run an analysis.
The Investigating issues explains how to find issues and focus on new code and each IDE explains how to fix issues in your code as you write.
Learn more
Check out the entire suite of Sonar products: SonarQube, SonarCloud, and SonarLint.
Then, have a look at the types of issues that SonarLint detects when combined with SonarQube and SonarCloud, and browse a full list of Sonar Rules and Rule Descriptions available for static code analysis.
Staying connected
Use the following links to follow SonarLint for IntelliJ behind the scenes:
And if you need help, visit our online community to search for answers and reach out with questions!
Was this page helpful?