當使用MSBuild針對項目運行各種分析器時,所有故障都將以「靜態分析結果交換格式(SARIF)」格式輸出(請參閱例如https://github.com/sarif-standard/sarif-spec)。例如構建可產生以下解析MSBuild中的「靜態分析結果交換格式(SARIF)」
{
"version": "0.1",
"toolInfo": {
"toolName": "Microsoft (R) Visual C# Compiler",
"productVersion": "1.1.0",
"fileVersion": "1.1.0"
},
"issues": [
{
"ruleId": "SA1401",
"locations": [
{
"analysisTarget": [
{
"uri": "C:\\SomeFile.cs",
"region": {
"startLine": 708,
"startColumn": 30,
"endLine": 708,
"endColumn": 36
}
}
]
}
],
"shortMessage": "Field must be private",
"fullMessage": "A field within a C# class has an access modifier other than private.",
"properties": {
"severity": "Warning",
"warningLevel": "1",
"defaultSeverity": "Warning",
"title": "Fields must be private",
"category": "StyleCop.CSharp.MaintainabilityRules",
"helpLink": "https:\/\/github.com\/DotNetAnalyzers\/StyleCopAnalyzers\/blob\/master\/documentation\/SA1401.md",
"isEnabledByDefault": "True",
"isSuppressedInSource": "True"
}
}
]
}
現在我想能夠在可能的最簡單的方法來分析上述數據(如果遇到任何非抑制問題打破建立)。如何去做這件事?
PS。最好我也想避免實現我自己的MSBuild任務並安裝特定的軟件(例如PowerShell 3.0 - ConvertFrom-Json)。