我已经在以下管道阶段创建了一个Jenkinsfile:
stage('SonarQube analysis') {
steps {
withSonarQubeEnv('SonarScan') {
sh "dotnet '/usr/local/sonar-scanner-msbuild/SonarScanner.MSBuild.dll' begin /k:${SONARQUBEPROJECTKEY} /v:${env.BUILD_NUMBER}"
sh "dotnet build 'src/${PROJECTNAME}.sln'"
sh "dotnet '/usr/local/sonar-scanner-msbuild/SonarScanner.MSBuild.dll' end"
}
}
}
运行Jenkins时,我在控制台日志输出中看到扫描程序发现了46个问题。
以下是控制台中报告的问题的摘要:
warning S2971: Drop 'Where' and move the condition into the 'FirstOrDefault'.
warning S1116: Remove this empty statement.
warning S3445: Consider using 'throw;' to preserve the stack trace.
warning S112: 'System.Exception' should not be thrown by user code.
warning S112: 'System.Exception' should not be thrown by user code.
warning S1481: Remove this unused 'resp' local variable.
warning S1481: Remove this unused 'claimsPrincipal' local variable.
当我转到SQ站点时,对于所运行的版本,没有任何数据。全部报告为0。
有人可以帮助解决SQ网站中未显示扫描结果的问题吗?
谢谢埃里克