Skip to content
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

Do not duplicate reported warnings/errors #3050

Merged
merged 4 commits into from Oct 20, 2016

Conversation

jugglinmike
Copy link
Member

The final commit is where it's at. The first two (along with #3049 before them) address more minor bugs in service of that change.

@coveralls
Copy link

coveralls commented Oct 18, 2016

Coverage Status

Coverage decreased (-0.002%) to 97.748% when pulling 1473f5a on jugglinmike:duplicate-errors into f7eb3d7 on jshint:master.

@jugglinmike
Copy link
Member Author

As near as I can tell, the decrease in code coverage is due to the fact that
this patch reduces the total number of overall branches. It introduces only one
new branch (the nested for loop within the new lintEvaled function), and
that is definitely under test here.

function addInternalSrc(elem, src) {
var i;
i = {
function addInternalSrc(elem, token) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're refactoring, it makes sense to rename this more appropriate, perhaps: addEvalCode. https://tc39.github.io/ecma262/#sec-types-of-source-code

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me!

* @param {object} options - linting options to apply
* @param {object} globals - globally-defined bindings for the evaluated code
*/
function lintEvaled(internals, options, globals) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe lintEvalCode()? To match the earlier suggestion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect

@@ -126,7 +132,8 @@ exports.setup.testRun = function (test, name) {

test.ok(
undefinedErrors.length === 0
&& unthrownErrors.length === 0 && wrongLineNumbers.length === 0,
&& unthrownErrors.length === 0 && wrongLineNumbers.length === 0
&& duplicateErrors.length === 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick ctrl-f of this file shows that this is the only place where the logical operator is at the beginning of the line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch--updated

@rwaldron
Copy link
Member

Awaiting green light from CI

@coveralls
Copy link

coveralls commented Oct 20, 2016

Coverage Status

Coverage increased (+0.005%) to 97.754% when pulling b60b99e on jugglinmike:duplicate-errors into f7eb3d7 on jshint:master.

When a "rest" operator is not followed by the identifier, report the
value of the unexpected token (not the "rest" operator itself).
Extend the testing infrastructure to recognize cases where identical
warnings/errors are being reported, and address the areas of the code
base that previously suffered from this problem.
The name `addEvalCode` more directly relates to relevant language in the
ECMA262 specification.
@jugglinmike
Copy link
Member Author

Squashed intermediary commits in preparation for merge to master.

@coveralls
Copy link

coveralls commented Oct 20, 2016

Coverage Status

Coverage decreased (-0.002%) to 97.754% when pulling 6707c54 on jugglinmike:duplicate-errors into af4e000 on jshint:master.

@rwaldron
Copy link
Member

Nice work!

@rwaldron rwaldron merged commit 6707c54 into jshint:master Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants