-
Notifications
You must be signed in to change notification settings - Fork 510
CLI: Support a maxErrors option to limit the number of reported errors (fixes #664, fixes #238) #673
Conversation
bbff037
to
44d0deb
Compare
This seems far more confusing to me than the other pull request. The math and reaching into prototypes of parent simply to avoid a shared value between error instances seems like unnecessary contortion. Furthermore, this unnecessarily checks each file even after the limit is already hit. |
* @returns {Errors} | ||
*/ | ||
Checker.prototype.checkString = function(str, filename) { | ||
var errors = StringChecker.prototype.checkString.apply(this, arguments); |
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.
is there any reason not to move this behavior up into StringChecker?
Still, I think this implementation IS cleaner than the @mrjoelkemp version. |
24386f3
to
8eee218
Compare
Moved the logic into StringChecker. Its looks simpler, thank you!
Fixed this. |
@@ -135,6 +139,10 @@ module.exports = function(program) { | |||
|
|||
reporter(errorsCollection); | |||
|
|||
if (checker.maxErrorsExceeded()) { | |||
console.log('Too many errors... Increase `maxErrors` configuration option value to see more.'); |
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.
So this would not come up if user doesn't use TTY?
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.
+1. Nice work, Marat.
On Oct 8, 2014 6:13 PM, "Oleg Gaidarenko" notifications@github.com wrote:
In lib/cli.js:
@@ -135,6 +139,10 @@ module.exports = function(program) {
reporter(errorsCollection);
if (checker.maxErrorsExceeded()) {
console.log('Too many errors... Increase `maxErrors` configuration option value to see more.');
So this would not come up if user doesn't use TTY?
—
Reply to this email directly or view it on GitHub
https://github.com/jscs-dev/node-jscs/pull/673/files#r18615530.
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.
So this would not come up if user doesn't use TTY?
You mean browser version? If so, we don't even include reporters there. Users are free to implement their own reactions.
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.
No, when dealing with piped stdin input. We should show this error message
too
On Oct 9, 2014 6:02 AM, "Marat Dulin" notifications@github.com wrote:
In lib/cli.js:
@@ -135,6 +139,10 @@ module.exports = function(program) {
reporter(errorsCollection);
if (checker.maxErrorsExceeded()) {
console.log('Too many errors... Increase `maxErrors` configuration option value to see more.');
So this would not come up if user doesn't use TTY?
You mean browser version? If so, we don't even include reporters there.
Users are free to implement their own reactions.—
Reply to this email directly or view it on GitHub
https://github.com/jscs-dev/node-jscs/pull/673/files#r18636360.
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.
I still think the max errors exceeded itself should be an error, like in JSHint.
In fact, I still contend that all info from JSCS should be reported as style violations, like we did when deprecated rules or converted the errors from esprima.
/cc @mrjoelkemp |
When can we land this? Should we land a follow up commit fixing the stdin issue and adding tests? 1.7 is long overdue. |
Seems like we just need to resolve how to display the maxError message. Release tomorrow? |
8eee218
to
d00b31c
Compare
Added message display call to STDIN-handling code. Is it correct? If so, I'm ready to merge. |
Looks good. I'll file an issue to write a test for the stdin case, but it looks fine as is. Nice work! So excited for the release :) |
OK) Merging. |
d00b31c
to
bbf85df
Compare
There was comment by @mikesherov somewhere with similar idea - instead writing That way every reporters would work as of now but user would know (even in CI run) that JSCS didn't check everything and bail out. Which allow us to change default value of How is that sounds? |
@markelog how would it stop us from breaking backwards compatibility? |
Any error we could report as a style violation is better than any error we report only in some reporters or as exceptions. By reporting the 51st error as a line violation would allow us to stop early without having the user possibly not see the reason why. In this way, we can be confident in lower the default max error without leaving our users in the dark. We could change the default, and be confident users would know how to fix it should they want to disable maxErrors. |
@mikesherov yep, exactly my train of thought |
Agreed about the benefits of showing maxerr as an error. Is this a blocker for 1.7? Could this follow up change be pushed to 1.8? |
This change should not be that hard to implement |
I agree with @mikesherov about reporting style about this error. But right now I'm talking about current CI-integrations and Instruments (like Sublime integration) which expect all errors to be reported. For them changing this option value from |
According to our release semantics that we agreed upon: Minor Release:
Therefore, it is perfectly acceptable to reduce maxErrors to whatever On Tue, Oct 14, 2014 at 8:44 AM, Marat Dulin notifications@github.com
Mike Sherov |
Should we say 1.7 ships with no default (it's opt-in) and 2.0 lowers the
|
I guess, this not applicable for 1.7, since we changed and fixed a lot before accepting this protocol, we probably should use this logic for the next releases but not for 1.7.
hmm, that wouldn't be a problem if this option wouldn't be used for the whole run, but for individual files.
They will definitely see this last problem and could react accordingly, in my head they do :-)
Those plugins lint one file at the time, so they gonna see plenty, might be a problem though. |
and btw @mikesherov Modifying rules not options. |
Let's agree on change the default for 2.0 and discuss whole run vs individual files? |
This is a difference without a distinction. The effect is the same.
Fair enough. |
cool |
I started on #664 and remade this to be simpler and non-static.