file -> setting -> Plugins -> Marketplace -> SonarLint -- Installed & Restart IDEA

重启IDEA 后 ,底部就有了sonar 窗口,默认检测当前文件。

Maven 下 setting.xml 配置:
<profiles>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<sonar.jdbc.url>jdbc:mysql://localhost:3306/PQ_code_check</sonar.jdbc.url>
<sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
<sonar.jdbc.username>PQ</sonar.jdbc.username>
<sonar.jdbc.password>PQ@0802</sonar.jdbc.password>
<sonar.host.url>http://localhost:9090</sonar.host.url>
<sonar.exclusions>
**/*Test.*,**/test/**/*
</sonar.exclusions>
</properties>
</profile>
</profiles>
原文:https://www.cnblogs.com/wgy1/p/10673002.html