简体   繁体   English

SonarQube Runner在Asp.Net MVC解决方案中跳过JavaScript个文件

[英]SonarQube Runner skips JavaScript files in Asp.Net MVC solution

It was a long WTF moment and I could not find any information on the issue, so I decided I put it here.这是一个很长的 WTF 时刻,我找不到关于这个问题的任何信息,所以我决定把它放在这里。

Setup : Windows 7 x86_64, sonarqube-4.3, sonar-runner-2.4, jre 1.7.0_55-b14设置:Windows 7 x86_64、sonarqube-4.3、sonar-runner-2.4、jre 1.7.0_55-b14

I followed quick start guide to configure Sonar.我按照快速入门指南配置声纳。

I copied sonar-project.properties from a sample to my solution, put it in the directory with.sln, and made necessary adjustments:我将示例中的 sonar-project.properties 复制到我的解决方案中,将其放在 with.sln 目录中,并进行了必要的调整:

sonar.projectKey=org.whatever.project sonar.projectKey=org.whatever.project
sonar.projectName=Project sonar.projectName=项目
sonar.projectVersion=2.0声纳.projectVersion=2.0
sonar.sourceEncoding=UTF-8声纳.sourceEncoding=UTF-8
sonar.sources=. sonar.sources=.
sonar.visualstudio.enable=true sonar.visualstudio.enable=true

Problem : Analysis ran without any exceptions but only C# files were analyzed.问题:分析运行无任何异常,但仅分析了 C# 个文件。

Long story short, following line in config was causing the issue: 长话短说,配置中的以下行引起了该问题:

sonar.sources=. sonar.sources =。

After moving sonar-project.properties one level up and changing it accordingly, the problem was resolved. 将sonar-project.properties上移一个级别并进行相应更改后,问题得以解决。

sonar.sources=src sonar.sources = src

I think it actually relates to the usage of the Visual Studio Bootstrapper. 我认为这实际上与Visual Studio Bootstrapper的用法有关。 Can you try the same without it? 如果没有它,您可以尝试相同吗?

Here is what happens: The Visual Studio bootstrapper reads all the <Compile> tags from the *.csproj files to determine which files must be imported. 这是发生的情况:Visual Studio引导程序从* .csproj文件读取所有<Compile>标记,以确定必须导入的文件。 Javascript files are not referenced by <Compile> (as they do not need to be compiled), and will therefore not be imported in SonarQube. <Compile>不会引用Javascript文件(因为它们不需要编译),因此不会导入SonarQube。

See this related Jira ticket: https://jira.codehaus.org/browse/SONARVS-27 看到这张相关的吉拉票: https : //jira.codehaus.org/browse/SONARVS-27

Why someone needs to copy and paste the SonarQube properties for code analysis of a ASp.NET/C#/VB.NET project.为什么有人需要复制和粘贴 SonarQube 属性来对 ASp.NET/C#/VB.NET 项目进行代码分析。

You simply watch this video that how to install and configure the SonarQube, SonarQube MSBuild Scanner and run a code analysis by your own.您只需观看此视频,了解如何安装和配置 SonarQube、SonarQube MSBuild Scanner 并自行运行代码分析。

https://youtu.be/8zMJ8gusQ34 https://youtu.be/8zMJ8gusQ34

Also, always try to use the latest download from SonarQube Community Edition from official site.此外,请始终尝试使用官方网站上 SonarQube 社区版的最新下载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM