-
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
Conversation
@W-14009441@: fill in fake header for csv output @W-14009441@: clean comments/documentation @W-14009441@: fix ancillary tests
1ec8969
to
4bd02ee
Compare
@@ -1,7 +1,6 @@ | |||
module.exports = { | |||
"output": { | |||
"engineSummaryTemplate": "Executed %s, found %s violation(s) across %s file(s).", | |||
"noViolationsDetected": "Executed engines: %s. No rule violations found.", |
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.
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; | ||
} |
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.
Removing this shortcut return is the main change here. The logic below works fine with 0 violations, it now returns []
when there are no violations, instead of an empty string.
Most of the other changes in this PR are a result of removing these lines. The other changes involve updating the automated tests.
outfile
is specified and no violations are found.