问题描述
自上周五(2016 年 4 月 1 日)以来,我们公司一直在使用 sonarqube.不知何故,我们项目的一个问题已经全部关闭(实际上没有得到修复).现在该项目没有任何问题.我们甚至删除了 sonarqube 中的项目并重新开始分析,这也没有给出任何问题.
Since last Friday (04/01/2016) we are using sonarqube in our company. Somehow one of our project's issues got all closed (without actually being fixed). And now the project doesn't get any issues back. we even deleted the project in sonarqube and restarted an analysis, this also gives no issues.
我们尝试了许多不同的方法来解决问题(即使是故意出错,但这也不会在sonarqube中产生任何问题)
We tried many different things to get the issues back (even making errors on purpose, but this also doesn't generate any issues in sonarqube)
我们正在运行最新版本的 sonarqube(5.4 版),我们从 TFS 2015 开始分析(使用 sonarqube 开始和结束构建步骤)
We are running the newest version of sonarqube (Version 5.4) and we start our analysis from TFS 2015 (using the sonarqube start and end build steps)
知道为什么 sonarqube 没有解决这个项目中的任何问题吗?而其他项目运行良好?
Any idea why sonarqube does not reconize any issues in this project? while other projects are working fine?
更新:
这发生在我们为此构建启用代码覆盖之后.但禁用代码覆盖并不会导致问题再次出现(即使在删除 sonarqube 项目之后也不会)
This happend after we enabled Code coverage for this build.but disabling the code coverage does not bring the issues back (not even after deleting the sonarqube project)
更新 2:
开始记录
2016-04-01T13:52:46.3608006Z Executing the powershell script: D:TFSAgents asksSonarQubePreBuild1.0.34SonarQubePreBuild.ps1
2016-04-01T13:52:48.8767055Z ##[debug]
2016-04-01T13:52:49.1486023Z SonarQube Scanner for MSBuild 1.1
2016-04-01T13:52:49.2491975Z Default properties file was not found at D:TFSAgents asksSonarQubePreBuild1.0.34MSBuild.SonarQube.Runner-1.1SonarQube.Analysis.xml
2016-04-01T13:52:49.2491975Z Pre-processing started.
2016-04-01T13:52:49.2501934Z Preparing working directories...
2016-04-01T13:52:49.2501934Z Checking for updates...
2016-04-01T13:52:49.4643435Z SonarQube Scanner for MSBuild Begin Step 2.0
2016-04-01T13:52:49.4653311Z 15:52:49.298 Default properties file was not found at D:TFSAgents\_work2.sonarqubeinSonarQube.Analysis.xml
2016-04-01T13:52:49.4812668Z 15:52:49.318 Updating build integration targets...
2016-04-01T13:52:49.5728988Z 15:52:49.34 Fetching analysis configuration settings...
2016-04-01T13:52:50.6017668Z 15:52:50.48 Generating rulesets...
2016-04-01T13:52:52.4025329Z 15:52:52.298 Provisioning analyzer assemblies...
2016-04-01T13:52:52.4025329Z 15:52:52.3 Installing required Roslyn analyzers...
2016-04-01T13:52:52.4035284Z Pre-processing succeeded.
结束日志
2016-04-01T13:53:07.9072565Z Executing the powershell script: D:TFSAgents asksSonarQubePostTest1.0.36SonarQubePostTest.ps1
2016-04-01T13:53:13.0399547Z SonarQube Scanner for MSBuild 1.1
2016-04-01T13:53:13.0439418Z Default properties file was not found at D:TFSAgents asksSonarQubePreBuild1.0.34MSBuild.SonarQube.Runner-1.1SonarQube.Analysis.xml
2016-04-01T13:53:13.0439418Z Post-processing started.
2016-04-01T13:53:13.2623017Z SonarQube Scanner for MSBuild End Step 2.0
2016-04-01T13:53:13.2632986Z 15:53:13.185 Fetching code coverage report information from TFS...
2016-04-01T13:53:13.2632986Z 15:53:13.188 Attempting to locate a test results (.trx) file...
2016-04-01T13:53:13.2632986Z 15:53:13.188 Located a test results file: D:TFSAgents\_work2TestResults********_DENHELDER 2016-04-01 15_53_04.trx
2016-04-01T13:53:13.3739732Z WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:Users********AppDataLocalTemp.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterTests******.Tools.UrlNameSetterTests.csproj
2016-04-01T13:53:13.3799577Z WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:Users********AppDataLocalTemp.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetter******.Tools.UrlNameSetter.csproj
2016-04-01T13:53:13.3849424Z SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
2016-04-01T13:53:13.3899308Z Calling the SonarQube Scanner...
2016-04-01T13:53:13.6152663Z D:TFSAgents\_work2.sonarqubeinsonar-runnerin..
2016-04-01T13:53:13.8206640Z SonarQube Runner 2.4
2016-04-01T13:53:13.8206640Z Java 1.8.0_77 Oracle Corporation (64-bit)
2016-04-01T13:53:13.8206640Z Windows Server 2012 R2 6.3 amd64
2016-04-01T13:53:13.8216606Z SONAR_RUNNER_OPTS=-Xmx1024m
2016-04-01T13:53:13.8216606Z INFO: Error stacktraces are turned on.
2016-04-01T13:53:13.8216606Z INFO: Runner configuration file: D:TFSAgents\_work2.sonarqubeinsonar-runnerin..confsonar-runner.properties
2016-04-01T13:53:13.8226578Z INFO: Project configuration file: D:TFSAgents\_work2.sonarqubeoutsonar-project.properties
2016-04-01T13:53:13.9243592Z INFO: Default locale: "en_US", source code encoding: "UTF-8"
2016-04-01T13:53:13.9243592Z INFO: Work directory: D:TFSAgents\_work2.sonarqubeout.sonar
2016-04-01T13:53:14.0270583Z INFO: SonarQube Server 5.4
2016-04-01T13:53:15.4718195Z 15:53:15.217 INFO - Load global repositories
2016-04-01T13:53:16.8497760Z 15:53:16.772 INFO - Load global repositories (done) | time=1551ms
2016-04-01T13:53:16.9504838Z 15:53:16.848 INFO - User cache: C:Users********.sonarcache
2016-04-01T13:53:17.5657725Z 15:53:17.407 INFO - Load plugins index
2016-04-01T13:53:17.5666818Z 15:53:17.419 INFO - Load plugins index (done) | time=12ms
2016-04-01T13:53:19.8280384Z 15:53:19.693 INFO - Process project properties
2016-04-01T13:53:19.9287435Z 15:53:19.829 INFO - Load project repositories
2016-04-01T13:53:20.4322672Z 15:53:20.341 INFO - Load project repositories (done) | time=512ms
2016-04-01T13:53:20.5489246Z 15:53:20.379 INFO - Apply project exclusions
2016-04-01T13:53:20.5489246Z 15:53:20.447 INFO - Load quality profiles
2016-04-01T13:53:20.7553157Z 15:53:20.614 INFO - Load quality profiles (done) | time=167ms
2016-04-01T13:53:20.7563196Z 15:53:20.620 INFO - Load active rules
2016-04-01T13:53:22.6338067Z 15:53:22.584 INFO - Load active rules (done) | time=1964ms
2016-04-01T13:53:22.6348044Z 15:53:22.597 WARN - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
2016-04-01T13:53:22.6348044Z 15:53:22.597 INFO - Publish mode
2016-04-01T13:53:22.6348044Z 15:53:22.606 INFO - ------------- Scan ******.Tools.UrlNameSetterTests
2016-04-01T13:53:22.9419040Z 15:53:22.840 INFO - Load server rules
2016-04-01T13:53:23.1502914Z 15:53:23.109 INFO - Load server rules (done) | time=269ms
2016-04-01T13:53:23.2599703Z 15:53:23.202 INFO - Base dir: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterTests
2016-04-01T13:53:23.2599703Z 15:53:23.202 INFO - Working dir: D:TFSAgents\_work2.sonarqubeout.sonar******.Tools_******.Tools_2AAE705C-6532-43CC-AE13-50D0CAF50141
2016-04-01T13:53:23.2609672Z 15:53:23.204 INFO - Test paths: Properties/AssemblyInfo.cs, DealAndOrganisationTests.cs, UrlNameConversionTests.cs
2016-04-01T13:53:23.2609672Z 15:53:23.204 INFO - Source encoding: UTF-8, default locale: en_US
2016-04-01T13:53:23.2609672Z 15:53:23.205 INFO - Index files
2016-04-01T13:53:23.3616718Z 15:53:23.258 INFO - 3 files indexed
2016-04-01T13:53:23.3626689Z 15:53:23.267 INFO - Quality profile for cs: Sonar way
2016-04-01T13:53:24.1164564Z 15:53:23.921 INFO - JaCoCoSensor: JaCoCo report not found : D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterTests argetjacoco.exec
2016-04-01T13:53:24.1174530Z 15:53:23.921 INFO - JaCoCoItSensor: JaCoCo IT report not found: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterTests argetjacoco-it.exec
2016-04-01T13:53:24.1184497Z 15:53:23.948 INFO - Sensor Lines Sensor
2016-04-01T13:53:24.1184497Z 15:53:23.948 INFO - Sensor Lines Sensor (done) | time=0ms
2016-04-01T13:53:24.1184497Z 15:53:23.948 INFO - Sensor QProfileSensor
2016-04-01T13:53:24.1214418Z 15:53:23.975 INFO - Sensor QProfileSensor (done) | time=27ms
2016-04-01T13:53:24.1214418Z 15:53:23.975 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor
2016-04-01T13:53:24.1214418Z 15:53:23.992 INFO - Parsing the Visual Studio coverage XML report D:TFSAgents\_work2TestResults********_DENHELDER 2016-04-01 15_53_04InDENHELDER********_DENHELDER 2016-04-01 15_53_01.coveragexml
2016-04-01T13:53:24.4265478Z 15:53:24.342 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor (done) | time=367ms
2016-04-01T13:53:24.4275513Z 15:53:24.342 INFO - Sensor SCM Sensor
2016-04-01T13:53:24.4275513Z 15:53:24.342 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
2016-04-01T13:53:24.4275513Z 15:53:24.342 INFO - Sensor SCM Sensor (done) | time=0ms
2016-04-01T13:53:24.4295382Z 15:53:24.342 INFO - Sensor Code Colorizer Sensor
2016-04-01T13:53:24.5412175Z 15:53:24.423 INFO - Sensor Code Colorizer Sensor (done) | time=80ms
2016-04-01T13:53:24.5412175Z 15:53:24.423 INFO - Sensor CPD Sensor
2016-04-01T13:53:24.5422081Z 15:53:24.423 INFO - DefaultCpdIndexer is used for cs
2016-04-01T13:53:24.5422081Z 15:53:24.423 INFO - Sensor CPD Sensor (done) | time=0ms
2016-04-01T13:53:24.5422081Z 15:53:24.424 INFO - ------------- Scan ******.Tools.UrlNameSetter
2016-04-01T13:53:24.5432050Z 15:53:24.449 INFO - Base dir: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetter
2016-04-01T13:53:24.5432050Z 15:53:24.449 INFO - Working dir: D:TFSAgents\_work2.sonarqubeout.sonar******.Tools_******.Tools_B15194FA-CD32-45C0-AF33-0159CBB19695
2016-04-01T13:53:24.5432050Z 15:53:24.449 INFO - Source paths: UrlNameHelper.cs, Properties/AssemblyInfo.cs
2016-04-01T13:53:24.5442026Z 15:53:24.449 INFO - Source encoding: UTF-8, default locale: en_US
2016-04-01T13:53:24.5442026Z 15:53:24.449 INFO - Index files
2016-04-01T13:53:24.6449078Z 15:53:24.495 INFO - 2 files indexed
2016-04-01T13:53:24.6459034Z 15:53:24.495 INFO - Quality profile for cs: Sonar way
2016-04-01T13:53:24.6459034Z 15:53:24.515 INFO - All FxCop rules are disabled, skipping its execution.
2016-04-01T13:53:24.6459034Z 15:53:24.515 INFO - JaCoCoSensor: JaCoCo report not found : D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetter argetjacoco.exec
2016-04-01T13:53:24.6469042Z 15:53:24.515 INFO - JaCoCoItSensor: JaCoCo IT report not found: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetter argetjacoco-it.exec
2016-04-01T13:53:24.6469042Z 15:53:24.517 INFO - Sensor Lines Sensor
2016-04-01T13:53:24.6469042Z 15:53:24.519 INFO - Sensor Lines Sensor (done) | time=2ms
2016-04-01T13:53:24.6478973Z 15:53:24.519 INFO - Sensor QProfileSensor
2016-04-01T13:53:24.6478973Z 15:53:24.519 INFO - Sensor QProfileSensor (done) | time=0ms
2016-04-01T13:53:24.6478973Z 15:53:24.519 INFO - Sensor org.sonar.plugins.csharp.CSharpSensor
2016-04-01T13:53:25.4116570Z 15:53:25.191 INFO - SonarLint for Visual Studio version 1.10.0.0
2016-04-01T13:53:25.6130664Z 15:53:25.424 INFO - 0/2 files analyzed, starting to analyze: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterPropertiesAssemblyInfo.cs
2016-04-01T13:53:26.5214017Z 15:53:26.447 INFO - 1/2 files analyzed, starting to analyze: D:TFSAgents\_work2sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterUrlNameHelper.cs
2016-04-01T13:53:26.7729445Z 15:53:26.658 INFO - Sensor org.sonar.plugins.csharp.CSharpSensor (done) | time=2139ms
2016-04-01T13:53:26.7876203Z 15:53:26.658 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor
2016-04-01T13:53:26.8344834Z 15:53:26.658 INFO - Parsing the Visual Studio coverage XML report D:TFSAgents\_work2TestResults********_DENHELDER 2016-04-01 15_53_04InDENHELDER********_DENHELDER 2016-04-01 15_53_01.coveragexml
2016-04-01T13:53:26.8454502Z 15:53:26.670 INFO - Sensor org.sonar.plugins.csharp.CSharpCodeCoverageProvider$CSharpCoverageReportImportSensor (done) | time=12ms
2016-04-01T13:53:26.8534260Z 15:53:26.670 INFO - Sensor SCM Sensor
2016-04-01T13:53:26.8544235Z 15:53:26.670 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
2016-04-01T13:53:26.8544235Z 15:53:26.670 INFO - Sensor SCM Sensor (done) | time=0ms
2016-04-01T13:53:26.8544235Z 15:53:26.670 INFO - Sensor Code Colorizer Sensor
2016-04-01T13:53:26.8554207Z 15:53:26.678 INFO - Sensor Code Colorizer Sensor (done) | time=8ms
2016-04-01T13:53:26.8554207Z 15:53:26.678 INFO - Sensor CPD Sensor
2016-04-01T13:53:26.8564173Z 15:53:26.679 INFO - DefaultCpdIndexer is used for cs
2016-04-01T13:53:26.9591176Z 15:53:26.718 INFO - Sensor CPD Sensor (done) | time=40ms
2016-04-01T13:53:26.9601149Z 15:53:26.719 INFO - ------------- Scan UrlNameSetter
2016-04-01T13:53:26.9601149Z 15:53:26.732 INFO - Base dir: D:TFSAgents\_work2s
2016-04-01T13:53:26.9601149Z 15:53:26.732 INFO - Working dir: D:TFSAgents\_work2.sonarqubeout.sonar
2016-04-01T13:53:26.9611114Z 15:53:26.732 INFO - Source encoding: UTF-8, default locale: en_US
2016-04-01T13:53:26.9611114Z 15:53:26.746 INFO - JaCoCoSensor: JaCoCo report not found : D:TFSAgents\_work2s argetjacoco.exec
2016-04-01T13:53:26.9611114Z 15:53:26.746 INFO - JaCoCoItSensor: JaCoCo IT report not found: D:TFSAgents\_work2s argetjacoco-it.exec
2016-04-01T13:53:26.9621086Z 15:53:26.748 INFO - Sensor Lines Sensor
2016-04-01T13:53:26.9621086Z 15:53:26.748 INFO - Sensor Lines Sensor (done) | time=0ms
2016-04-01T13:53:26.9621086Z 15:53:26.748 INFO - Sensor SCM Sensor
2016-04-01T13:53:26.9621086Z 15:53:26.748 INFO - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
2016-04-01T13:53:26.9631057Z 15:53:26.748 INFO - Sensor SCM Sensor (done) | time=0ms
2016-04-01T13:53:26.9631057Z 15:53:26.748 INFO - Sensor Code Colorizer Sensor
2016-04-01T13:53:26.9631057Z 15:53:26.748 INFO - Sensor Code Colorizer Sensor (done) | time=0ms
2016-04-01T13:53:26.9641027Z 15:53:26.748 INFO - Sensor CPD Sensor
2016-04-01T13:53:26.9641027Z 15:53:26.748 INFO - Sensor CPD Sensor (done) | time=0ms
2016-04-01T13:53:26.9641027Z 15:53:26.866 INFO - Analysis report generated in 103ms, dir size=46 KB
2016-04-01T13:53:26.9651084Z 15:53:26.882 INFO - Analysis reports compressed in 16ms, zip size=18 KB
2016-04-01T13:53:27.4746044Z 15:53:27.205 INFO - Analysis report uploaded in 322ms
2016-04-01T13:53:27.4746044Z 15:53:27.206 INFO - ANALYSIS SUCCESSFUL, you can browse http://sonarqube:9000/dashboard/index/******.Tools
2016-04-01T13:53:27.4756021Z 15:53:27.206 INFO - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2016-04-01T13:53:27.4756021Z 15:53:27.206 INFO - More about the report processing at http://sonarqube:9000/api/ce/task?id=AVPSGZxz3AQs4Fy3Ol1M
2016-04-01T13:53:27.5842827Z INFO: ------------------------------------------------------------------------
2016-04-01T13:53:27.5852796Z INFO: EXECUTION SUCCESS
2016-04-01T13:53:27.5852796Z INFO: ------------------------------------------------------------------------
2016-04-01T13:53:27.5852796Z Total time: 13.674s
2016-04-01T13:53:27.5862785Z Final Memory: 11M/249M
2016-04-01T13:53:27.5862785Z INFO: ------------------------------------------------------------------------
2016-04-01T13:53:27.5862785Z The SonarQube Scanner has finished
2016-04-01T13:53:27.5872738Z 15:53:27.529 Creating a summary markdown file...
2016-04-01T13:53:27.5872738Z 15:53:27.53 Analysis results: http://sonarqube:9000/dashboard/index/******.Tools
2016-04-01T13:53:27.5872738Z Post-processing succeeded.
2016-04-01T13:53:27.6012315Z The build was not set to fail if the associated quality gate fails.
更新 3:
后台日志
更新 4:
看起来是 c# profiler 的问题,我们现在添加了一些 Asp.net mvc 项目,并且基于 javascript 和 css profiler 得到了很多问题,但是有 0 个 c# 问题(这非常不可信)
It looks like its a problem with the c# profiler, we now added some Asp.net mvc projects and get a lot of issues based on the javascript and css profiler, however there are 0 c# issues (which is higly unlikly)
更新 5:
浏览 TFS 构建的日志,我看到某处 sonarqube 问题已针对 c# 进行了重新处理,但最终并未出现在 sonarqube 本身的示例中:
browsing the logs of the TFS build im seeing that somewhere sonarqube issues are reqonized for c#, but they don't end up in sonarqube itself example:
UrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetterUrlNameHelper.cs(31,13): Warning S1067: Reduce the number of conditional operators (4) used in the expression (maximum allowed 3).
2>UrlNameHelper.cs(31,13): warning S1067: Reduce the number of conditional operators (4) used in the expression (maximum allowed 3). [D:TFSAgentsAgent-47\_work4sUrlNameSetterDev******.Tools.UrlNameSetter******.Tools.UrlNameSetter******.Tools.UrlNameSetter.csproj]
更新 6:
我找到了一个 roslyn json 日志文件(在最终过程中引用),其中还包含 sonarqube 应该看到的问题
i found a roslyn json log file (refrenced in the end proces) which also contains the issues that sonarqube should see
粘贴到 ******.Tools.UrlNameSetter.dll.RoslynCA.json
更新 7:
我完全重新安装了 sonarqube,但这没有任何效果.因此我开始认为这个问题是由 tfs 2015 内置的 sonarqube runner 引起的
i jsut completly reinstalled sonarqube, but this had no effect. therefor im starting to think that the issue is beeing caused by the sonarqube runner build in with tfs 2015
更新 8:
现在我很确定这不是 sonarqube 安装,我在我的开发电脑上运行了 sonarqube,这确实给 sonarqube 带来了问题...搜索继续
Now i'm defenatly sure its not the sonarqube instalation, i ran a sonarqube run on my dev pc and that did put issues in sonarqube... The search continues
推荐答案
感谢@fluf,我们发现安装 Visual Studio 2015 更新 2 导致了这些问题.
Thanks to @fluf we found out that the install of visual studio 2015 update 2 caused these problems.
这里的根本问题仍然未知,但它现在正在起作用.
What the root issue is here is still unkown, but its working now.
解决方法:删除 Visual Studio 2015 的更新 2 安装,并将其替换为更新 1 或没有更新的更新.两者都可以很好地执行构建并在 TFS 中生成代码覆盖率文件.
Workaround: Remove the update 2 installation of visual studio 2015 and replace it with either the update 1 or the one without the updates. Both work well enough to preform the builds en generate the code coverage files in TFS.
这篇关于Sonarqube 未注册任何 c# 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!