-
Notifications
You must be signed in to change notification settings - Fork 51
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
CHANGE (CodeAnalyzer): @W-14009441@: create output file when no violations are found #1170
Changes from all commits
d3035fe
4bd02ee
84362bc
a12f852
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,21 +28,11 @@ export class RunOutputProcessor { | |
|
||
|
||
public processRunOutput(rrr: RecombinedRuleResults): AnyJson { | ||
const {minSev, summaryMap, results} = rrr; | ||
// If the results are an empty string, it means no violations were found. | ||
if (results === '') { | ||
// Build an appropriate message... | ||
const msg = messages.getMessage('output.noViolationsDetected', [[...summaryMap.keys()].join(', ')]); | ||
// ...log it to the console... | ||
this.ux.log(msg); | ||
// ...and return it for use with the --json flag. | ||
return msg; | ||
} | ||
Comment on lines
-31
to
-40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this shortcut return is the main change here. The logic below works fine with 0 violations, it now returns Most of the other changes in this PR are a result of removing these lines. The other changes involve updating the automated tests. |
||
const {minSev, results} = rrr; | ||
|
||
// If we actually have violations, there's some stuff we need to do with them. We'll build an array of message parts, | ||
// and then log them all at the end. | ||
// With the list of violations, we'll build an array of message parts, and then log them all at the end. | ||
let msgComponents: string[] = []; | ||
// We need a summary of the information we were provided. | ||
// We need a summary of the information we were provided (blank/empty if no violations). | ||
msgComponents = [...msgComponents, ...this.buildRunSummaryMsgParts(rrr)]; | ||
// We need to surface the results directly to the user, then add a message describing what we did. | ||
msgComponents.push(this.opts.outfile ? this.writeToOutfile(results) : this.writeToConsole(results)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message is now no longer used, anywhere. Instead, the above message is used. If there are no violations, a message similar to
Executed sfge, found 0 violation(s) across 0 file(s)
is printed.