IDEA中关闭sonar代码质量检测

笔者在IDEA中禁用了SonarLint等各种配置,还是无效,后来在网上找到说是插件的bug,

There was a bug in SonarLint for IntelliJ that prevented the configuration to be properly saved.

It was fixed in the latest version 2.3.2: https://jira.sonarsource.com/browse/SLI-106

About the performance, please make sure you are using the Java analyzer 4.2, as you might be experiencing this problem: https://jira.sonarsource.com/browse/SLI-100.

It is embedded in the latest SonarLint, but if you use the connected mode, you also need to check which version of the Java analyzer is installed in the SonarQube server.

We are always trying to improve performance, so feel free to open a topic in the SonarLint Google group with the verbose analysis log so that we can investigate why it takes so long to analyze the file.

关闭插件以后每次都出现以下日志:

D:\develop\Java\jdk1.8.0_181\bin\java.exe -Dmaven.multiModuleProjectDirectory=F:\xxx\SRC\web -Dmaven.home=D:\develop\apache-maven-3.5.4 -Dclassworlds.conf=D:\develop\apache-maven-3.5.4\bin\m2.conf -Dfile.encoding=UTF-8 -classpath D:\develop\apache-maven-3.5.4\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.3.4 -s D:\develop\apache-maven-3.5.4\conf\settings.xml -Dmaven.repo.local=D:\develop\apache-maven-3.5.4\repo org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.xxx:web >--------------------------
[INFO] Building web 0.3
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- sonar-maven-plugin:3.6.0.1398:sonar (default-cli) @ web ---
[INFO] User cache: C:\Users\Administrator\.sonar\cache
[INFO] SonarQube version: 8.1.0
[INFO] Default locale: "zh_CN", source code encoding: "UTF-8"
[WARNING] SonarScanner will require Java 11 to run starting in SonarQube 8.x
[INFO] Load global settings
[INFO] Load global settings (done) | time=63ms
[INFO] Server id: A7EE8CF2-AW82frKWbTHGKwBVU3w-
[INFO] User cache: C:\Users\Administrator\.sonar\cache
[INFO] Load/download plugins
[INFO] Load plugins index
[INFO] Load plugins index (done) | time=38ms
[INFO] Plugin [l10nzh] defines ‘l10nen‘ as base plugin. This metadata can be removed from manifest of l10n plugins since version 5.2.
[INFO] Load/download plugins (done) | time=78ms
[INFO] Process project properties
[INFO] Process project properties (done) | time=9ms
[INFO] Execute project builders
[INFO] Execute project builders (done) | time=3ms
[INFO] Project key: com.xxx:web
[INFO] Base dir: F:\xxx\SRC\web
[INFO] Working dir: F:\xxx\SRC\web\target\sonar
[INFO] Load project settings for component key: ‘com.xxx:web‘
[INFO] Load project settings for component key: ‘com.xxx:web‘ (done) | time=9ms
[INFO] Load quality profiles
[INFO] Load quality profiles (done) | time=34ms
[INFO] Load active rules
[INFO] Load active rules (done) | time=339ms
[INFO] Indexing files...
[INFO] Project configuration:
[INFO] 464 files indexed
[INFO] Quality profile for java: p3c profiles
[INFO] Quality profile for xml: Sonar way
[INFO] ------------- Run sensors on module web
[INFO] Load metrics repository
[INFO] Load metrics repository (done) | time=15ms
[INFO] Sensor JavaSquidSensor [java]
[INFO] Configured Java source version (sonar.java.source): 8
[INFO] JavaClasspath initialization
[INFO] JavaClasspath initialization (done) | time=21ms
[INFO] JavaTestClasspath initialization
[INFO] JavaTestClasspath initialization (done) | time=12ms
[INFO] Java Main Files AST scan
[INFO] 228 source files to be analyzed
[INFO] Load project repositories
[INFO] Load project repositories (done) | time=19ms
[INFO] 228/228 source files have been analyzed
[WARNING] Classes not found during the analysis : [javax.annotation.meta.When, org.apache.http.annotation.ThreadingBehavior]
[INFO] Java Main Files AST scan (done) | time=6020ms
[INFO] Java Test Files AST scan
[INFO] 228 source files to be analyzed

由于笔者配置了Maven任务是在编译前进行代码质量,于是每次运行项目都会跑这个脚本。很浪费时间。

笔者打开了.idea目录中的misc.xml删除以下类似代码,项目就能正常运行不再预先检查代码质量了。

