SonarQube for MSBuild没有报告质量问题

时间:2018-08-28 17:45:44

标签: sonarqube

我正在SonarQube Scanner for MSBuild上进行POC,作为它的一部分,我创建了一个简单的c#项目,其中包含许多代码片段,应将其标记为错误或代码异味。我什至直接从已定义的规则中提取示例,这些规则在我使用的Sonar Way质量配置文件中处于活动状态。

SonarQube似乎无法识别这些问题。查看我们的SonarQube实例,代码成功到达那里,但是没有报告任何问题。

这里是一个示例代码,应在质量配置文件“声纳方式”中将其捕获为错误(S3168-“异步”方法不应返回“无效”)。包含此文件的文件称为“ BadClass.cs”,可以在日志输出中看到。

class HttpPrinter
{
    private string content;
    public async void CallNetwork(string url) //Noncompliant
    {
        var client = new HttpClient();
        var response = await client.GetAsync(url);
        content = await response.Content.ReadAsStringAsync();
    }

    public async Task PrintContent(string url)  // works correctly if web request finishes in under 1 second, otherwise content will be null
    {
        CallNetwork(url);
        await Task.Delay(1000);
        Console.Write(content);
    }

}

这是扫描的日志输出:

SonarScanner for MSBuild 4.3.1
Using the .NET Framework version of the Scanner for MSBuild
Default properties file was found at C:\sonarscanner-msbuild\SonarQube.Analysis.xml
Loading analysis properties from C:\sonarscanner-msbuild\SonarQube.Analysis.xml
Post-processing started.
10:02:38.789  Loading the SonarQube analysis config from C:\code\vsts\TestSonarQube\src\.sonarqube\conf\SonarQubeAnalysisConfig.xml
10:02:38.792  Not running under TeamBuild
10:02:38.792  Analysis base directory: C:\code\vsts\TestSonarQube\src\.sonarqube
Build directory: 
Bin directory: C:\code\vsts\TestSonarQube\src\.sonarqube\bin
Config directory: C:\code\vsts\TestSonarQube\src\.sonarqube\conf
Output directory: C:\code\vsts\TestSonarQube\src\.sonarqube\out
Config file: C:\code\vsts\TestSonarQube\src\.sonarqube\conf\SonarQubeAnalysisConfig.xml
Generating SonarQube project properties file to C:\code\vsts\TestSonarQube\src\.sonarqube\out\sonar-project.properties
Setting analysis property: sonar.visualstudio.enable=false
Using longest common projects root path as project base directory: 'C:\code\vsts\TestSonarQube\src\TestSonarQube'.
WARNING: File 'C:\code\vsts\TestSonarQube\src\packages\MSTest.TestAdapter.1.2.1\build\_common\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll' is not located under the root directory 'C:\code\vsts\TestSonarQube\src\TestSonarQube' and will not be analyzed.
File was referenced by the following projects: 'C:\code\vsts\TestSonarQube\src\TestSonarQube\TestSonarQube.csproj'.
WARNING: File 'C:\code\vsts\TestSonarQube\src\packages\MSTest.TestAdapter.1.2.1\build\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface.dll' is not located under the root directory 'C:\code\vsts\TestSonarQube\src\TestSonarQube' and will not be analyzed.
File was referenced by the following projects: 'C:\code\vsts\TestSonarQube\src\TestSonarQube\TestSonarQube.csproj'.
WARNING: File 'C:\code\vsts\TestSonarQube\src\packages\MSTest.TestAdapter.1.2.1\build\_common\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll' is not located under the root directory 'C:\code\vsts\TestSonarQube\src\TestSonarQube' and will not be analyzed.
File was referenced by the following projects: 'C:\code\vsts\TestSonarQube\src\TestSonarQube\TestSonarQube.csproj'.
Dumping content of sonar-project.properties
------------------------------------------------------------------------
sonar.projectKey=test.sonar.integration
sonar.working.directory=C:\\code\\vsts\\TestSonarQube\\src\\.sonarqube\\out\\.sonar
sonar.projectBaseDir=C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube

