SonarQube 和 SonarLint 的区别

SonarQube 和 SonarLint 到底有什么不同?SonarQube 有一个与之相关的服务器,而 Sonarlint 的工作方式更像一个插件。但它们之间的具体差异是什么呢?

80962 次浏览

SonarLint lives only in the IDE (IntelliJ, Eclipse and Visual Studio). Its purpose is to give instantaneous feedback as you type your code. For this, it concentrates on what code you are adding or updating.

SonarQube 是一个处理完整分析的中央服务器(由各种 SonarQube Scaners 触发)。它的目的是对代码库的质量进行360度全方位的评估。为此,它定期分析项目的所有源代码行。

SonarLint 和 SonarQube 都依赖于相同的静态源代码分析器——它们中的大多数都是使用 SonarSource 技术编写的。

应该补充的是,SonarQube 还使用第三方分析程序(findBugs、 checkstyle、 PMD)执行扫描,而 SonarLint 没有包括这些程序。我认为原因在于依赖于 java 字节码的性能优先级和 findBugs。

因此,如果基础质量配置文件使用第三方扫描仪,你在 SonarQube 和 SonarLint 中的发现可能会有所不同。

SonarQube 是一个服务器,您可以在其中托管您的项目并执行分析,而 SonarLint是一个代理,允许我们连接到这个 SonarQube 并远程执行分析。SonarLint 可以与 IDE 一起使用,也可以通过 CLI 命令执行。

SonarLint contains its own set of default rules but when connected to SonarQube, users can import rules from SonarQube which are actually more than just standard set of rules. We can integrate PDM, CodeStyle and many other checker on SonarQube and create custom rules.

我想提到的两个事实是,我从自己的经验中学到的,SonarLint 不会继承 SonarQube 的那些自定义规则,其次,Sonar 不能在 Test 类上工作。

Sonarqube runs the rule valiations on the server We integrated it to our TFS builds. SonarLint runs in the IDE so before I commit my code I know what lines are violating which rules inside the IDE.

此外,SonarLint 确实有一个“秘密检测”解决方案,专注于应用于任何配置文件的云凭证,即。是语言不可知论者,而 SonarQube 不是。