Как добавить пользовательские правила, используя fxcop на sonarqube?(6.7.7) - PullRequest
0 голосов
/ 26 сентября 2019

При анализе источника с помощью sonarqube 6.7.7 не применялись пользовательские правила fxcop.

Я установил свой собственный сервер sonarqube.Я хочу проанализировать свой источник, используя пользовательские правила fxcop.Сначала я подтвердил наличие открытого источника (пользовательское правило fxcop) на GitHub. (https://github.com/computamike/FXCopRules) ) А затем я проверил, что эти правила хорошо работают в Visual Studio 2017. (Прикрепленное изображение № 1)

Во-вторых, я добавил файл сборки пользовательского правила (OpenGI.CodingStandards.dll) в \ Инструменты статического анализа \ FxCop \ Rules

В-третьих, запустите «VS2017 developer cmd» от имени администратора, я изменил путь кЯ должен проанализировать источник. Затем я ввел команду ниже.


SonarQube.Scanner.MSBuild.exe begin / n: "MyProject" /v:"0.2 "/ k:" MyProject_Key "/d: "sonar.cs.fxcop.slnFile = D: \ Sonarqube \ 04_TargetProject \ MySampleProject \ MySampleProject.sln" /d:"sonar.cs.fxcop.fxCopCmdPath=C:\Program Files (x86) \ Microsoft Visual Studio \ 2017\ Community \ Team Tools \ Инструменты статического анализа \ FxCop \ FxCopCmd.exe "/d:"sonar.cs.fxcop.directory=bin\debug"

MSBuild.exe D: \ Sonarqube \ 04_TargetProject \ MySampleProject /t: перестроить

SonarScanner.MSBuild.exe end


Все процессы выполнены успешно,но я не смог найти пользовательскую сборку правил, которую я поместил в «\ Static Analysis Tools \ FxCop \ Rules» в журнале успеха.поэтому пользовательские правила не применяются.(Прикрепленное изображение № 2,3)

Я пытался применить пользовательское правило на сервере sonarqube, , но я не знаю, где я могу поместить сборку пользовательских правил.Что я пропустил?

ниже приведена информация о моей среде.

sonarqube 6.7.7

sonar-scanner-msbuild 4.6.2

сервер оракула 11g

visual studio 2017

вот журнал успеха ниже.

    D:\Sonarqube\04_TargetProject\MySampleProject>SonarScanner.MSBuild.exe end
SonarScanner for MSBuild 4.6.2
Using the .NET Framework version of the Scanner for MSBuild
Post-processing started.
Calling the SonarQube Scanner...
INFO: Scanner configuration file: D:\Sonarqube\01_Server\sonar-scanner-msbuild-4.6.2.2108-net46\sonar-scanner-3.3.0.1492\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_221 Oracle Corporation (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\sylvi\.sonar\cache
INFO: SonarQube server 6.7.7
INFO: Default locale: "ko_KR", source code encoding: "UTF-8"
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=55ms
INFO: Server id: BF41A1F2-AW1MJ1C3JyoWvyfwSWJs
INFO: User cache: C:\Users\sylvi\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=37ms
INFO: Process project properties
INFO: Execute project builders
INFO: Execute project builders (done) | time=36ms
INFO: Load project repositories
INFO: Load project repositories (done) | time=75ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=25ms
INFO: Load active rules
INFO: Load active rules (done) | time=235ms
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=23ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
INFO: Project key: MyProject_Key
INFO: -------------  Scan MySampleProject
INFO: Load server rules
INFO: Load server rules (done) | time=88ms
INFO: Base dir: D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject
INFO: Working dir: D:\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0
INFO: Source paths: Program.cs, Properties/AssemblyInfo.cs, App.config
INFO: Source encoding: UTF-8, default locale: ko_KR
INFO: Index files
INFO: 3 files indexed
INFO: Quality profile for cs: SNUH
INFO: Sensor C# Properties [csharp]
INFO: Sensor C# Properties [csharp] (done) | time=5ms
INFO: Sensor FxCop (cs) [fxcop]
INFO: Base Dir: D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject
INFO: sonar.dotnet.visualstudio.solution.file not set
INFO: Project key: MyProject_Key:MyProject_Key:EB798415-2620-4F07-BF04-11A59BF48A86
INFO: Work Dir: D\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0
INFO: FxCop start create FxCop configuration for 'D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject.sln'
INFO: Start execute: D:\Sonarqube\03_FxCop\FxCopCmd.exe /project:D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject.sln.20190926100022.fxcop /ruleset:=D:\Sonarqube\04_TargetProject\MySampleProject\D\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0\fxcop-sonarqube.ruleset /out:D:\Sonarqube\04_TargetProject\MySampleProject\D\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0\fxcop-report.xml /outxsl:none /forceoutput /searchgac /directory:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools\FxCop\Rules\SNUBHCustomRule.dll /reference:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools\FxCop\Rules\SNUBHCustomRule.dll
INFO: Executing command: D:\Sonarqube\03_FxCop\FxCopCmd.exe /project:D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject.sln.20190926100022.fxcop /ruleset:=D:\Sonarqube\04_TargetProject\MySampleProject\D\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0\fxcop-sonarqube.ruleset /out:D:\Sonarqube\04_TargetProject\MySampleProject\D\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0\fxcop-report.xml /outxsl:none /forceoutput /searchgac /directory:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools\FxCop\Rules\SNUBHCustomRule.dll /reference:C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Team Tools\Static Analysis Tools\FxCop\Rules\SNUBHCustomRule.dll
INFO: Microsoft (R) FxCop Command-Line Tool, Version 10.0 (10.0.30319.1) X86
INFO: Copyright (C) Microsoft Corporation, All Rights Reserved.
INFO:
INFO: Loading D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject.sln.20190926100022.fxcop...
INFO: Loaded DesignRules.dll...
INFO: Loaded GlobalizationRules.dll...
INFO: Loaded InteroperabilityRules.dll...
INFO: Loaded MobilityRules.dll...
INFO: Loaded NamingRules.dll...
INFO: Loaded PerformanceRules.dll...
INFO: Loaded PortabilityRules.dll...
INFO: Loaded SecurityRules.dll...
INFO: Loaded UsageRules.dll...
INFO: Initializing Introspection engine...
INFO: Analyzing...
INFO: Analysis Complete.
INFO: Writing 2 messages...
INFO: Writing report to D:\Sonarqube\04_TargetProject\MySampleProject\D\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar\mod0\fxcop-report.xml...
INFO: Done:00:00:01.1591416
INFO: FxCopCmd.exe ended with the exit code: 0
INFO: FxCop found 2 issue(s).
INFO: Sensor FxCop (cs) [fxcop] (done) | time=1479ms
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: -------------  Scan MyProject
INFO: Base dir: D:\Sonarqube\04_TargetProject\MySampleProject\MySampleProject
INFO: Working dir: D:\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\.sonar
INFO: Source encoding: UTF-8, default locale: ko_KR
INFO: Index files
INFO: 0 files indexed
INFO: Sensor C# [csharp]
INFO: Importing results from 5 proto files in 'D:\Sonarqube\04_TargetProject\MySampleProject\.sonarqube\out\0\output-cs'
INFO: Importing 1 Roslyn report
INFO: Sensor C# [csharp] (done) | time=145ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=16ms
INFO: Sensor CPD Block Indexer
INFO: Sensor CPD Block Indexer (done) | time=1ms
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.
INFO: Calculating CPD for 2 files
INFO: CPD calculation finished
INFO: Analysis report generated in 112ms, dir size=19 KB
INFO: Analysis reports compressed in 26ms, zip size=9 KB
INFO: Analysis report uploaded in 33ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9677/dashboard/index/MyProject_Key
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9677/api/ce/task?id=AW1rFVoghDls_WAtJ_V5
INFO: Task total time: 3.015 s
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.904s
INFO: Final Memory: 14M/219M
INFO: ------------------------------------------------------------------------
The SonarQube Scanner has finished
10:00:24.744  Post-processing succeeded.

enter image description here enter image description here enter image description here enter image description here enter image description here

...