Skip to content

Add NUnit Test handling for PSScriptAnalyzer results #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions build/pipelines/templates/run-staticAnalysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,18 @@ steps:
- powershell: |
$results = Invoke-ScriptAnalyzer -Path ./ –Recurse
$results | ForEach-Object { Write-Host "##vso[task.logissue type=$($_.Severity);sourcepath=$($_.ScriptPath);linenumber=$($_.Line);columnnumber=$($_.Column);]$($_.Message)" }

$null = New-Item -Path ..\ -Name ScriptAnalyzer -ItemType Directory -Force
./build/scripts/ConvertTo-NUnitXml.ps1 -ScriptAnalyzerResult $results -Path ../ScriptAnalyzer/test-results.xml
workingDirectory: '$(System.DefaultWorkingDirectory)'
displayName: 'Run Static Code Analysis (PSScriptAnalyzer)'

- task: PublishTestResults@2
displayName: 'Publish ScriptAnalyzer Test Results'
inputs:
testRunTitle: 'Windows Test Results for PSScriptAnalyzer'
buildPlatform: 'Windows'
testRunner: NUnit
testResultsFiles: '../ScriptAnalyzer/test-results.xml'
failTaskOnFailedTests: true # required to fail build when tests fail
condition: succeededOrFailed()
Loading