<bdo id='C1lz4'></bdo><ul id='C1lz4'></ul>

    <tfoot id='C1lz4'></tfoot>

  1. <i id='C1lz4'><tr id='C1lz4'><dt id='C1lz4'><q id='C1lz4'><span id='C1lz4'><b id='C1lz4'><form id='C1lz4'><ins id='C1lz4'></ins><ul id='C1lz4'></ul><sub id='C1lz4'></sub></form><legend id='C1lz4'></legend><bdo id='C1lz4'><pre id='C1lz4'><center id='C1lz4'></center></pre></bdo></b><th id='C1lz4'></th></span></q></dt></tr></i><div id='C1lz4'><tfoot id='C1lz4'></tfoot><dl id='C1lz4'><fieldset id='C1lz4'></fieldset></dl></div>

    1. <small id='C1lz4'></small><noframes id='C1lz4'>

      <legend id='C1lz4'><style id='C1lz4'><dir id='C1lz4'><q id='C1lz4'></q></dir></style></legend>

      SonarQube - C# 代码未显示在仪表板上

      时间:2023-10-24
      • <bdo id='f3pAc'></bdo><ul id='f3pAc'></ul>
        <legend id='f3pAc'><style id='f3pAc'><dir id='f3pAc'><q id='f3pAc'></q></dir></style></legend>
        <i id='f3pAc'><tr id='f3pAc'><dt id='f3pAc'><q id='f3pAc'><span id='f3pAc'><b id='f3pAc'><form id='f3pAc'><ins id='f3pAc'></ins><ul id='f3pAc'></ul><sub id='f3pAc'></sub></form><legend id='f3pAc'></legend><bdo id='f3pAc'><pre id='f3pAc'><center id='f3pAc'></center></pre></bdo></b><th id='f3pAc'></th></span></q></dt></tr></i><div id='f3pAc'><tfoot id='f3pAc'></tfoot><dl id='f3pAc'><fieldset id='f3pAc'></fieldset></dl></div>
        <tfoot id='f3pAc'></tfoot>
        • <small id='f3pAc'></small><noframes id='f3pAc'>

                  <tbody id='f3pAc'></tbody>

                本文介绍了SonarQube - C# 代码未显示在仪表板上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我在使用 SonarQube 6.7 时遇到问题,它没有显示任何 C# 代码问题或错误,在分析过程中我可以看到 C# 正在被分析并且构建成功但是当我检查 SonarQube 仪表板时它只显示 Typescript和 XML.

                I am having an issue with SonarQube 6.7 where it is not displaying any C# code issues or bugs, during the analysis I can see C# is being analysed and the build is successful but when I check the SonarQube Dashboard it is only showing Typescript and XML.

                我正在使用 Jenkins 使用 Mono 构建项目,因为我们所有的构建都是在 Ubuntu 16.04 上完成的.

                I am using Jenkins to build the project using Mono as all our building is done on Ubuntu 16.04.

                设置如下:

                Ubuntu 16.04 上的 Jenkins 2.89.2

                Ubuntu 16.04(独立服务器)上的 SonarQube 版本 6.7(内部版本 33306)

                声纳 C# 6.8.1

                适用于 MSBuild 4.0.1 的 SonarQube 扫描仪

                单声道 5.10.0 稳定版

                在 Jenkins 中使用管道我正在执行以下操作:

                Using a Pipeline In Jenkins I am doing the following:

                node {
                    sh 'mono ~/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/MSBuild/SonarQube.Scanner.MSBuild.exe begin /key:12345678FAKEKEY9l02998745'
                    sh 'dotnet restore WSP1.sln'
                    sh 'dotnet msbuild WSP1.sln'
                    sh 'mono ~/tools/hudson.plugins.sonar.MsBuildSQRunnerInstallation/MSBuild/SonarQube.Scanner.MSBuild.exe end' } }
                

                上面的管道脚本没有任何问题.

                The above pipeline script works without any issues.

                当我运行这个管道时,我可以看到正在分析 C# 代码,这只是正在分析的代码片段:

                When I run this pipeline I can see that the C# code is being Analysed, this is just a snippet of code being analysed:

                Services/Project1/Services/Project1EventsShould.cs(130,21): warning S1186: Add a nested comment explaining why this method is empty, throw a 'NotSupportedException' or complete the implementation. [/var/lib/jenkins/workspace/CSharpAnalysis/WSP1/test/Unit/Unit.csproj]
                Services/Project1/Services/Project1EventsShould.cs(137,21): warning S1186: Add a nested comment explaining why this method is empty, throw a 'NotSupportedException' or complete the implementation. [/var/lib/jenkins/workspace/CSharpAnalysis/WSP1/test/Unit/Unit.csproj]
                Services/Project1/Models/ZenEventShould.cs(24,17): warning S1481: Remove this unused 'date' local variable. [/var/lib/jenkins/workspace/CSharpAnalysis/WSP1/test/Unit/Unit.csproj]
                Services/Project1/Models/CollaborationUserShould.cs(16,17): warning S1481: Remove this unused 'sut' local variable. [/var/lib/jenkins/workspace/CSharpAnalysis/WSP1/test/Unit/Unit.csproj]
                

                最后我得到了一个成功,一切看起来都很好,但是当我检查 SonarQube 时,我可以看到上传的代码正在被分析以在 SonarQube 中显示,这通常需要一分钟左右,但完成后我可以看到仅显示 TypeScript 和 XML.

                At the end I get a SUCCESS, everything looks good but when I check SonarQube I can see that the uploaded code is being analysed for display in SonarQube, this usually takes a minute or so but when this is completed I can see that only TypeScript and XML is displayed.

                在输出中,我收到了一些警告、信息和错误,但没有什么看起来很危险,在输出的末尾我收到了成功消息

                In amongst the output I get some warnings, info and errors but nothing looks sinister, at the end of the output I get the success message

                INFO: 68 files had no CPD blocks
                INFO: Calculating CPD for 281 files
                INFO: CPD calculation finished
                INFO: Analysis report generated in 1771ms, dir size=5 MB
                INFO: Analysis reports compressed in 3908ms, zip size=2 MB
                INFO: Analysis report uploaded in 5866ms
                INFO: ANALYSIS SUCCESSFUL, you can browse http://sonar.serverdomain.com:9000/dashboard/index/12345678FAKEKEY9l02998745
                INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
                INFO: More about the report processing at http://sonar.serverdomain.com:9000/api/ce/task?id=AKsdHc7FAKEIDVOeCzBYv
                INFO: Task total time: 1:32.107 s
                INFO: ------------------------------------------------------------------------
                INFO: EXECUTION SUCCESS
                INFO: ------------------------------------------------------------------------
                INFO: Total time: 1:42.735s
                INFO: Final Memory: 54M/397M
                INFO: ------------------------------------------------------------------------
                The SonarQube Scanner has finished
                14:59:57.577  Creating a summary markdown file...
                14:59:57.59  Analysis results: http://sonar.serverdomain.com:9000/dashboard/index/12345678FAKEKEY9l02998745
                14:59:57.591  Post-processing succeeded.
                Finished: SUCCESS
                

                我手头有完整的输出,我只需要对其进行消毒以删除任何可能敏感的内容,如果您想看看,请告诉我,我会发布此内容.

                I have the full output handy, I just need to sanitize this to remove anything that may be sensitive, if you would like a look just let me know and I will post this.

                我对 SonarQube 还很陌生,所以我遇到的问题可能很愚蠢,但我一直在努力解决这个问题.

                I am pretty new to SonarQube so the issue I am having could be something silly but I have been ripping my hair out trying to figure this out.

                编辑:我再次挖掘输出并注意到以下警告:

                EDIT : I was digging through the output again and noticed 2 warning in the following:

                INFO: Quality profile for cs: Sonar way
                INFO: Quality profile for ts: Sonar way
                INFO: Quality profile for xml: Sonar way
                INFO: Sensor C# Properties [csharp]
                WARNING: WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
                WARNING: WARN: No roslyn issues report not found for this project.
                INFO: Sensor C# Properties [csharp] (done) | time=1ms
                

                推荐答案

                我刚刚在 Sonarqube 6.7.4 (build 38452) 上遇到了同样的问题.

                I just ran into the same issue on Sonarqube 6.7.4 (build 38452).

                分两步解决:

                1. 将内置 SonarC# 插件更新到版本 7.2(内部版本 5463)(卸载-重启-安装-重启)并重新扫描后,出现了代码问题(漏洞、代码异味等).
                2. 在测试项目中引入包coverlet.msbuild生成覆盖率数据,配置项目-管理 - C# - OpenCover 单元测试报告路径 以使用 path/to/coverage.opencover.xml.重新扫描后,测试覆盖率数据出现了.
                1. After updating the built-in SonarC# plugin to version 7.2 (build 5463) (Uninstall-Restart-Install-Restart), and re-scanning, code issues (vulnerabilities, code smells, etc) showed up.
                2. Introduced package coverlet.msbuild into test projects to generate coverage data, configured Project - Administration - C# - OpenCover Unit Tests Reports Paths to use path/to/coverage.opencover.xml. After re-scanning, test coverage data showed up.

                以上配置后执行的命令如下:

                Here are all the commands executed after above configurations:

                    dotnet path/to/SonarScanner.MSBuild.dll begin /k:"project-key"
                    dotnet build
                    dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
                    dotnet path/to/SonarScanner.MSBuild.dll end
                

                这篇关于SonarQube - C# 代码未显示在仪表板上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:没有 .pdb 文件的 C# 分析失败 下一篇:分析失败并出现错误“没有对此项目执行 FxCop 分析,而它包含 cs 文件"

                相关文章

                1. <tfoot id='9WmCM'></tfoot>

                  <small id='9WmCM'></small><noframes id='9WmCM'>

                  • <bdo id='9WmCM'></bdo><ul id='9WmCM'></ul>
                  <i id='9WmCM'><tr id='9WmCM'><dt id='9WmCM'><q id='9WmCM'><span id='9WmCM'><b id='9WmCM'><form id='9WmCM'><ins id='9WmCM'></ins><ul id='9WmCM'></ul><sub id='9WmCM'></sub></form><legend id='9WmCM'></legend><bdo id='9WmCM'><pre id='9WmCM'><center id='9WmCM'></center></pre></bdo></b><th id='9WmCM'></th></span></q></dt></tr></i><div id='9WmCM'><tfoot id='9WmCM'></tfoot><dl id='9WmCM'><fieldset id='9WmCM'></fieldset></dl></div>
                  <legend id='9WmCM'><style id='9WmCM'><dir id='9WmCM'><q id='9WmCM'></q></dir></style></legend>