Bug 1307622: Fix handling of ignored file warnings. r=Mossop a=npotb DONTBUILD
authorKris Maglione <maglione.k@gmail.com>
Tue, 04 Oct 2016 22:44:50 +0100
changeset 355963 cf891143381c8923e5ca428eec9c30d90a9f66a4
parent 355962 f4eca83603d1891caf183f8e7bed1760caef144f
child 355964 b83e34a6ef7c560d8373ffa21e74b38ed290cc75
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop, npotb
Bug 1307622: Fix handling of ignored file warnings. r=Mossop a=npotb DONTBUILD MozReview-Commit-ID: EV3YPfsSSDS
--- a/tools/mercurial/eslintvalidate.py
+++ b/tools/mercurial/eslintvalidate.py
@@ -3,30 +3,33 @@
 import os
 import sys
 import re
 import json
 from subprocess import check_output, CalledProcessError
 lintable = re.compile(r'.+\.(?:js|jsm|jsx|xml|html)$')
-ignored = "File ignored because of your .eslintignore file. Use --no-ignore to override."
+ignored = 'File ignored because of a matching ignore pattern. Use "--no-ignore" to override.'
 def is_lintable(filename):
     return lintable.match(filename)
 def display(ui, output):
     results = json.loads(output)
     for file in results:
         path = os.path.relpath(file["filePath"])
         for message in file["messages"]:
             if message["message"] == ignored:
-            ui.warn("%s:%d:%d %s\n" % (path, message["line"], message["column"], message["message"]))
+            if "line" in message:
+                ui.warn("%s:%d:%d %s\n" % (path, message["line"], message["column"], message["message"]))
+            else:
+                ui.warn("%s: %s\n" % (path, message["message"]))
 def eslinthook(ui, repo, node=None, **opts):
     ctx = repo[node]
     if len(ctx.parents()) > 1:
         return 0
     deleted = repo.status(ctx.p1().node(), ctx.node()).deleted
     files = [f for f in ctx.files() if f not in deleted and is_lintable(f)]