Analyse Typescript with SonarQube
Asked Answered
V

3

10

I'm using node_modules/codelyzer to analyze my source code Typescript. I define manually rules in tslint.json file.

But it is possible to analyze Typescript with SonarQube?

Vitals answered 23/3, 2017 at 11:12 Comment(1)
As of Aug 22, 2017 it looks like the SonarQube team released SonarTS v1.0. Note: this is different than Pablissimo's SonarTsPlugin.Grasp
P
8

You can use a plugin developed by the SonarQube community to support TypeScript.

You will find it on the "Other Plugins" page on the official SonarQube Plugin Library.

Phraseology answered 24/3, 2017 at 10:8 Comment(0)
T
4

Just to chime in as I did not see the TypeScript plugin on that page. This one seems to be useful: https://github.com/Pablissimo/SonarTsPlugin

Thresher answered 25/6, 2017 at 14:33 Comment(1)
Note that the SonarQube Plugin Library ref'd in @fabrice-sonarsource-team post points to Pablissimo's source on GitHub.Grasp
J
0

Just in case you are building using Visual Studio 2017, you can use the SonarScanner for MSBuild 4.2 to build the .NET Core project(s) that contain your Typescript source code.

For example in this case, the following commands are in a package.json file for an Angular project:

package.json file for an Angular project

Set the following commands to be executed during build in the .csproj file:

enter image description here

You can then use the .NET Core dotnet build/publish tasks to build the project.

After that, end the SonarScanner and analyse the results on SonarQube. You may see Typescript, Javascript and a bunch of other languages that you may have in your project. Using the VSTS CI tasks makes this uber easy.

Jauch answered 6/6, 2018 at 11:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.