sonarqube typescript plugin: "You must install a plugin that supports the language"

laffoyb picture laffoyb · May 14, 2015 · Viewed 18.4k times · Source

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:\sonarqube\sonar-runner-2.4\bin\sonar-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.

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

I've built the plugin from source, and copied the resulting .jar file to my SonarQube installation at C:\sonarqube\sonarqube-5.1\extensions\plugins\sonar-typescript-plugin-0.1-SNAPSHOT.jar.

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.

Based on this post, it seems I must:

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

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

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

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

What am I missing?

edit:

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.

Answer

laffoyb picture laffoyb · May 14, 2015

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

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.

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?