forked from jscs-dev/node-jscs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLI: Support a maxErrors option to limit the number of reported errors
Closes jscs-devgh-664 Fixes jscs-dev#238
- Loading branch information
1 parent
37cf0e8
commit 238f38b
Showing
15 changed files
with
192 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var Errors = require('../errors'); | ||
|
||
/** | ||
* Limits the total number of errors reported | ||
* | ||
* @param {Object} config | ||
* @param {lib/checker} instance | ||
*/ | ||
module.exports = function(config, instance) { | ||
if (config.maxErrors) { | ||
Errors.maxErrors = Number(config.maxErrors); | ||
} | ||
|
||
Object.defineProperty(config, 'maxErrors', { | ||
value: config.maxErrors, | ||
enumerable: false | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"disallowKeywords": ["with"], | ||
"requireSpaceBeforePostfixUnaryOperators": ["++"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
test/*.js test/rules/*.js test/options/*.js test/reporters/*.js | ||
test/test-config.js test/*.js test/rules/*.js test/options/*.js test/reporters/*.js | ||
-R dot | ||
-u bdd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var Errors = require('../lib/errors'); | ||
|
||
var largeDefault = 1000000; | ||
|
||
// Set an arbitrarily large number of errors for the tests to bypass | ||
// the maxErrors default of 50 errors. Otherwise, the specs would | ||
// hit the limit and fail the suite. | ||
Errors.maxErrors = largeDefault; | ||
|
||
/** | ||
* Reset maxErrors to the large default value. | ||
* | ||
* Tests for maxError will need to manipulate the constructor's value | ||
* at runtime and need a way to set the testing default | ||
*/ | ||
Errors._resetMaxErrorsForTests = function() { | ||
Errors._resetMaxErrors(); | ||
Errors.maxErrors = largeDefault; | ||
}; | ||
|
||
Errors._resetMaxErrors = function() { | ||
this._errorCount = 0; | ||
this.maxErrors = this._defaultMaxErrors; | ||
}; |