sonarqube typescript plugin:“您必须安装支持该语言的插件" [英] sonarqube typescript plugin: "You must install a plugin that supports the language"

查看:41
本文介绍了sonarqube typescript plugin:“您必须安装支持该语言的插件"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置 SonarQube 以使用此插件分析我的 TypeScript 项目:https://github.com/Pablissimo/SonarTsPlugin

I'm trying to setup SonarQube to analyse my TypeScript project using this plugin: https://github.com/Pablissimo/SonarTsPlugin

但是,我遇到了如下错误:

However, I'm encountering an error like:

> C:sonarqubesonar-runner-2.4insonar-runner.bat
...
INFO: 
------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 3.006s
Final Memory: 18M/613M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: You must install a plugin that supports the language 'typescript'
ERROR:
ERROR: To see the full stack trace of the errors, re-run SonarQube Runner with the -e switch.
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.

我的设置:- Windows 7 64 位- JDK8 (1.8.0) 64 位- SonarQube 5.1 64 位

My setup: - Windows 7 64 bit - JDK8 (1.8.0) 64 bit - SonarQube 5.1 64 bit

我已经从源代码构建了插件,并将生成的 .jar 文件复制到我的 SonarQube 安装中,位于 C:sonarqubesonarqube-5.1extensionspluginssonar-typescript-plugin-0.1-SNAPSHOT.罐子.

I've built the plugin from source, and copied the resulting .jar file to my SonarQube installation at C:sonarqubesonarqube-5.1extensionspluginssonar-typescript-plugin-0.1-SNAPSHOT.jar.

SonarQube 正在运行并服务于端口 9000,我可以在 Settings->System->UpdateCenter 看到安装了 TypeScript 插件,语言关键字 typescript.

SonarQube is running and serving to port 9000, and I can see at Settings->System->UpdateCenter that the TypeScript plugin is installed, with language keyword typescript.

基于 这篇文章,看来我必须:

登录到您的 Sonar 实例,点击您要使用的语言标题顶部的设置">质量配置文件"和创建".

Login to your Sonar instance, click on "Settings" > "Quality profiles" and "Create" on top of the heading for the language you want to use.

查看这些设置,我看到一个 Typescript Profiles 标题,其中定义了一个 TsLint 配置文件并设置为默认值.

Looking at those settings, I see a Typescript Profiles heading, with a TsLint profile defined and set to Default.

最后,在我的项目根目录下,我有一个文件 sonar-project.properties

Finally, in my project root directory, I have a file sonar-project.properties

# Required metadata
sonar.projectKey=my-ts-project
sonar.projectName=A TypeScript Project
sonar.projectVersion=1.0

# Comma-separated paths to directories with sources (required)
sonar.sources=src

# Language
sonar.language=typescript

# Encoding of the source files
sonar.sourceEncoding=UTF-8

所有这些配置到位后,我仍然收到 sonar-runner 错误您必须安装支持该语言的插件".

With all this configuration in place, I still receive the sonar-runner error "You must install a plugin that supports the language".

我错过了什么?

我尝试安装 JavaScript 插件,但遇到了同样的问题.所以这不仅限于 TypeScript.我可以针对 Java 项目运行 Sonar,但似乎没有其他语言可以工作.

I tried installing the JavaScript plugin, and I'm seeing the same problem. So this isn't limited to TypeScript. I can run Sonar against Java projects, but no other languages seem to work.

推荐答案

好的,我想出了如何解决这个具体问题.我的 sonar-project.properties 中的键 sonar.language 应设置为 ts,而不是 typescript.

Okay, I figured out how to solve this specific problem. The key sonar.language in my sonar-project.properties should be set to ts, not typescript.

# Language
sonar.language=ts

我通过查看与 javascript 插件对应的示例项目发现了这一点:https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/javascript/javascript-sonar-runner/sonar-project.properties.在这里,语言设置为 js 而不是 javascript.

I figured this out by looking at example project corresponding to the javascript plugin: https://github.com/SonarSource/sonar-examples/blob/master/projects/languages/javascript/javascript-sonar-runner/sonar-project.properties. Here, the language is set to js not javascript.

我不得不猜测,一般来说,语言键应该设置为源文件的正常文件扩展名?即 Java -> .java, JavaScript -> .js, TypeScript -> .ts ...如果是这样,那并不明显.有什么办法可以证实这个预感?

I have to guess that, in general, the language key should be set to the normal file extension for source files? i.e. Java -> .java, JavaScript -> .js, TypeScript -> .ts ... If so, well that's not obvious. Is there any way to confirm this hunch?

这篇关于sonarqube typescript plugin:“您必须安装支持该语言的插件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