Bug 1397423 - Enable py2 linter on python/mozlint. r=ahal
authorSteve Armand <stevea1@mac.com>
Wed, 06 Sep 2017 22:52:46 -0400
changeset 428960 47da53b3d3e7de7c69354566c69f81874fcb4990
parent 428959 6e5e7386357e47cc38d7e4f8428e08b6efdeda7a
child 428961 515aab24cac41fe8804e6ebeabe2f8c9323d5b5e
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1397423
milestone57.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 1397423 - Enable py2 linter on python/mozlint. r=ahal MozReview-Commit-ID: 6QX7YCmfjdJ
python/mozlint/mozlint/__init__.py
python/mozlint/mozlint/cli.py
python/mozlint/mozlint/editor.py
python/mozlint/mozlint/errors.py
python/mozlint/mozlint/formatters/__init__.py
python/mozlint/mozlint/formatters/compact.py
python/mozlint/mozlint/formatters/stylish.py
python/mozlint/mozlint/formatters/treeherder.py
python/mozlint/mozlint/parser.py
python/mozlint/mozlint/result.py
python/mozlint/mozlint/roller.py
python/mozlint/mozlint/types.py
python/mozlint/mozlint/vcs.py
python/mozlint/setup.py
python/mozlint/test/conftest.py
python/mozlint/test/files/foobar.py
python/mozlint/test/linters/external.py
python/mozlint/test/test_cli.py
python/mozlint/test/test_formatters.py
python/mozlint/test/test_parser.py
python/mozlint/test/test_roller.py
python/mozlint/test/test_types.py
python/mozlint/test/test_vcs.py
tools/lint/py2.yml
--- a/python/mozlint/mozlint/__init__.py
+++ b/python/mozlint/mozlint/__init__.py
@@ -1,7 +1,9 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 # flake8: noqa
 
+from __future__ import absolute_import
+
 from .roller import LintRoller
 from .result import ResultContainer
--- a/python/mozlint/mozlint/cli.py
+++ b/python/mozlint/mozlint/cli.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import print_function, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 import sys
 from argparse import REMAINDER, ArgumentParser
 
 from mozlint.formatters import all_formatters
 
 SEARCH_PATHS = []
--- a/python/mozlint/mozlint/editor.py
+++ b/python/mozlint/mozlint/editor.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals, print_function
+from __future__ import absolute_import, unicode_literals, print_function
 
 import os
 import subprocess
 import tempfile
 
 from mozlint import formatters
 
 
--- a/python/mozlint/mozlint/errors.py
+++ b/python/mozlint/mozlint/errors.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 
 
 class LintException(Exception):
     pass
 
 
 class LinterNotFound(LintException):
--- a/python/mozlint/mozlint/formatters/__init__.py
+++ b/python/mozlint/mozlint/formatters/__init__.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import json
 
 from ..result import ResultEncoder
 from .compact import CompactFormatter
 from .stylish import StylishFormatter
 from .treeherder import TreeherderFormatter
 
 
--- a/python/mozlint/mozlint/formatters/compact.py
+++ b/python/mozlint/mozlint/formatters/compact.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 from ..result import ResultContainer
 
 
 class CompactFormatter(object):
     """Formatter for compact output.
 
     This formatter prints one error per line, mimicking the
--- a/python/mozlint/mozlint/formatters/stylish.py
+++ b/python/mozlint/mozlint/formatters/stylish.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 from ..result import ResultContainer
 
 try:
     import blessings
 except ImportError:
     blessings = None
 
--- a/python/mozlint/mozlint/formatters/treeherder.py
+++ b/python/mozlint/mozlint/formatters/treeherder.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 from ..result import ResultContainer
 
 
 class TreeherderFormatter(object):
     """Formatter for treeherder friendly output.
 
     This formatter looks ugly, but prints output such that
--- a/python/mozlint/mozlint/parser.py
+++ b/python/mozlint/mozlint/parser.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 
 import yaml
 
 from .types import supported_types
 from .errors import LinterNotFound, LinterParseError
 
 
