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

猜你喜欢

转载自www.cnblogs.com/passedbylove/p/12124004.html