IDEA中关闭sonar代码质量检测

Posted passedbylove

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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:developJavajdk1.8.0_181injava.exe -Dmaven.multiModuleProjectDirectory=F:xxxSRCweb -Dmaven.home=D:developapache-maven-3.5.4 
-Dclassworlds.conf=D:developapache-maven-3.5.4inm2.conf -Dfile.encoding=UTF-8
-classpath D:developapache-maven-3.5.4ootplexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher
-Didea.version=2018.3.4 -s D:developapache-maven-3.5.4confsettings.xml
-Dmaven.repo.local=D:developapache-maven-3.5.4 epo 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:UsersAdministrator.sonarcache [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:UsersAdministrator.sonarcache [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:xxxSRCweb [INFO] Working dir: F:xxxSRCweb argetsonar [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

以上是关于IDEA中关闭sonar代码质量检测的主要内容,如果未能解决你的问题,请参考以下文章

idea 集成sonarLint

如何在导航控件片段中关闭导航 DrawerLayout onBackPressed

如何检测在 $modal 中关闭模式窗口?角度-ui

idea中关闭当前文件快捷键

如何从另一个活动或底部工作表对话框/片段中关闭一个活动

如何在idea中关闭vim模式