Bug 1500447 - [mozlint] Make sure lineno and column are always int (if present), r=rwood
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Fri, 19 Oct 2018 15:54:32 +0000
changeset 490537 96304d13c406be1eb813e7c8cadabd04a8aad12d
parent 490536 0ffed4de7dc0a1ba399a33168e657549d8c559b5
child 490538 95fe4f9c32033b78245886e1e83f70675624977b
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersrwood
bugs1500447
milestone64.0a1
Bug 1500447 - [mozlint] Make sure lineno and column are always int (if present), r=rwood This also updates the test for string inputs. Differential Revision: https://phabricator.services.mozilla.com/D9260
python/mozlint/mozlint/result.py
python/mozlint/test/test_formatters.py
--- a/python/mozlint/mozlint/result.py
+++ b/python/mozlint/mozlint/result.py
@@ -77,18 +77,18 @@ class Issue(object):
         'rule',
         'lineoffset',
     )
 
     def __init__(self, linter, path, message, lineno, column=None, hint=None,
                  source=None, level=None, rule=None, lineoffset=None):
         self.path = path
         self.message = message
-        self.lineno = lineno
-        self.column = column
+        self.lineno = int(lineno)
+        self.column = int(column) if column else column
         self.hint = hint
         self.source = source
         self.level = level or 'error'
         self.linter = linter
         self.rule = rule
         self.lineoffset = lineoffset
 
     def __repr__(self):
--- a/python/mozlint/test/test_formatters.py
+++ b/python/mozlint/test/test_formatters.py
@@ -82,18 +82,18 @@ def result(scope='module'):
             lineno=1,
         ),
         Issue(
             linter='bar',
             path='d/e/f.txt',
             message="oh no bar",
             hint="try baz instead",
             level='warning',
-            lineno=4,
-            column=2,
+            lineno="4",
+            column="2",
             rule="bar-not-allowed",
         ),
         Issue(
             linter='baz',
             path='a/b/c.txt',
             message="oh no baz",
             lineno=4,
             column=10,