我将尝试使用 SonarQube SonarTS 插件在我的项目中分析 TypeScript 文件。
它包含一个包含一些图像、一些 xml 和几个 .ts 文件的子模块。我在 SonarQube 中安装了 SonarTS ( https://docs.sonarqube.org/display/PLUG/SonarTS )。该项目使用 typescript 2.4.2 作为 devDependency,并使用 Node 6.13.1 构建。
当我调用 mvn sonar:sonar -Dsonar.branch=<BRANCHNAME>
(我知道 sonar.branch 已被弃用,我会尽快修复 :)),最终扫描了总和模块,这是日志:
[INFO] ------------- Scan MyProject
[INFO] Base dir: /home/jenkins/workspace/my-project/my-project-config-model
[INFO] Working dir: /home/jenkins/workspace/my-project/my-project-config-model/target/sonar
[INFO] Source paths: pom.xml
[INFO] Source encoding: UTF-8, default locale: en_US
[INFO] Index files
[INFO] 1 file indexed
[INFO] Quality profile for xml: Sonar way
[INFO] Sensor Embedded CSS Analyzer Sensor [css]
[INFO] 0 source files to be analyzed
[INFO] Sensor Embedded CSS Analyzer Sensor [css] (done) | time=1ms
[INFO] Sensor SonarJavaXmlFileSensor [java]
[INFO] 0/0 source files have been analyzed
[INFO] 1 source files to be analyzed
[INFO] Sensor SonarJavaXmlFileSensor [java] (done) | time=31ms
[INFO] 1/1 source files have been analyzed
[INFO] Sensor XML Sensor [xml]
[INFO] Sensor XML Sensor [xml] (done) | time=8ms
[INFO] SCM provider for this project is: git
[INFO] 1 files to be analyzed
[INFO] 0/1 files analyzed
唯一被扫描的文件是 pom.xml
会不会跟子模块的结构有关? xmls 和 ts 文件不在 src/main/{ts|resources}
,但是 src/models
和 src/scripts
.
提前致谢!
最佳答案
我想您需要更改 sonar.sources
参数以包含您的源文件夹(类似于 sonar.sources=src/main/java,src/models,src/scripts
应该可以工作)。
关于maven - 在 Maven 项目中分析 TypeScript SonarQube,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49322162/