Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you customize SonarLint rules in IntelliJ IDEA?

Is it possible to have SonarLint for IntelliJ IDEA enforce only the rules I have enabled on my Sonar server?

like image 441
Daniel Smith Avatar asked Oct 16 '15 17:10

Daniel Smith


People also ask

How do I change the SonarLint rule in IntelliJ?

In Intellij — Go to File >> Plugins >> Type 'SonarLint' >> Install and Restart IDE. (2) we can choose the SonarQube rules. → To integrate SonarQube(server) and SonarLint in our IDE and run SonarQube code inspection rules per class to give results quickly.

Can we add custom rules in SonarLint?

As you discovered, we manage plugins, custom rules and quality profiles at a central place, in SonarQube, and SonarLint can benefit from that only in connected mode. Note that even though we call it connected mode, there is no active connection between SonarLint and SonarQube.

How do I enable rules in SonarLint?

Open the “SonarLint Bindings” view in Eclipse, right click on your connection, and click “Update all projects bindings”. I know the root cause. It is because these rules are default not activated. I shoud copy the built-in profile and activate them, then Update All Project Bindings from SonarLint.


1 Answers

SonarLint 1.0 for Eclipse and IntelliJ do not allow to edit the quality profile (or set of rules) to be used for the analysis. Moreover, SonarLint 1.x works completely independently of a SonarQube server (having a SonarQube server is not a requirement), and therefore does not have the ability to reuse a quality profile defined there.

SonarLint 2.0 will have an optional mode that connects to a SonarQube server, and will offer this feature - but this isn't available yet.

like image 168
Dinesh Bolkensteyn Avatar answered Oct 07 '22 22:10

Dinesh Bolkensteyn