-
Notifications
You must be signed in to change notification settings - Fork 400
-
Hi, I come form the Linux/Bash world, but have been attempting to provide devops support for my windows oriented colleagues. We're looking for a way to utilize PSScriptAnalyzer output in Gitlab-CI by converting it to a CodeQuality report. I'm looking for tips or ideas.
I've naively attempted something like:
Invoke-ScriptAnalyzer -Path . | ConvertTo-Json -Depth 5 -AsArray
which produces a nice JSON array, but I need to trim it down to just 6 key value pairs per row. Also the key names need to be translated, which should look something like:
Message -> description
RuleName -> check_name
ScriptName -> location.path
StartLineNumber -> location.lines.begin
Severity (numeric) -> severity (string like in normal report output)
...but I'm not sure how to accomplish that directly in powershell. I've seen some examples that use external JSON libraries, but I'm not able to build a custom container to execute this CI job.
A lot of the "LINT" tools have a CLI option for json report output and some provide a report-type option as well. Would adding something like this be a reasonable feature request or is it better left to post-run parsing like I'm currently failing at?
Beta Was this translation helpful? Give feedback.