Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JSON report output for Code Quality? #2108

Unanswered
salderma asked this question in Q&A
Discussion options

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?

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /