How do you customize SonarLint rules in IntelliJ IDEA?

橙三吉。 提交于 2019-12-03 06:42:10

问题


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


回答1:


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.




回答2:


As it is now possible with the current release of SonarLint (I'm using version 3.0.0.2041), people might be interested in the solution.

  • File -> Settings -> Other Settings -> SonarLint General Settings
  • Click on the green + in "SonarQube servers" :
    • Enter a name (ex : SonarQube / localhost)
    • Select SonarQube and enter URL like http://localhost:9000
    • Authentication : select your user token or your login/pwd
    • Click on Finish
    • Click on "Update binding" to synchronize with the SonarQube server
  • Go to SonarLint Project Settings and bind your project to the SonarQube project

Thus, when you open your files, SonarLint will automatically retrieve the SonarQube server's issues.



来源:https://stackoverflow.com/questions/33176001/how-do-you-customize-sonarlint-rules-in-intellij-idea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!