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 350568 b0d514b7bf0cb2ce484ce0cbd1524670c0d8975f
parent 350567 dacddb224d32cd5f979fa4b53e702c7dc69be46c
child 350569 e432b80ec56b7a4988be19eba490069fdc81988b
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [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)]