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
Add fixable status to verbose
and github
formatters
#6183
Conversation
I like the addition, especially to the verbose formatter as I feel that those users want as much information as possible. The thing is, not all problems can be fixed by a rule; sometimes we fix only for certain options or we ignore some edge cases. Do we need to communicate that here? For example, by using "maybe fixable" instead of "fixable":
People may be confused if they see "fixable", run "--fix" and then still see the problem listed. |
In addition, what if showing the following message (only when fixable problems are found), for example?
Is this too verbose? Code changediff --git a/lib/formatters/verboseFormatter.js b/lib/formatters/verboseFormatter.js
index 2c3c9c55b..11742ab1f 100644
--- a/lib/formatters/verboseFormatter.js
+++ b/lib/formatters/verboseFormatter.js
@@ -55,6 +55,7 @@ module.exports = function verboseFormatter(results, returnValue) {
output += '\n0 problems found\n';
} else {
const warningsBySeverity = groupBy(warnings, (w) => w.severity);
+ let fixableProblemsFound = false;
/**
* @param {Severity} severity
@@ -75,11 +76,17 @@ module.exports = function verboseFormatter(results, returnValue) {
const fixable = meta && meta.fixable ? ' (maybe fixable)' : '';
output += dim(` ${ruleLink(rule, meta)}: ${list.length}${fixable}\n`);
+
+ if (!fixableProblemsFound && meta && meta.fixable) fixableProblemsFound = true;
}
};
printProblems('error');
printProblems('warning');
+
+ if (fixableProblemsFound) {
+ output += yellow('\nYou may fix some problems with the "--fix" option.\n');
+ }
}
return `${output}\n`; |
verbose
and github
formattersverbose
and github
formatters
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.
LGTM, thank you!
In addition, what if showing the following message (only when fixable problems are found)
👍
Thanks for the feedback!
Changed via b2c92ef. |
Changelog entry added:
|
@jeddy3 Should we enforce the addition of one skipped test per edge case not covered? |
Ref: #6099
In this pull request, I try showing fixable metadata with the
verbose
andgithub
formatters.But I’m not sure whether this addition is really useful. I would be happy if any feedback.
Demo on localhost: