Merge mozilla-central to fx-team on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 02 Jun 2016 15:11:25 +0200
changeset 324559 d17d00cb45e0e6ee052dd97f6f0a70ad047a734e
parent 324558 a92a2888973b566c4d4630df3a22869f80ff5587 (current diff)
parent 324537 92e0c73391e71a400e2c6674bca5ca70804ab081 (diff)
child 324560 486cf151cbef9c31e108098c9cf809da6e261225
push id9671
push userraliiev@mozilla.com
push dateMon, 06 Jun 2016 20:27:52 +0000
treeherdermozilla-aurora@cea65ca3d0bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone49.0a1
Merge mozilla-central to fx-team on a CLOSED TREE
python/mozlint/mozlint/formatters/treeherder.py
testing/taskcluster/tasks/tests/mozlint-flake8.yml
--- a/python/mozlint/mozlint/formatters/__init__.py
+++ b/python/mozlint/mozlint/formatters/__init__.py
@@ -1,25 +1,23 @@
 # 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/.
 
 import json
 
 from ..result import ResultEncoder
 from .stylish import StylishFormatter
-from .treeherder import TreeherderFormatter
 
 
 class JSONFormatter(object):
     def __call__(self, results):
         return json.dumps(results, cls=ResultEncoder)
 
 
 all_formatters = {
     'json': JSONFormatter,
     'stylish': StylishFormatter,
-    'treeherder': TreeherderFormatter,
 }
 
 
 def get(name, **fmtargs):
     return all_formatters[name](**fmtargs)