45617122-FB02-405F-B359-BA0B2E0B1847.sonar.projectKey=test.sonar.integration:45617122-FB02-405F-B359-BA0B2E0B1847
45617122-FB02-405F-B359-BA0B2E0B1847.sonar.projectName=TestSonarQube
45617122-FB02-405F-B359-BA0B2E0B1847.sonar.projectBaseDir=C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube
45617122-FB02-405F-B359-BA0B2E0B1847.sonar.sourceEncoding=utf-8
45617122-FB02-405F-B359-BA0B2E0B1847.sonar.sources=
45617122-FB02-405F-B359-BA0B2E0B1847.sonar.tests=\
"C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube\\BadClass.cs",\
"C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube\\Foo.cs",\
"C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube\\UnitTest1.cs",\
"C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube\\Properties\\AssemblyInfo.cs",\
"C:\\code\\vsts\\TestSonarQube\\src\\TestSonarQube\\packages.config"

sonar.host.url=http://MyServer:9000
sonar.verbose=true
sonar.language=cs
sonar.sourceEncoding=UTF-8
sonar.visualstudio.enable=false

sonar.modules=45617122-FB02-405F-B359-BA0B2E0B1847


------------------------------------------------------------------------
Writing processing summary to C:\code\vsts\TestSonarQube\src\.sonarqube\out\ProjectInfo.log
SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
Setting environment variable 'SONAR_SCANNER_OPTS'. Value: -Xmx1024m
Executing file C:\sonarscanner-msbuild\sonar-scanner-3.2.0.1227\bin\sonar-scanner.bat
  Args: -Dsonar.scanAllFiles=true -Dproject.settings=C:\code\vsts\TestSonarQube\src\.sonarqube\out\sonar-project.properties --embedded <sensitive data removed>
  Working directory: C:\code\vsts\TestSonarQube\src
  Timeout (ms):-1
  Process id: 14420