<property name="SONARLINT_PRECOMMIT_ANALYSIS" value="true" />
 <component name="MavenCompilerTasksManager">
    <option name="beforeCompileTasks">
      <set>
        <MavenCompilerTask>
          <option name="goal" value="org.sonarsource.scanner.maven:sonar-maven-plugin:3.6.0.1398:sonar" />
          <option name="projectPath" value="$PROJECT_DIR$/pom.xml" />
        </MavenCompilerTask>
      </set>
    </option>
  </component>

参考来源:https://stackoverflow.com/questions/39175016/how-to-turn-off-sonarlint-automatic-triggering-on-intellij-idea

原文地址:https://www.cnblogs.com/passedbylove/p/12124004.html

时间: 2024-11-09 16:59:40

IDEA中关闭sonar代码质量检测的相关文章

基于docker搭建sonar代码质量检测平台

最近有点忙,好久不写博文了,今天听一个同事说之前他们的代码review都是人工来弄的,这多累,于是我赶紧搭建一个sonar代码质量检测平台给大家用用 docker环境搭建什么的就不说了.网上很多,直接上核心命令 第一条是docker 运行一个pgsql 第二条是docker 运行一个sonar docker run -d --name pgdb -e POSTGRES_USER=sonar -e POSTGRES_PASSWORD=sonar -v /data/pgdata:/var/lib/p

sonar的安装与代码质量检测实例

说明:sonar依赖数据库. mysql优化 1.笔者使用的是mysql数据库.首先对mysql做简单的优化配置. [[email protected] bin]# cat /etc/my.cnf [mysqld] max_allowed_packet=10M datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent

Jenkins中部署Sonar代码检查

1 安装并启动sonarqube docker pull sonarqube:7.5-community docker run --name sonarqube --network ci --ip 172.18.0.16 -p 9000:9000 -d sonarqube:7.5-community 访问http://ip:9000即可打开sonarqube页面,默认用户名密码是admin/admin,然后生成Tokens 这个Tokens用于和Jenkins进行交互 2 在Jenkins中配置

Jenkins 集成Sonar代码质量扫描

Jenkins上安装插件 在jenkins插件安装界面安装: 插件名 SonarQube Scanner for Jenkins Jenkins上配置 jenkins中操作:系统管理-系统设置,找到 SonarQube servers 部分,填写如下 jenkins中操作:系统管理-全局工具配置找到 SonarQube Scanner部分,填写如下 选择自己的项目(ces)-构建触发器-构建-execute sonarqube scanner,将配置文件的内容修改成如下格式填写完成后点保存: 可

ant+sonar+jacoco代码质量代码覆盖率扫描

使用ant构建的java web项目如何做sonar代码质量扫描?以下就是实际遇到并成功使用的案例一.做sonar扫描的准备工作    1.给web项目增加build.xml构建脚本.    2.下载jar包:jacocoant.jar:sonar-ant-task-2.2.jar    3.搭建一个sonar服务器二.在build.xml中编写jacoco和sonar的脚本 案例的build.xml脚本 <?xml version="1.0" encoding="UT

钉钉(dingding)的sonar(代码质量管理工具的)集成通知

代码地址: https://gitee.com/chejiangyi/dingding-sonar 钉钉(dingding)的sonar(代码质量管理工具的)集成通知,非常简单的一个小工具. 钉钉的sonar集成通知 项目部署 #下载release包 /releases/dingding-sonar-1.0-SNAPSHOT.jar wget https://gitee.com/chejiangyi/dingding-sonar/repository/archive/master.zip unz

一小时写给同组的如何使用工具检测代码质量

因为要做个小项目,同组的同事都比较年轻,为了规范下代码,因此简单的写了下怎么提高代码质量,分享一下: 在接口不通的情况下进行单元测试 使用Mockito, 如果获取余额部分代码为: public class PayServiceImpl implements PayService { private BizPayService bizPayService; @Override public BigDecimal getBalance(String pin) { try { return bizP

Java代码质量监控工具Sonar安装

1.  代码质量七宗罪 Sonar是一个代码质量管理系统,它的帮助文档开篇明义,提出了代码质量的七宗罪,总结的比较到位,不妨一看: 1.        Bug和隐藏Bug(Bugs and Potential Bugs) 2.        违反编码规范(Coding Standards Breach) 3.        复制粘贴(Duplications) 4.        缺乏单元测试(Lack of Unit Tests) 5.        恶劣的复杂度分布(Bad Distribu

Findbug在项目中的运用--提高代码质量

 FindBugs是一个静态分析工具,它检查类或者 JAR文件,将字节码与一组缺陷模式进行对比以发现可能的问题.有了静态分析工具,就可以在不实际运行程序的情况对软件进行分析 第一 手动安装 在Eclipse点击菜单中Help-->菜单 第二:输入地址: http://findbugs.cs.umd.edu/eclipse,出现版本列表: 按照一步步提示安装重启即可 =================================================== 2) (Re-)star