Bug 1309963 - Fix hidden eslint error output when the first line is blank, r=jgraham
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Thu, 13 Oct 2016 16:22:26 -0400
changeset 318221 8e234deee964dd0b1196f3c25f2b630e72f9a77d
parent 318220 bf8f968120761dc2afa09249fe3cdee26f344bf5
child 318222 01cef2481413ced6cbe2ae54f5a48400dbd4920c
push id33222
push userahalberstadt@mozilla.com
push dateMon, 17 Oct 2016 16:32:51 +0000
treeherderautoland@01cef2481413 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1309963
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1309963 - Fix hidden eslint error output when the first line is blank, r=jgraham The 'eslint' linter will assume there is an error message if the output is not valid JSON. However, if output[0] evaluates to False, then it will also replace the output with '[]' (which means success). But if the error starts with a blank line, then output[0] is False and we wrongfully don't print the rest of the message. MozReview-Commit-ID: 9fXpmtlUUT1
tools/lint/eslint.lint
--- a/tools/lint/eslint.lint
+++ b/tools/lint/eslint.lint
@@ -325,18 +325,21 @@ def lint(paths, binary=None, fix=None, s
     signal.signal(signal.SIGINT, orig)
 
     try:
         proc.wait()
     except KeyboardInterrupt:
         proc.kill()
         return []
 
+    if not proc.output:
+        return []  # no output means success
+
     try:
-        jsonresult = json.loads(proc.output[0] or '[]')
+        jsonresult = json.loads(proc.output[0])
     except ValueError:
         print(ESLINT_ERROR_MESSAGE.format("\n".join(proc.output)))
         return 1
 
     results = []
     for obj in jsonresult:
         errors = obj['messages']