INFO: Scanner configuration file: C:\sonarscanner-msbuild\sonar-scanner-3.2.0.1227\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: C:\code\vsts\TestSonarQube\src\.sonarqube\out\sonar-project.properties
10:02:39.124 INFO: SonarQube Scanner 3.2.0.1227
10:02:39.127 INFO: Java 1.8.0_181 Oracle Corporation (64-bit)
10:02:39.128 INFO: Windows 10 10.0 amd64
10:02:39.128 INFO: SONAR_SCANNER_OPTS=-Xmx1024m
10:02:39.252 DEBUG: keyStore is : 
10:02:39.252 DEBUG: keyStore type is : jks
10:02:39.252 DEBUG: keyStore provider is : 
10:02:39.252 DEBUG: init keystore
10:02:39.253 DEBUG: init keymanager of type SunX509
10:02:39.601 DEBUG: Create: C:\Users\jwaide\.sonar\cache
10:02:39.602 INFO: User cache: C:\Users\jwaide\.sonar\cache
10:02:39.602 DEBUG: Create: C:\Users\jwaide\.sonar\cache\_tmp
10:02:39.605 DEBUG: Extract sonar-scanner-api-batch in temp...
10:02:39.653 DEBUG: Get bootstrap index...
10:02:39.653 DEBUG: Download: http://scsonara01:9000/batch/index
10:02:39.790 DEBUG: Get bootstrap completed
10:02:39.798 DEBUG: Create isolated classloader...
10:02:39.805 DEBUG: Start temp cleaning...
10:02:39.811 DEBUG: Temp cleaning done
10:02:39.811 DEBUG: Execution getVersion
10:02:39.814 INFO: SonarQube server 7.2.1
10:02:39.814 INFO: Default locale: "en_US", source code encoding: "UTF-8"
10:02:39.815 DEBUG: Work directory: C:\code\vsts\TestSonarQube\src\.sonarqube\out\.sonar
10:02:39.816 DEBUG: Execution execute
10:02:40.089 INFO: Publish mode
10:02:40.201 INFO: Load global settings
10:02:40.690 DEBUG: GET 200 http://scsonara01:9000/api/settings/values.protobuf | time=483ms
10:02:40.716 INFO: Load global settings (done) | time=515ms
10:02:40.721 INFO: Server id: AWU0ZxrMOjUK0oLgK7-R
10:02:40.730 INFO: User cache: C:\Users\jwaide\.sonar\cache
10:02:40.909 INFO: Load/download plugins
10:02:40.909 INFO: Load plugins index
10:02:41.312 DEBUG: GET 200 http://scsonara01:9000/api/plugins/installed | time=403ms
10:02:41.364 INFO: Load plugins index (done) | time=455ms
10:02:41.379 INFO: Load/download plugins (done) | time=470ms
10:02:41.405 DEBUG: Plugins:
10:02:41.405 DEBUG:   * SonarC# 7.2.0.5463 (csharp)
10:02:41.406 DEBUG:   * SonarPython 1.10.0.2131 (python)
10:02:41.406 DEBUG:   * SonarJava 5.4.0.14284 (java)
10:02:41.406 DEBUG:   * LDAP 2.2.0.608 (ldap)
10:02:41.406 DEBUG:   * Git 1.4.1.1128 (scmgit)
10:02:41.406 DEBUG:   * SonarXML 1.5.1.1452 (xml)
10:02:41.407 DEBUG:   * SonarGo 1.1.0.1612 (go)
10:02:41.407 DEBUG:   * SonarTS 1.7.0.2893 (typescript)
10:02:41.407 DEBUG:   * SonarJS 4.1.0.6085 (javascript)
10:02:41.419 INFO: Loaded core extensions: 
10:02:41.696 INFO: Process project properties
10:02:41.705 DEBUG: Process project properties (done) | time=9ms
10:02:41.725 INFO: Load project repositories
10:02:42.150 DEBUG: GET 200 http://scsonara01:9000/batch/project.protobuf?key=lighthouse.sonar.integration | time=424ms
10:02:42.213 INFO: Load project repositories (done) | time=488ms
10:02:42.288 DEBUG: Available languages:
10:02:42.288 DEBUG:   * C# => "cs"
10:02:42.288 DEBUG:   * Python => "py"
10:02:42.288 DEBUG:   * Java => "java"
10:02:42.289 DEBUG:   * XML => "xml"
10:02:42.289 DEBUG:   * Go => "go"
10:02:42.289 DEBUG:   * TypeScript => "ts"
10:02:42.289 DEBUG:   * JavaScript => "js"
10:02:42.296 INFO: Load quality profiles
10:02:42.705 DEBUG: GET 200 http://scsonara01:9000/api/qualityprofiles/search.protobuf?projectKey=lighthouse.sonar.integration | time=407ms
10:02:42.730 INFO: Load quality profiles (done) | time=434ms
10:02:42.747 INFO: Load active rules
10:02:43.165 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0HsOjUK0oLgK8lG&p=1&ps=500 | time=416ms
10:02:43.666 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0MGOjUK0oLgK8tS&p=1&ps=500 | time=423ms
10:02:44.127 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0QPOjUK0oLgK8zu&p=1&ps=500 | time=403ms
10:02:44.550 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0Q-OjUK0oLgK80O&p=1&ps=500 | time=420ms
10:02:44.975 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0UJOjUK0oLgK85_&p=1&ps=500 | time=412ms
10:02:45.409 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0YyOjUK0oLgK8_h&p=1&ps=500 | time=414ms
10:02:45.833 DEBUG: GET 200 http://scsonara01:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWU0Z0ZxOjUK0oLgK9A3&p=1&ps=500 | time=421ms
10:02:45.860 INFO: Load active rules (done) | time=3113ms
10:02:45.863 INFO: Load metrics repository
10:02:46.265 DEBUG: GET 200 http://scsonara01:9000/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=402ms
10:02:46.293 INFO: Load metrics repository (done) | time=431ms
10:02:46.324 INFO: Project key: lighthouse.sonar.integration
10:02:46.325 INFO: Project base dir: C:\code\vsts\TestSonarQube\src\TestSonarQube
10:02:46.326 DEBUG: Start recursive analysis of project modules
10:02:46.327 INFO: -------------  Scan TestSonarQube
10:02:46.451 INFO: Load server rules
10:02:46.883 DEBUG: GET 200 http://scsonara01:9000/api/rules/list.protobuf | time=432ms
10:02:46.979 INFO: Load server rules (done) | time=528ms
10:02:47.009 INFO: Base dir: C:\code\vsts\TestSonarQube\src\TestSonarQube
10:02:47.009 INFO: Working dir: C:\code\vsts\TestSonarQube\src\.sonarqube\out\.sonar\lighthouse.sonar.integration_lighthouse.sonar.integration_45617122-FB02-405F-B359-BA0B2E0B1847
10:02:47.011 INFO: Test paths: BadClass.cs, Foo.cs, UnitTest1.cs, Properties/AssemblyInfo.cs, packages.config
10:02:47.011 INFO: Source encoding: UTF-8, default locale: en_US
10:02:47.088 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
10:02:47.088 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : **/*.py
10:02:47.088 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
10:02:47.089 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl
10:02:47.089 DEBUG: Declared extensions of language Go were converted to sonar.lang.patterns.go : **/*.go
10:02:47.089 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : **/*.ts,**/*.tsx
10:02:47.089 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js,**/*.jsx,**/*.vue
10:02:47.089 INFO: Language is forced to cs
10:02:47.102 DEBUG: Initializers : 
10:02:47.103 INFO: Index files
10:02:47.115 DEBUG: 'BadClass.cs' indexed as test with language 'cs'
10:02:47.118 DEBUG: 'Foo.cs' indexed as test with language 'cs'
10:02:47.121 DEBUG: 'UnitTest1.cs' indexed as test with language 'cs'
10:02:47.122 DEBUG: 'Properties\AssemblyInfo.cs' indexed as test with language 'cs'
10:02:47.123 INFO: 4 files indexed
10:02:47.124 INFO: Quality profile for cs: Sonar way
10:02:47.847 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
10:02:47.847 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
10:02:47.848 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
10:02:47.857 DEBUG: 'C# Tests Coverage Report Import' skipped because one of the required properties is missing
10:02:47.858 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because one of the required properties is missing
10:02:47.859 DEBUG: 'C# Unit Test Results Import' skipped because one of the required properties is missing
10:02:47.859 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
10:02:47.859 DEBUG: 'PylintSensor' skipped because there is no related file in current project
10:02:47.860 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
10:02:47.860 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
10:02:47.860 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
10:02:47.861 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
10:02:47.861 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
10:02:47.861 DEBUG: 'XML Sensor' skipped because there is no related file in current project
10:02:47.861 DEBUG: 'SonarGo' skipped because there is no related file in current project
10:02:47.861 DEBUG: 'Go Unit Test Report' skipped because there is no related file in current project
10:02:47.862 DEBUG: 'Import of go vet issues' skipped because there is no related file in current project
10:02:47.862 DEBUG: 'Import of Golint issues' skipped because there is no related file in current project
10:02:47.862 DEBUG: 'Import of GoMetaLinter issues' skipped because there is no related file in current project
10:02:47.863 DEBUG: 'Import of TSLint issues' skipped because there is no related file in current project
10:02:47.863 DEBUG: 'Import of ESLint issues' skipped because there is no related file in current project
10:02:47.864 DEBUG: 'SonarTS' skipped because there is no related file in current project
10:02:47.864 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
10:02:47.864 DEBUG: 'SonarJS' skipped because there is no related file in current project
10:02:47.865 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
10:02:47.868 DEBUG: Sensors : C# Properties -> SonarJavaXmlFileSensor
10:02:47.869 INFO: Sensor C# Properties [csharp]
10:02:47.870 INFO: Sensor C# Properties [csharp] (done) | time=1ms
10:02:47.870 INFO: Sensor SonarJavaXmlFileSensor [java]
10:02:47.871 INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=1ms
10:02:47.886 DEBUG: 'BadClass.cs' generated metadata as test  with charset 'UTF-8'
10:02:47.887 DEBUG: 'Foo.cs' generated metadata as test  with charset 'UTF-8'
10:02:47.978 DEBUG: 'Properties/AssemblyInfo.cs' generated metadata as test  with charset 'UTF-8'
10:02:47.981 DEBUG: 'UnitTest1.cs' generated metadata as test  with charset 'UTF-8'
10:02:47.984 INFO: SCM provider for this project is: git
10:02:47.985 INFO: 1 files to be analyzed
10:02:48.022 DEBUG: Blame file src/TestSonarQube/BadClass.cs
10:02:48.108 DEBUG: Unable to blame file BadClass.cs. No blame info at line 4. Is file committed? [Author: PersonIdent[Not Committed Yet, , Tue Aug 28 10:02:48 2018 -0700] Source commit: null]
10:02:48.112 INFO: 0/1 files analyzed
10:02:48.116 INFO: -------------  Scan lighthouse.sonar.integration
10:02:48.151 INFO: Base dir: C:\code\vsts\TestSonarQube\src\TestSonarQube
10:02:48.151 INFO: Working dir: C:\code\vsts\TestSonarQube\src\.sonarqube\out\.sonar
10:02:48.151 INFO: Source encoding: UTF-8, default locale: en_US
10:02:48.173 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
10:02:48.173 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : **/*.py
10:02:48.174 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
10:02:48.174 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl
10:02:48.174 DEBUG: Declared extensions of language Go were converted to sonar.lang.patterns.go : **/*.go
10:02:48.175 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : **/*.ts,**/*.tsx
10:02:48.175 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js,**/*.jsx,**/*.vue
10:02:48.176 INFO: Language is forced to cs
10:02:48.181 DEBUG: Initializers : 
10:02:48.181 INFO: Index files
10:02:48.182 INFO: 0 files indexed
10:02:48.226 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
10:02:48.227 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
10:02:48.227 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
10:02:48.227 DEBUG: 'C#' skipped because there is no related file in current project
10:02:48.227 DEBUG: 'C# Properties' skipped because there is no related file in current project
10:02:48.227 DEBUG: 'C# Tests Coverage Report Import' skipped because there is no related file in current project
10:02:48.227 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
10:02:48.227 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
10:02:48.227 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'PylintSensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'XML Sensor' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'SonarGo' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'Go Unit Test Report' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'Import of go vet issues' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'Import of Golint issues' skipped because there is no related file in current project
10:02:48.228 DEBUG: 'Import of GoMetaLinter issues' skipped because there is no related file in current project
10:02:48.229 DEBUG: 'Import of TSLint issues' skipped because there is no related file in current project
10:02:48.229 DEBUG: 'Import of ESLint issues' skipped because there is no related file in current project
10:02:48.229 DEBUG: 'SonarTS' skipped because there is no related file in current project
10:02:48.229 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
10:02:48.229 DEBUG: 'SonarJS' skipped because there is no related file in current project
10:02:48.229 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
10:02:48.230 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
10:02:48.230 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
10:02:48.230 DEBUG: 'Import external issues report' skipped because one of the required properties is missing
10:02:48.231 DEBUG: 'C# Tests Coverage Report Import' skipped because one of the required properties is missing
10:02:48.231 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because one of the required properties is missing
10:02:48.231 DEBUG: 'C# Unit Test Results Import' skipped because one of the required properties is missing
10:02:48.231 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
10:02:48.231 DEBUG: 'PylintSensor' skipped because there is no related file in current project
10:02:48.231 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
10:02:48.232 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
10:02:48.232 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
10:02:48.232 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
10:02:48.232 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
10:02:48.232 DEBUG: 'XML Sensor' skipped because there is no related file in current project
10:02:48.234 DEBUG: 'SonarGo' skipped because there is no related file in current project
10:02:48.234 DEBUG: 'Go Unit Test Report' skipped because there is no related file in current project
10:02:48.234 DEBUG: 'Import of go vet issues' skipped because there is no related file in current project
10:02:48.235 DEBUG: 'Import of Golint issues' skipped because there is no related file in current project
10:02:48.235 DEBUG: 'Import of GoMetaLinter issues' skipped because there is no related file in current project
10:02:48.235 DEBUG: 'Import of TSLint issues' skipped because there is no related file in current project
10:02:48.235 DEBUG: 'Import of ESLint issues' skipped because there is no related file in current project
10:02:48.235 DEBUG: 'SonarTS' skipped because there is no related file in current project
10:02:48.235 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
10:02:48.236 DEBUG: 'SonarJS' skipped because there is no related file in current project
10:02:48.236 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
10:02:48.236 DEBUG: Sensors : SonarJavaXmlFileSensor -> C# -> Zero Coverage Sensor -> CPD Block Indexer
10:02:48.236 INFO: Sensor SonarJavaXmlFileSensor [java]
10:02:48.236 INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=0ms
10:02:48.237 INFO: Sensor C# [csharp]
10:02:48.238 DEBUG: No files to analyze. Skip Sensor.
10:02:48.238 INFO: Sensor C# [csharp] (done) | time=1ms
10:02:48.238 INFO: Sensor Zero Coverage Sensor
10:02:48.238 INFO: Sensor Zero Coverage Sensor (done) | time=0ms
10:02:48.238 INFO: Sensor CPD Block Indexer
10:02:48.238 DEBUG: org.sonar.scanner.cpd.deprecated.DefaultCpdBlockIndexer is used for cs
10:02:48.238 DEBUG: No CpdMapping for language cs
10:02:48.238 INFO: Sensor CPD Block Indexer (done) | time=0ms
10:02:48.239 INFO: Calculating CPD for 0 files
10:02:48.243 INFO: CPD calculation finished
10:02:48.355 INFO: Analysis report generated in 109ms, dir size=34 KB
10:02:48.378 INFO: Analysis reports compressed in 22ms, zip size=11 KB
10:02:48.378 INFO: Analysis report generated in C:\code\vsts\TestSonarQube\src\.sonarqube\out\.sonar\scanner-report
10:02:48.378 DEBUG: Upload report
10:02:48.786 DEBUG: POST 200 http://scsonara01:9000/api/ce/submit?projectKey=lighthouse.sonar.integration | time=407ms
10:02:48.794 INFO: Analysis report uploaded in 416ms
10:02:48.799 INFO: ANALYSIS SUCCESSFUL, you can browse http://scsonara01:9000/dashboard?id=lighthouse.sonar.integration
10:02:48.800 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
10:02:48.800 INFO: More about the report processing at http://scsonara01:9000/api/ce/task?id=AWWBfN2quxxeJ5jeK02H
10:02:48.810 DEBUG: Report metadata written to C:\code\vsts\TestSonarQube\src\.sonarqube\out\.sonar\report-task.txt
10:02:48.812 DEBUG: Post-jobs : 
10:02:48.817 INFO: Task total time: 7.398 s
10:02:48.909 INFO: ------------------------------------------------------------------------
10:02:48.909 INFO: EXECUTION SUCCESS
10:02:48.909 INFO: ------------------------------------------------------------------------
10:02:48.909 INFO: Total time: 9.845s
10:02:48.961 INFO: Final Memory: 12M/306M
10:02:48.962 INFO: ------------------------------------------------------------------------
Process returned exit code 0
The SonarQube Scanner has finished
10:02:49.024  Creating a summary markdown file...
10:02:49.028  Analysis results: http://scsonara01:9000/dashboard/index/lighthouse.sonar.integration
10:02:49.029  Post-processing succeeded.

任何有关故障排除提示的帮助将不胜感激!

2 个答案:

答案 0 :(得分:1)

请尝试在项目名称或路径中没有“测试”的项目。

每个规则的规范确定它是否针对产品代码,测试代码或两者而运行。 MSBuild扫描仪通过查看多种因素来确定项目是否为测试项目。项目类型和项目名称。

我猜想扫描仪会将您的项目归类为测试项目 因此您选择的规则不会违反它。

如果您在.sonarqube目录下查看,则会为每个已分析的MSBuild项目找到一个projectinfo.xml文件。如果您查看该文件,则会看到扫描程序是否将该项目归类为测试项目。

答案 1 :(得分:1)

最终,问题出在我使用的MSBuild版本上。使用MSBuild 15对我有用。 这是指向我正确位置的链接: https://github.com/SonarSource/sonar-csharp/issues/1828#issuecomment-418125650

现在分析成功进行了。