我可以在 Linux 上为 .NET Core (C#) 运行 SonarQube 代码分析吗? [英] Can I run SonarQube code analysis for .NET Core (C#) on Linux?

查看:24
本文介绍了我可以在 Linux 上为 .NET Core (C#) 运行 SonarQube 代码分析吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试针对 Linux.NET Core 项目执行和报告 SonarQube 代码分析(目前没有测试覆盖)强> 构建代理.

我从

我想确保我的项目至少包含一个错误,所以我在其中一个源文件中添加了一个 goto 语句,并检查了我们的质量配置文件中是否启用了该警告,但是我仍然没有问题.
(源文件本身被正确拾取,我可以在 SonarQube 中看到文件列表和所有源.)

我做错了什么,或者这不应该起作用?

(只是为了澄清,这不是关于 .NET Core 的现有问题的重复:我在此处显示的相同命令在 Windows 上对我有效,它仅在 Linux 上不起作用.)

解决方案

此问题现已修复,因此如果以这种方式运行,您应该会看到错误.

参见 https://github.com/SonarSource/sonar-csharp/issues/535

I'm trying to execute and report a SonarQube code analysis (without test coverage for now) against a .NET Core project from a Linux build agent.

I downloaded sonar-scanner from this page, and trying to run the report with the following command (the server url is set up in the configuration).

sonar-scanner -Dsonar.projectKey="MyProject" -Dsonar.projectName="MyProject" -Dsonar.sources=$PWD

The execution seems to be successful, I uploaded the full output to this gist.

However, if I go to the project dashboard on the SonarQube site, I don't see any issues or code smells whatsoever.

I wanted to make sure that my project contains at least one error, so I added a goto statement to one of the source files, and checked if that warning is enabled in our Quality Profile, but I still get no issue.
(The sources files themselves are picked up correctly, I can see the list of files and all the source in SonarQube.)

Am I doing something wrong, or is this not expected to work?

(Just to clarify that this is not a duplicate of the existing question about .NET Core: the same command I showed here works for me on Windows, it only does not work on Linux.)

解决方案

This has now been fixed so you should see an error if run this way.

See https://github.com/SonarSource/sonar-csharp/issues/535

这篇关于我可以在 Linux 上为 .NET Core (C#) 运行 SonarQube 代码分析吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