From 08d5fcd935afe685579bb6b7395bf5752adea32b Mon Sep 17 00:00:00 2001 From: Steve Armand Date: Wed, 6 Sep 2017 22:52:46 -0400 Subject: [PATCH] Bug 1397423 - Enable py2 linter on python/mozlint. r=ahal MozReview-Commit-ID: 6QX7YCmfjdJ --HG-- extra : rebase_source : 0610d67f376c462b0f103a6510f21459fc39f940 --- python/mozlint/mozlint/__init__.py | 2 ++ python/mozlint/mozlint/cli.py | 2 +- python/mozlint/mozlint/editor.py | 2 +- python/mozlint/mozlint/errors.py | 2 ++ python/mozlint/mozlint/formatters/__init__.py | 2 ++ python/mozlint/mozlint/formatters/compact.py | 2 +- python/mozlint/mozlint/formatters/stylish.py | 2 +- python/mozlint/mozlint/formatters/treeherder.py | 2 +- python/mozlint/mozlint/parser.py | 2 ++ python/mozlint/mozlint/result.py | 2 ++ python/mozlint/mozlint/roller.py | 2 +- python/mozlint/mozlint/types.py | 2 +- python/mozlint/mozlint/vcs.py | 2 ++ python/mozlint/setup.py | 2 ++ python/mozlint/test/conftest.py | 2 ++ python/mozlint/test/files/foobar.py | 3 +++ python/mozlint/test/linters/external.py | 2 ++ python/mozlint/test/test_cli.py | 2 ++ python/mozlint/test/test_formatters.py | 2 +- python/mozlint/test/test_parser.py | 2 ++ python/mozlint/test/test_roller.py | 2 ++ python/mozlint/test/test_types.py | 2 ++ python/mozlint/test/test_vcs.py | 2 ++ tools/lint/py2.yml | 1 - 24 files changed, 39 insertions(+), 9 deletions(-) diff --git a/python/mozlint/mozlint/__init__.py b/python/mozlint/mozlint/__init__.py index 18eaf5112503..5b4ec3addbe6 100644 --- a/python/mozlint/mozlint/__init__.py +++ b/python/mozlint/mozlint/__init__.py @@ -3,5 +3,7 @@ # 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 diff --git a/python/mozlint/mozlint/cli.py b/python/mozlint/mozlint/cli.py index 8c2943c4aa05..dd3c7ef5725a 100644 --- a/python/mozlint/mozlint/cli.py +++ b/python/mozlint/mozlint/cli.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/editor.py b/python/mozlint/mozlint/editor.py index 2da06538af4d..aa68fec13137 100644 --- a/python/mozlint/mozlint/editor.py +++ b/python/mozlint/mozlint/editor.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/errors.py b/python/mozlint/mozlint/errors.py index a899a1974c09..6b3a599bb9d3 100644 --- a/python/mozlint/mozlint/errors.py +++ b/python/mozlint/mozlint/errors.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/mozlint/formatters/__init__.py b/python/mozlint/mozlint/formatters/__init__.py index 0fc41fa72894..4f69ce4a63c7 100644 --- a/python/mozlint/mozlint/formatters/__init__.py +++ b/python/mozlint/mozlint/formatters/__init__.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/mozlint/formatters/compact.py b/python/mozlint/mozlint/formatters/compact.py index 5637f8f58509..405f2a2642c4 100644 --- a/python/mozlint/mozlint/formatters/compact.py +++ b/python/mozlint/mozlint/formatters/compact.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/formatters/stylish.py b/python/mozlint/mozlint/formatters/stylish.py index da00c87e55a7..b94c8a662d57 100644 --- a/python/mozlint/mozlint/formatters/stylish.py +++ b/python/mozlint/mozlint/formatters/stylish.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/formatters/treeherder.py b/python/mozlint/mozlint/formatters/treeherder.py index 716f958fbd8e..c3c2ec25c928 100644 --- a/python/mozlint/mozlint/formatters/treeherder.py +++ b/python/mozlint/mozlint/formatters/treeherder.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/parser.py b/python/mozlint/mozlint/parser.py index 5eb7f4b22990..bac3bac89fee 100644 --- a/python/mozlint/mozlint/parser.py +++ b/python/mozlint/mozlint/parser.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/mozlint/result.py b/python/mozlint/mozlint/result.py index 5777369dfabd..753a72121866 100644 --- a/python/mozlint/mozlint/result.py +++ b/python/mozlint/mozlint/result.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/mozlint/roller.py b/python/mozlint/mozlint/roller.py index 45950567ee01..ed41208fd0e8 100644 --- a/python/mozlint/mozlint/roller.py +++ b/python/mozlint/mozlint/roller.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/types.py b/python/mozlint/mozlint/types.py index a07164783ff3..a081318fc38d 100644 --- a/python/mozlint/mozlint/types.py +++ b/python/mozlint/mozlint/types.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/mozlint/vcs.py b/python/mozlint/mozlint/vcs.py index ab79b20300d8..800ff2eb422a 100644 --- a/python/mozlint/mozlint/vcs.py +++ b/python/mozlint/mozlint/vcs.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/setup.py b/python/mozlint/setup.py index 62d25c38b3be..755511d3d726 100644 --- a/python/mozlint/setup.py +++ b/python/mozlint/setup.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/conftest.py b/python/mozlint/test/conftest.py index 896fe821c33f..113dc16f24bb 100644 --- a/python/mozlint/test/conftest.py +++ b/python/mozlint/test/conftest.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/files/foobar.py b/python/mozlint/test/files/foobar.py index e1677b3fd244..441f954ec18f 100644 --- 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" diff --git a/python/mozlint/test/linters/external.py b/python/mozlint/test/linters/external.py index 0f418af07a66..2a0193ece5ec 100644 --- a/python/mozlint/test/linters/external.py +++ b/python/mozlint/test/linters/external.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/test_cli.py b/python/mozlint/test/test_cli.py index 11b91c65072d..74a03165f0b7 100644 --- a/python/mozlint/test/test_cli.py +++ b/python/mozlint/test/test_cli.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/test_formatters.py b/python/mozlint/test/test_formatters.py index b1061f06f5d7..4fd34dfc15a5 100644 --- a/python/mozlint/test/test_formatters.py +++ b/python/mozlint/test/test_formatters.py @@ -2,7 +2,7 @@ # 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 diff --git a/python/mozlint/test/test_parser.py b/python/mozlint/test/test_parser.py index f9ab92cb7b97..dae0673d24e9 100644 --- a/python/mozlint/test/test_parser.py +++ b/python/mozlint/test/test_parser.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/test_roller.py b/python/mozlint/test/test_roller.py index 788c8a5837d4..631371caf03c 100644 --- a/python/mozlint/test/test_roller.py +++ b/python/mozlint/test/test_roller.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/test_types.py b/python/mozlint/test/test_types.py index 4275a251ee9b..4d343aa209ac 100644 --- a/python/mozlint/test/test_types.py +++ b/python/mozlint/test/test_types.py @@ -2,6 +2,8 @@ # 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 diff --git a/python/mozlint/test/test_vcs.py b/python/mozlint/test/test_vcs.py index c0b9a63f31b0..7cdf073bdeb5 100644 --- a/python/mozlint/test/test_vcs.py +++ b/python/mozlint/test/test_vcs.py @@ -2,6 +2,8 @@ # 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 diff --git a/tools/lint/py2.yml b/tools/lint/py2.yml index 71a5973c2389..3269504b026a 100644 --- a/tools/lint/py2.yml +++ b/tools/lint/py2.yml @@ -32,7 +32,6 @@ py2: - python/mach - python/mozboot - python/mozbuild - - python/mozlint - python/mozversioncontrol - security - services/common/tests/mach_commands.py