deleted file mode 100644
--- a/python/mozlint/mozlint/formatters/treeherder.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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 ..result import ResultContainer
-
-
-class TreeherderFormatter(object):
-    """Formatter for treeherder friendly output.
-
-    This formatter looks ugly, but prints output such that
-    treeherder is able to highlight the errors and warnings.
-    This is a stop-gap until bug 1276486 is fixed.
-    """
-    fmt = "TEST-UNEXPECTED-{level} | {path}:{lineno}:{column} | {message} ({rule})"
-
-    def __call__(self, result):
-        message = []
-        for path, errors in sorted(result.iteritems()):
-            for err in errors:
-                assert isinstance(err, ResultContainer)
-
-                d = {s: getattr(err, s) for s in err.__slots__}
-                d['level'] = d['level'].upper()
-                d['rule'] = d['rule'] or d['linter']
-                message.append(self.fmt.format(**d))
-
-        return "\n".join(message)
--- a/python/mozlint/mozlint/roller.py
+++ b/python/mozlint/mozlint/roller.py
@@ -37,17 +37,17 @@ def _run_linters(queue, paths, **lintarg
         # Ideally we would pass the entire LINTER definition as an argument
         # to the worker instead of re-parsing it. But passing a function from
         # a dynamically created module (with imp) does not seem to be possible
         # with multiprocessing on Windows.
         linter = parse(linter_path)
         func = supported_types[linter['type']]
         res = func(paths, linter, **lintargs) or []
 
-        if not isinstance(res, (list, tuple)):
+        if isinstance(res, basestring):
             continue
 
         for r in res:
             results[r.path].append(r)
 
 
 def _run_worker(*args, **lintargs):
     try:
--- a/python/mozlint/test/test_formatters.py
+++ b/python/mozlint/test/test_formatters.py
@@ -63,26 +63,16 @@ d/e/f.txt
   4:2  warning  oh no bar  bar-not-allowed (bar)
 
 \u2716 3 problems (2 errors, 1 warning)
 """.strip()
 
         fmt = formatters.get('stylish', disable_colors=True)
         self.assertEqual(expected, fmt(self.results))
 
-    def test_treeherder_formatter(self):
-        expected = """
-TEST-UNEXPECTED-ERROR | a/b/c.txt:1:1 | oh no foo (foo)
-TEST-UNEXPECTED-ERROR | a/b/c.txt:4:1 | oh no baz (baz)
-TEST-UNEXPECTED-WARNING | d/e/f.txt:4:2 | oh no bar (bar-not-allowed)
-""".strip()
-
-        fmt = formatters.get('treeherder')
-        self.assertEqual(expected, fmt(self.results))
-
     def test_json_formatter(self):
         fmt = formatters.get('json')
         formatted = json.loads(fmt(self.results))
 
         self.assertEqual(set(formatted.keys()), set(self.results.keys()))
 
         slots = ResultContainer.__slots__
         for errors in formatted.values():
--- a/testing/docker/lint/system-setup.sh
+++ b/testing/docker/lint/system-setup.sh
@@ -8,28 +8,21 @@ test `whoami` == 'root'
 
 mkdir -p /setup
 cd /setup
 
 apt_packages=()
 apt_packages+=('curl')
 apt_packages+=('mercurial')
 apt_packages+=('python')
-apt_packages+=('python-pip')
-apt_packages+=('sudo')
 apt_packages+=('xz-utils')
 
 apt-get update
 apt-get install -y ${apt_packages[@]}
 
-# Without this we get spurious "LC_ALL: cannot change locale (en_US.UTF-8)" errors,
-# and python scripts raise UnicodeEncodeError when trying to print unicode characters.
-locale-gen en_US.UTF-8
-dpkg-reconfigure locales
-
 tooltool_fetch() {
     cat >manifest.tt
     /build/tooltool.py fetch
     rm manifest.tt
 }
 
 
 ###
@@ -63,24 +56,10 @@ tooltool_fetch <<'EOF'
 "digest": "a781a96e596f6403eca6ec2300adb9c1a396659393e16993c66f98a658050e557bc681d521f70b50c1162aa4b435274e0098ffcbd37cbe969c0e4f69be19a1e0",
 "algorithm": "sha512",
 "filename": "taskcluster-vcs-v2.3.12.tar.gz"
 }
 ]
 EOF
 npm install -g taskcluster-vcs-v2.3.12.tar.gz
 
-
-###
-# Flake8 Setup
-###
-
-cat >requirements.txt <<'EOF'
-mccabe==0.4.0   --hash=sha256:cbc2938f6c01061bc6d21d0c838c2489664755cb18676f0734d7617f4577d09e
-pep8==1.7.0     --hash=sha256:4fc2e478addcf17016657dff30b2d8d611e8341fac19ccf2768802f6635d7b8a
-pyflakes==1.2.3 --hash=sha256:e87bac26c62ea5b45067cc89e4a12f56e1483f1f2cda17e7c9b375b9fd2f40da
-flake8==2.5.4   --hash=sha256:fb5a67af4024622287a76abf6b7fe4fb3cfacf765a790976ce64f52c44c88e4a
-EOF
-
-pip install --require-hashes -r requirements.txt
-
 cd /
 rm -rf /setup
--- a/testing/taskcluster/tasks/branches/base_jobs.yml
+++ b/testing/taskcluster/tasks/branches/base_jobs.yml
@@ -521,26 +521,16 @@ tasks:
         # Run when eslint policies change.
         - '**/.eslintignore'
         - '**/*eslintrc*'
         # The plugin implementing custom checks.
         - 'testing/eslint/eslint-plugin-mozilla/**'
         # Other misc lint related files.
         - 'tools/lint/**'
         - 'testing/docker/lint/**'
-  flake8-gecko:
-    task: tasks/tests/mozlint-flake8.yml
-    root: true
-    when:
-      file_patterns:
-        - '**/*.py'
-        - '**/.flake8'
-        - 'python/mozlint/**'
-        - 'tools/lint/**'
-        - 'testing/docker/lint/**'
   android-api-15-gradle-dependencies:
     task: tasks/builds/android_api_15_gradle_dependencies.yml
     root: true
     when:
       file_patterns:
         - 'mobile/android/config/**'
         - 'testing/docker/android-gradle-build/**'
         - 'testing/mozharness/configs/builds/releng_sub_android_configs/*gradle_dependencies.py'
deleted file mode 100644
--- a/testing/taskcluster/tasks/tests/mozlint-flake8.yml
+++ /dev/null
@@ -1,37 +0,0 @@
----
-$inherits:
-  from: 'tasks/lint.yml'
-  variables:
-    build_product: 'lint'
-    build_name: 'flake8-gecko'
-    build_type: 'opt'
-
-task:
-  metadata:
-    name: '[TC] - Flake8'
-    description: 'Python flake8 linter'
-  payload:
-    image:
-      type: 'task-image'
-      path: 'public/image.tar'
-      taskId: '{{#task_id_for_image}}lint{{/task_id_for_image}}'
-    command:
-      - bash
-      - -cx
-      - >
-          tc-vcs checkout ./gecko {{base_repository}} {{head_repository}} {{head_rev}} {{head_ref}} &&
-          cd gecko &&
-          ./mach lint -l flake8 -f treeherder
-  extra:
-    locations:
-      build: null
-      tests: null
-    treeherder:
-      machine:
-        platform: lint
-      groupSymbol: tc
-      symbol: f8
-      tier: 2
-    treeherderEnv:
-      - production
-      - staging
--- a/tools/lint/flake8.lint
+++ b/tools/lint/flake8.lint
@@ -69,17 +69,17 @@ def lint(files, **lintargs):
     if not binary:
         try:
             binary = which.which('flake8')
         except which.WhichError:
             pass
 
     if not binary:
         print(FLAKE8_NOT_FOUND)
-        return []
+        return 1
 
     cmdargs = [
         binary,
         '--format', '{"path":"%(path)s","lineno":%(row)s,'
                     '"column":%(col)s,"rule":"%(code)s","message":"%(text)s"}',
     ]
 
     exclude = lintargs.get('exclude')
--- a/tools/lint/mach_commands.py
+++ b/tools/lint/mach_commands.py
@@ -50,23 +50,18 @@ class MachCommands(MachCommandBase):
 
         lintargs['exclude'] = ['obj*']
         lint = LintRoller(**lintargs)
         lint.read(lint_files)
 
         # run all linters
         results = lint.roll(paths)
 
-        status = 0
-        if results:
-            status = 1
-
         formatter = formatters.get(fmt)
         print(formatter(results))
-        return status
 
     @SubCommand('lint', 'setup',
                 "Setup required libraries for specified lints.")
     @CommandArgument(
         '-l', '--linter', dest='linters', default=None, action='append',
         help="Linters to run, e.g 'eslint'. By default all linters are run "
              "for all the appropriate files.")
     def lint_setup(self, linters=None, **lintargs):