-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathinspectcode.ps1
More file actions
24 lines (18 loc) · 1.16 KB
/
inspectcode.ps1
File metadata and controls
24 lines (18 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#Requires -Version 7.4
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
# This script runs code inspection and opens the results in a web browser.
dotnet tool restore
$solutionFile = 'JsonApiDotNetCore.MongoDb.sln'
$outputPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.xml')
$resultPath = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), 'jetbrains-inspectcode-results.html')
dotnet jb inspectcode --version
dotnet jb inspectcode $solutionFile --dotnetcoresdk=$(dotnet --version) --build --output="$outputPath" --format="xml" --profile=WarningSeverities.DotSettings --properties:Configuration=Release --properties:RunAnalyzers=false --severity=WARNING --verbosity=WARN -dsl=GlobalAll -dsl=GlobalPerProduct -dsl=SolutionPersonal -dsl=ProjectPersonal
[xml]$xml = Get-Content "$outputPath"
if ($xml.report.Issues -and $xml.report.Issues.Project) {
$xslt = new-object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load("$pwd/JetBrainsInspectCodeTransform.xslt");
$xslt.Transform($outputPath, $resultPath);
Write-Output "Opening results in browser"
Invoke-Item "$resultPath"
}