--- a/python/mozlint/mozlint/result.py
+++ b/python/mozlint/mozlint/result.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 from json import dumps, JSONEncoder
 
 
 class ResultContainer(object):
     """Represents a single lint error and its related metadata.
 
     :param linter: name of the linter that flagged this error
     :param path: path to the file containing the error
--- a/python/mozlint/mozlint/roller.py
+++ b/python/mozlint/mozlint/roller.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 import signal
 import sys
 import traceback
 from collections import defaultdict
 from concurrent.futures import ProcessPoolExecutor
 from multiprocessing import cpu_count
--- a/python/mozlint/mozlint/types.py
+++ b/python/mozlint/mozlint/types.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 import re
 import sys
 from abc import ABCMeta, abstractmethod
 
 from mozlog import get_default_logger, commandline, structuredlog
 from mozlog.reader import LogHandler
 
--- a/python/mozlint/mozlint/vcs.py
+++ b/python/mozlint/mozlint/vcs.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import, print_function
+
 import os
 import subprocess
 
 
 class VCSHelper(object):
     """A base VCS helper that always returns an empty list
     for the case when no version control was found.
     """
--- a/python/mozlint/setup.py
+++ b/python/mozlint/setup.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 from setuptools import setup
 
 VERSION = 0.1
 DEPS = ["mozlog>=3.4"]
 
 setup(
     name='mozlint',
     description='Framework for registering and running micro lints',
--- a/python/mozlint/test/conftest.py
+++ b/python/mozlint/test/conftest.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 import sys
 
 import pytest
 
 from mozlint import LintRoller
 
 
--- a/python/mozlint/test/files/foobar.py
+++ b/python/mozlint/test/files/foobar.py
@@ -1,2 +1,5 @@
 # Oh no.. we called this variable foobar, bad!
+
+from __future__ import absolute_import
+
 foobar = "a string"
--- a/python/mozlint/test/linters/external.py
+++ b/python/mozlint/test/linters/external.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 from mozlint import result
 from mozlint.errors import LintException
 
 
 def badreturncode(files, config, **lintargs):
     return 1
 
 
--- a/python/mozlint/test/test_cli.py
+++ b/python/mozlint/test/test_cli.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 from distutils.spawn import find_executable
 
 import mozunit
 import pytest
 
 from mozlint import cli
 
--- a/python/mozlint/test/test_formatters.py
+++ b/python/mozlint/test/test_formatters.py
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-from __future__ import unicode_literals
+from __future__ import absolute_import, unicode_literals
 
 import json
 from collections import defaultdict
 
 import mozunit
 import pytest
 
 from mozlint import ResultContainer
--- a/python/mozlint/test/test_parser.py
+++ b/python/mozlint/test/test_parser.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 
 import mozunit
 import pytest
 
 from mozlint.parser import Parser
 from mozlint.errors import (
     LinterNotFound,
--- a/python/mozlint/test/test_roller.py
+++ b/python/mozlint/test/test_roller.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 import sys
 
 import mozunit
 import pytest
 
 from mozlint import ResultContainer
 from mozlint.errors import LintersNotConfigured, LintException
--- a/python/mozlint/test/test_types.py
+++ b/python/mozlint/test/test_types.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 
 import mozunit
 import pytest
 
 from mozlint.result import ResultContainer
 
 
--- a/python/mozlint/test/test_vcs.py
+++ b/python/mozlint/test/test_vcs.py
@@ -1,12 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+from __future__ import absolute_import
+
 import os
 import subprocess
 
 import mozunit
 import pytest
 
 from mozlint.vcs import VCSHelper, vcs_class
 
--- a/tools/lint/py2.yml
+++ b/tools/lint/py2.yml
@@ -27,17 +27,16 @@ py2:
         - netwerk
         - nsprpub
         - other-licenses
         - probes/trace-gen.py
         - python/devtools
         - python/mach
         - python/mozboot
         - python/mozbuild
-        - python/mozlint
         - python/mozversioncontrol
         - security
         - services/common/tests/mach_commands.py
         - servo
         - testing/awsy
         - testing/firefox-ui
         - testing/geckodriver
         - testing/gtest