-
-
Notifications
You must be signed in to change notification settings - Fork 162
Expand file tree
/
Copy pathinspectcode.ps1
More file actions
24 lines (18 loc) · 1.18 KB
/
inspectcode.ps1
File metadata and controls
24 lines (18 loc) · 1.18 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.slnx'
$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 --build --no-updates --dotnetcoresdk=$(dotnet --version) --output="$outputPath" --format="xml" --settings=WarningSeverities.DotSettings --properties:"Configuration=Release;RunAnalyzers=false;NuGetAudit=false" --severity=WARNING --verbosity=WARN --disable-settings-layers="GlobalAll;GlobalPerProduct;SolutionPersonal;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"
}