typescript 使用 SonarQube 分析打字稿
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42974395/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Analyse Typescript with SonarQube
提问by mahdi kallel
I'm using node_modules/codelyzer
to analyze my source code Typescript
. I define manually rules in tslint.json
file.
我node_modules/codelyzer
用来分析我的源代码Typescript
。我在tslint.json
文件中手动定义规则。
But it is possible to analyze Typescript
with SonarQube
?
但是可以Typescript
用SonarQube
?
采纳答案by Fabrice - SonarSource Team
You can use a plugin developed by the SonarQube community to support TypeScript.
您可以使用 SonarQube 社区开发的插件来支持 TypeScript。
You will find it on the "Other Plugins" page on the official SonarQube Plugin Library.
您可以在官方SonarQube 插件库的“其他插件”页面上找到它。
回答by isaac weathers
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
只是插一句,因为我在该页面上没有看到 TypeScript 插件。这个似乎很有用:https: //github.com/Pablissimo/SonarTsPlugin
回答by Denpal Rius
Just in case you are building using Visual Studio 2017, you can use the SonarScanner for MSBuild 4.2to build the .NET Core project(s) that contain your Typescript source code.
万一您使用 Visual Studio 2017 进行构建,您可以使用MSBuild 4.2的SonarScanner来构建包含您的 Typescript 源代码的 .NET Core 项目。
For example in this case, the following commands are in a package.jsonfile for an Angular project:
例如,在本例中,以下命令位于Angular 项目的package.json文件中:
Set the following commands to be executed during buildin the .csprojfile:
在.csproj文件中设置要在构建期间执行的以下命令:
You can then use the .NET Core dotnet build/publish
tasks to build the project.
然后,您可以使用 .NET Coredotnet build/publish
任务来构建项目。
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.
之后,结束 SonarScanner 并在 SonarQube 上分析结果。您可能会在项目中看到 Typescript、Javascript 和许多其他语言。使用 VSTS CI 任务使这变得非常容易。