私はteamcityでソナーqubeランナーを実行しています。エラーなしでステップを完了しますが、問題はありません。Sonar-CSharpは.csファイルを解析しません
のようなプロジェクト構造:
ルート
-sources
--projectA
--- projectA.csproj
--projectB
--- projectB.csproj
-tests
--projectAtests
--- projectAtests.csproj
--projectBtests
--- projectBtests.csproj
-solution.sln
構成パラメータは、 作業ディレクトリ:
ソース位置: "ソース"
試験場所: "テスト"
追加パラメータ: "-Dsonar.resharper.cs.reportPath =%system.teamcity.build.tempDir%\ inspectReport.xml
-Dsonar.resharper.solutionFile =%解決策%
-Xは」
ログは見た目は次のようになります。
Starting SQS from C:\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner
-classpath
C:\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner\lib\sonar-scanner-cli-3.0.3.778.jar
org.sonarsource.scanner.cli.Main
"-Dproject.home=."
"-Dsonar.host.url=http://teamcity:9000"
"-Dsonar.projectKey=MyProj"
"-Dsonar.projectName=MyProj"
"-Dsonar.projectVersion=84"
"-Dsonar.sources=Sources"
"-Dsonar.tests=Tests"
"-Dsonar.password=*******"
"-Dsonar.login=*******"
-Dscanner.home=C:\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner
-Dsonar.resharper.cs.reportPath=C:\BuildAgent\temp\buildTmp\inspectReport.xml
-Dsonar.resharper.solutionFile=MyProj
-X
Starting: "C:\Program Files\Java\jdk1.8.0_144\bin\java.exe" -classpath C:\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner\lib\sonar-scanner-cli-3.0.3.778.jar org.sonarsource.scanner.cli.Main "-Dproject.home=." "-Dsonar.host.url=http://teamcity:9000" "-Dsonar.projectKey=MyProj" "-Dsonar.projectName=MyProj" "-Dsonar.projectVersion=84" "-Dsonar.sources=Sources" "-Dsonar.tests=Tests" "-Dsonar.password=*******" "-Dsonar.login=*******" -Dscanner.home=C:\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner -Dsonar.resharper.cs.reportPath=C:\BuildAgent\temp\buildTmp\inspectReport.xml -Dsonar.resharper.solutionFile=MyProj -X
in directory: C:\BuildAgent\work\a5fc21edc9db6866
14:05:27.272 INFO: Scanner configuration file: C:\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner\conf\sonar-scanner.properties
14:05:27.279 INFO: Project root configuration file: NONE
14:05:27.307 INFO: SonarQube Scanner 3.0.3.778
14:05:27.307 INFO: Java 1.8.0_144 Oracle Corporation (64-bit)
14:05:27.307 INFO: Windows 10 10.0 amd64
14:05:27.581 DEBUG: keyStore is :
14:05:27.581 DEBUG: keyStore type is : jks
14:05:27.581 DEBUG: keyStore provider is :
14:05:27.581 DEBUG: init keystore
14:05:27.582 DEBUG: init keymanager of type SunX509
14:05:27.799 INFO: User cache: C:\Users\support\.sonar\cache
14:05:27.800 DEBUG: Extract sonar-scanner-api-batch in temp...
14:05:27.876 DEBUG: Get bootstrap index...
14:05:27.877 DEBUG: Download: http://teamcity:9000/batch/index
14:05:27.951 DEBUG: Get bootstrap completed
14:05:27.953 DEBUG: Create isolated classloader...
14:05:27.967 DEBUG: Start temp cleaning...
14:05:27.978 DEBUG: Temp cleaning done
14:05:27.978 DEBUG: Execution getVersion
14:05:27.984 DEBUG: Execution start
14:05:28.276 INFO: Publish mode
14:05:28.431 INFO: Load global settings
14:05:28.515 DEBUG: GET 200 http://teamcity:9000/api/settings/values.protobuf | time=54ms
14:05:28.537 INFO: Load global settings (done) | time=106ms
14:05:28.547 INFO: Server id: AWANnH2mQgX7CJzKVokm
14:05:28.557 INFO: User cache: C:\Users\support\.sonar\cache
14:05:28.823 INFO: Load plugins index
14:05:28.835 DEBUG: GET 200 http://teamcity:9000/api/plugins/installed | time=12ms
14:05:28.877 INFO: Load plugins index (done) | time=54ms
14:05:28.878 DEBUG: Load plugins
14:05:28.899 DEBUG: Load plugins (done) | time=21ms
14:05:28.921 DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
14:05:28.926 DEBUG: API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
14:05:29.070 DEBUG: Plugins:
14:05:29.070 DEBUG: * SonarC# 6.7.0.4267 (csharp)
14:05:29.070 DEBUG: * SonarPython 1.8.0.1496 (python)
14:05:29.071 DEBUG: * SonarJava 4.15.0.12310 (java)
14:05:29.072 DEBUG: * Flex 2.3 (flex)
14:05:29.072 DEBUG: * Git 1.2 (scmgit)
14:05:29.072 DEBUG: * SonarXML 1.4.3.1027 (xml)
14:05:29.072 DEBUG: * SoftVis3D Sonar plugin 1.0 (softvis3d)
14:05:29.072 DEBUG: * SonarPHP 2.11.0.2485 (php)
14:05:29.072 DEBUG: * SonarTS 1.1.0.1079 (typescript)
14:05:29.072 DEBUG: * SVN 1.5.0.715 (scmsvn)
14:05:29.072 DEBUG: * SonarJS 3.3.0.5702 (javascript)
14:05:29.101 DEBUG: Execution getVersion
14:05:29.101 INFO: SonarQube server 6.7.0
14:05:29.101 INFO: Default locale: "de_DE", source code encoding: "windows-1252" (analysis is platform dependent)
14:05:29.102 DEBUG: Work directory: C:\BuildAgent\work\a5fc21edc9db6866\.scannerwork
14:05:29.102 DEBUG: Execution getVersion
14:05:29.103 DEBUG: Execution execute
14:05:29.997 INFO: Process project properties
14:05:30.004 DEBUG: Process project properties (done) | time=6ms
14:05:30.050 INFO: Load project repositories
14:05:30.056 DEBUG: GET 404 http://teamcity:9000/batch/project.protobuf?key=MyProj | time=5ms
14:05:30.060 DEBUG: Project repository not available - continuing without it
14:05:30.064 INFO: Load project repositories (done) | time=14ms
14:05:30.147 DEBUG: Available languages:
14:05:30.147 DEBUG: * C# => "cs"
14:05:30.148 DEBUG: * Python => "py"
14:05:30.148 DEBUG: * Java => "java"
14:05:30.148 DEBUG: * Flex => "flex"
14:05:30.148 DEBUG: * XML => "xml"
14:05:30.148 DEBUG: * PHP => "php"
14:05:30.150 DEBUG: * TypeScript => "ts"
14:05:30.151 DEBUG: * JavaScript => "js"
14:05:30.187 INFO: Load quality profiles
14:05:30.218 DEBUG: GET 200 http://teamcity:9000/api/qualityprofiles/search.protobuf?defaults=true | time=29ms
14:05:30.227 INFO: Load quality profiles (done) | time=40ms
14:05:30.237 INFO: Load active rules
14:05:30.439 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWAmibuEbXZi-9wv_dLM&p=1&ps=500 | time=202ms
14:05:30.988 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnNk3QgX7CJzKVpGk&p=1&ps=500 | time=427ms
14:05:31.094 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnNr-QgX7CJzKVpMK&p=1&ps=500 | time=46ms
14:05:31.129 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnNqpQgX7CJzKVpLL&p=1&ps=500 | time=21ms
14:05:31.254 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnNybQgX7CJzKVpR5&p=1&ps=500 | time=124ms
14:05:31.365 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnN1iQgX7CJzKVpT7&p=1&ps=500 | time=83ms
14:05:31.432 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnN8kQgX7CJzKVpWs&p=1&ps=500 | time=66ms
14:05:31.471 DEBUG: GET 200 http://teamcity:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AWANnN_hQgX7CJzKVpXw&p=1&ps=500 | time=33ms
14:05:31.489 INFO: Load active rules (done) | time=1252ms
14:05:31.492 INFO: Load metrics repository
14:05:31.551 DEBUG: GET 200 http://teamcity:9000/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=58ms
14:05:31.610 INFO: Load metrics repository (done) | time=118ms
14:05:31.690 INFO: Project key: MyProj
14:05:31.691 DEBUG: Start recursive analysis of project modules
14:05:31.691 INFO: ------------- Scan MyProj
14:05:32.849 INFO: Load server rules
14:05:32.977 DEBUG: GET 200 http://teamcity:9000/api/rules/list.protobuf | time=124ms
14:05:33.017 INFO: Load server rules (done) | time=168ms
14:05:33.083 INFO: Base dir: C:\BuildAgent\work\a5fc21edc9db6866
14:05:33.083 INFO: Working dir: C:\BuildAgent\work\a5fc21edc9db6866\.scannerwork
14:05:33.095 INFO: Source paths: Sources
14:05:33.095 INFO: Test paths: Tests
14:05:33.096 INFO: Source encoding: windows-1252, default locale: de_DE
14:05:33.213 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
14:05:33.214 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : **/*.py
14:05:33.214 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
14:05:33.216 DEBUG: Declared extensions of language Flex were converted to sonar.lang.patterns.flex : **/*.as
14:05:33.216 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl
14:05:33.216 DEBUG: Declared extensions of language PHP were converted to sonar.lang.patterns.php : **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
14:05:33.218 DEBUG: Declared extensions of language TypeScript were converted to sonar.lang.patterns.ts : **/*.ts,**/*.tsx
14:05:33.218 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js,**/*.jsx,**/*.vue
14:05:33.223 DEBUG: Initializers :
14:05:33.225 INFO: Index files
14:05:33.310 DEBUG: 'Sources\DevExpress.Xpf.Themes.MyTheme\AddResourcesToPackage.nuspec' indexed with language 'null'
...
...
...
14:05:35.027 DEBUG: 'Tests\TestFramework.Tests\TestAutomationTests.cs' indexed as test with language 'cs'
14:05:35.027 INFO: 1213 files indexed
14:05:35.029 INFO: Quality profile for cs: My way
14:05:35.029 INFO: Quality profile for xml: Sonar way
14:05:37.347 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
14:05:37.347 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
14:05:37.386 DEBUG: 'C# Tests Coverage Report Import' skipped because one of the required properties is missing
14:05:37.390 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because one of the required properties is missing
14:05:37.393 DEBUG: 'C# Unit Test Results Import' skipped because one of the required properties is missing
14:05:37.395 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
14:05:37.395 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
14:05:37.404 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
14:05:37.404 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
14:05:37.404 DEBUG: 'Flex' skipped because there is no related file in current project
14:05:37.404 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
14:05:37.408 DEBUG: 'PHP sensor' skipped because there is no related file in current project
14:05:37.408 DEBUG: 'TypeScript Sensor' skipped because there is no related file in current project
14:05:37.408 DEBUG: 'TypeScript LCOV Coverage Sensor' skipped because there is no related file in current project
14:05:37.408 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
14:05:37.462 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
14:05:37.462 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
14:05:37.463 DEBUG: 'C# Tests Coverage Report Import' skipped because one of the required properties is missing
14:05:37.463 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because one of the required properties is missing
14:05:37.468 DEBUG: 'C# Unit Test Results Import' skipped because one of the required properties is missing
14:05:37.468 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
14:05:37.471 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
14:05:37.471 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
14:05:37.471 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
14:05:37.471 DEBUG: 'Flex' skipped because there is no related file in current project
14:05:37.475 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
14:05:37.477 DEBUG: 'PHP sensor' skipped because there is no related file in current project
14:05:37.477 DEBUG: 'TypeScript Sensor' skipped because there is no related file in current project
14:05:37.477 DEBUG: 'TypeScript LCOV Coverage Sensor' skipped because there is no related file in current project
14:05:37.477 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
14:05:37.482 DEBUG: Sensors : C# Properties -> SonarJavaXmlFileSensor -> XML Sensor -> Analyzer for "php.ini" files -> C# -> Zero Coverage Sensor -> CPD Block Indexer
14:05:37.482 INFO: Sensor C# Properties [csharp]
14:05:37.482 WARN: Property missing: 'sonar.cs.analyzer.projectOutPaths'. No protobuf files will be loaded for this project.
14:05:37.484 WARN: No roslyn issues report not found for this project.
14:05:37.484 INFO: Sensor C# Properties [csharp] (done) | time=2ms
14:05:37.484 INFO: Sensor SonarJavaXmlFileSensor [java]
14:05:37.564 INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=80ms
14:05:37.564 INFO: Sensor XML Sensor [xml]
14:05:37.581 DEBUG: 'Sources/Core.Authority.UI/Connected Services/LicenseServiceWCF/LicenseService.xsd' generated metadata with charset 'windows-1252'
14:05:37.585 DEBUG: Count lines in C:/BuildAgent/work/a5fc21edc9db6866/Sources/Core.Authority.UI/Connected Services/LicenseServiceWCF/LicenseService.xsd
14:05:37.782 DEBUG: 'Sources/Core.Authority.UI/Connected Services/LicenseServiceWCF/LicenseService1.xsd' generated metadata with charset 'windows-1252'
14:05:37.782 DEBUG: Count lines in C:/BuildAgent/work/a5fc21edc9db6866/Sources/Core.Authority.UI/Connected Services/LicenseServiceWCF/LicenseService1.xsd
14:05:37.873 DEBUG: 'Sources/Core.Authority.UI/Connected Services/LicenseServiceWCF/LicenseService2.xsd' generated metadata with charset 'windows-1252'
14:05:37.873 DEBUG: Count lines in C:/BuildAgent/work/a5fc21edc9db6866/Sources/Core.Authority.UI/Connected Services/LicenseServiceWCF/LicenseService2.xsd
14:05:37.937 INFO: Sensor XML Sensor [xml] (done) | time=373ms
14:05:37.937 INFO: Sensor Analyzer for "php.ini" files [php]
14:05:37.969 INFO: Sensor Analyzer for "php.ini" files [php] (done) | time=32ms
14:05:37.969 INFO: Sensor C# [csharp]
14:05:37.969 INFO: Sensor C# [csharp] (done) | time=0ms
14:05:37.969 INFO: Sensor Zero Coverage Sensor
14:05:38.187 INFO: Sensor Zero Coverage Sensor (done) | time=218ms
14:05:38.187 INFO: Sensor CPD Block Indexer
14:05:38.187 DEBUG: org.sonar.scanner.cpd.deprecated.DefaultCpdBlockIndexer is used for cs
14:05:38.189 DEBUG: No CpdMapping for language cs
14:05:38.189 DEBUG: org.sonar.scanner.cpd.deprecated.DefaultCpdBlockIndexer is used for xml
14:05:38.189 DEBUG: No CpdMapping for language xml
14:05:38.189 INFO: Sensor CPD Block Indexer (done) | time=2ms
14:05:38.193 DEBUG: 'Sources/DevExpress.Xpf.Themes.MyTheme/Properties/AssemblyInfo.cs' generated metadata with charset 'windows-1252'
14:05:38.198 DEBUG: 'Sources/DevExpress.Xpf.Themes.MyTheme/Properties/Resources.Designer.cs' generated metadata with charset 'UTF-8'
14:05:38.726 INFO: SCM provider for this project is: git
14:05:38.728 INFO: 467 files to be analyzed
14:05:38.779 DEBUG: readpipe [git, --version],C:\Program Files (x86)\Git\cmd
14:05:38.852 DEBUG: readpipe may return 'git version 2.10.1.windows.1'
14:05:38.852 DEBUG: remaining output:
14:05:38.857 DEBUG: readpipe [git, config, --system, --edit],C:\Program Files (x86)\Git\cmd
14:05:39.112 DEBUG: readpipe may return 'C:/Program Files (x86)/Git/mingw32/etc/gitconfig'
14:05:39.112 DEBUG: remaining output:
14:09:26.696 DEBUG: Blame file Tests/TestFramework.Tests/TestAutomationTests.cs
...
...
...
14:09:26.995 INFO: 467/467 files analyzed
14:09:26.997 INFO: Calculating CPD for 0 files
14:09:26.999 INFO: CPD calculation finished
14:09:34.501 INFO: Analysis report generated in 7353ms, dir size=1 MB
14:09:35.289 INFO: Analysis reports compressed in 787ms, zip size=658 KB
14:09:35.289 INFO: Analysis report generated in C:\BuildAgent\work\a5fc21edc9db6866\.scannerwork\scanner-report
14:09:35.292 DEBUG: Upload report
14:09:35.898 DEBUG: POST 200 http://teamcity:9000/api/ce/submit?projectKey=MyProj&projectName=MyProj | time=604ms
14:09:35.900 INFO: Analysis report uploaded in 608ms
Publishing artifacts
[Publishing artifacts] Collecting files to publish: [C:\BuildAgent\temp\buildTmp\sonar_server.txt=>.teamcity/sonar/]
[Publishing artifacts] Publishing 1 file using [ArtifactsCachePublisher]: C:/BuildAgent/temp/buildTmp/sonar_server.txt => .teamcity/sonar
[Publishing artifacts] Publishing 1 file using [WebPublisher]: C:/BuildAgent/temp/buildTmp/sonar_server.txt => .teamcity/sonar
14:09:35.909 INFO: ANALYSIS SUCCESSFUL, you can browse http://teamcity:9000/dashboard/index/MyProj
14:09:35.910 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
14:09:35.910 INFO: More about the report processing at http://teamcity:9000/api/ce/task?id=AWAmzHhyF2rjhrlmqekU
14:09:35.910 DEBUG: Report metadata written to C:\BuildAgent\work\a5fc21edc9db6866\.scannerwork\report-task.txt
14:09:35.931 DEBUG: Post-jobs :
14:09:35.935 INFO: Task total time: 4:06.820 s
14:09:35.935 INFO: ------------------------------------------------------------------------
14:09:35.935 INFO: EXECUTION SUCCESS
14:09:35.935 INFO: ------------------------------------------------------------------------
14:09:35.935 INFO: Total time: 4:08.728s
14:09:36.013 INFO: Final Memory: 48M/115M
14:09:36.013 INFO: ------------------------------------------------------------------------
14:09:36.013 DEBUG: Execution getVersion
14:09:36.015 DEBUG: Execution stop
Process exited with code 0
ランナーはすべてのファイルを処理するようだが、それらを分析しません。 MsBuild 14と15がビルドエージェントにインストールされています。
私はsonar-csharp-pluginのいくつかのバージョンでこれを試しました。 6.0以降のすべてのバージョンにこの問題があります。 (旧バージョンでは例外が発生します)
システム修復のために何ができますか?
数ヶ月前に動作して以来、ちょっと変わってきました。 しかし、あなたの提案は機能しています。ありがとうございました。 – Dresaan
@Dresaan TeamCityプラグインがMSBuild 12互換モードでプロジェクトを分析したMSBuild用の旧バージョンのScannerを使用する前に推測します。この場合、開始/終了のステップは必要ありませんでしたが、分析は遅く、精度ははるかに低かった。 Scanner for MSBuild 3.0およびSonarC#6.0を使用してこのモードを削除しました。 –