-
Notifications
You must be signed in to change notification settings - Fork 395
Provide clear instructions for implementing PSScriptAnalyzer in CI systems #1525
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
Comments
The minimalistic way of using PSSA in CI is to use the In terms of the ask for the fancy UI option: You are right that most CI providers accept NUnit style XML for visualisation of test results. This has long been asked for, we already have #1296 and #672 to track that, in fact the |
Thanks @bergmeister we can use #1296 to track the request for NUnit style XML. |
This issue has been marked as duplicate and has not had any activity for 1 day. It will be closed for housekeeping purposes. |
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
The text was updated successfully, but these errors were encountered: