Description
Summary of the new feature
In microsoft/PowerShellForGitHub
, we wanted to have PSScriptAnalyzer run in our CI system (we happen to be using Azure DevOps, but that's besides the point). This project is great, but its output doesn't lend itself well to CI reporting systems.
I ended up putting together a script that will take the results from an Invoke-ScriptAnalyzer
run, and output an NUnit-style XML result file that can then be used to display clear UT-style results in any CI system that supports that file format (which is most of them).
You can see the change as it was implemented here: microsoft/PowerShellForGitHub#211.
It was intentionally written generically to make it easy for anyone to re-use it in their own project.
It creates a test for every Rule, and makes them pass unless there was a failure in that rule, and then it adds a test failure within that rule for each actual test failure. You can see an example build with a failure reported in the Tests tab here (but only if you have permission to the ms
org for some reason).
My suggestion is to directly include that file along with some snippets of how to use it in various CI systems (I can easily include a snippet for using it in Azure DevOps, and I'm sure someone familiar with AppVeyor or other systems could adapt it to those systems too.
Proposed technical implementation details (optional)**
Example screenshots from build
What is the latest version of PSScriptAnalyzer at the point of writing
v1.19.0