]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Skip the "Too Many Errors" error that is raised by JSHint.
authorJoshua Spence <josh@joshuaspence.com>
Mon, 23 Jun 2014 18:16:15 +0000 (04:16 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Mon, 23 Jun 2014 18:16:15 +0000 (04:16 +1000)
Summary: If JSHint encounters //too many// errors (by default, more than 50) errors, then it quits prematurely and raises an additional (rather unhelpful) "Too Many Errors" error. We should just ignore this additional error.

Test Plan: Added a test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9693

src/lint/linter/ArcanistJSHintLinter.php
src/lint/linter/__tests__/jshint/too-many-errors.lint-test [new file with mode: 0644]

index ea286bc16120d95f620d5224f29530323b67c35e..c81da407c4c38989ccc5bb48c879db8cdaf8fed4 100644 (file)
@@ -31,6 +31,13 @@ final class ArcanistJSHintLinter extends ArcanistExternalLinter {
   protected function getDefaultMessageSeverity($code) {
     if (preg_match('/^W/', $code)) {
       return ArcanistLintSeverity::SEVERITY_WARNING;
+    } else if (preg_match('/^E043$/', $code)) {
+      // TODO: If JSHint encounters a large number of errors, it will quit
+      // prematurely and add an additional "Too Many Errors" error. Ideally, we
+      // should be able to pass some sort of `--force` option to `jshint`.
+      //
+      // See https://github.com/jshint/jshint/issues/180
+      return ArcanistLintSeverity::SEVERITY_DISABLED;
     } else {
       return ArcanistLintSeverity::SEVERITY_ERROR;
     }
diff --git a/src/lint/linter/__tests__/jshint/too-many-errors.lint-test b/src/lint/linter/__tests__/jshint/too-many-errors.lint-test
new file mode 100644 (file)
index 0000000..6dbea1f
--- /dev/null
@@ -0,0 +1,5 @@
+/* jshint maxerr: 1 */
+console.log('foobar')
+~~~~~~~~~~
+disabled:2:22
+warning:2:22