-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[[FIX]] Limit "Too many Errors" (E043) to errors only #3562
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
Conversation
Makes the E043 condition trigger only for errors and not warnings Closes #3444
This updates maxerr doc to reflect that only errors are considered
Update testRawOnError, insideEval in core and restOperatorWithoutIdentifier in parser tests to reflect maxerr no longer counting in warnings.
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.
Thanks for the patch!
This modifies testRawOnError to make sure maxerr constrain is applied on errors. This adds testRawOnWarning to make sure maxerr constrain does not count warnings.
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.
Looks good; thank you!
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.
gh pr checkout 3562
BillyWildHigh
jugglinmike
Successfully merging this pull request may close these issues.
showing Error (E043) on "Too many errors", when those "Errors" are only warnings
As mentioned in #3444 ,
E043
is triggered with "Too many Errors" even if there are just warnings in the checked code. This happens because the condition to trigger the saidE043
error is:Which clearly checks for the total count of all the messages in
JSHINT.errors
array, The issue is that, this array not only contains errors but also warnings and informative messages. This makes theE043
run even if there are no errors but only warnings exceeding the count defined inmaxerr
config.This PR will modify the condition for running into
E043
, by ignoring all warnings and other messages and considering only errors.This also updates the
maxerr
documentation to reflect the above change.The tests changed to accommodate for the new behavior are:
core.js:testRawOnError
"Too many errors." is no longer being thrown because "Unnecessary semicolon" is a warning (
W032
)core.js:insideEval
Similar case of "Too many errors." not triggering (
maxerr
is set to 1 here) as "eval can be harmful." is a warning (W061
)parser.js:restOperatorWithoutIdentifier
We run into "Too many errors." at
9:22
now instead of8:30
because the warnings in between are no longer considered.This PR closes #3444