sonarqube-分析c#代码
1. sonarqube-分析c#代码
-
安装netcore分析器
分析netcore项目,微软和sonar一起协作做了很多工作,大大简化了我们的工具使用,官网可以查看相关工具及命令:https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-msbuild/
[root@sonarqube test]# dotnet tool install --global dotnet-sonarscanner
-
修改dotnet-sonarscanner连接sonarqube配置文件
这一步修改,是为了连接sonarqube服务,在dotnet tool的安装目录下,找到一个叫 SonarQube.Analysis.xml 的配置文件。
我的xml在该目录下:
默认格式:
修改成下面这种:
<?xml version="1.0" encoding="utf-8" ?> <!-- This file defines properties which would be understood by the SonarQube Scanner for MSBuild, if not overridden (see below) By default the SonarScanner.MSBuild.exe picks-up a file named SonarQube.Analysis.xml in the folder it is located (if it exists). It is possible to use another properties file by using the /s:fi