Bug 1273634 - [mozlint] Create a flake8 task, r=garndt
☠☠ backed out by 379f4fff66d5 ☠ ☠
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 17 May 2016 16:24:24 -0400
changeset 338989 3f521a9d4d1f4f553266f54469f009245a1d4b2e
parent 338988 c48f3b04c9dee0e649c520bbcd25c143a545c1b0
child 338990 208ae86f81b4e8aaf069b55d062aa08c84d826ae
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgarndt
bugs1273634
milestone49.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 1273634 - [mozlint] Create a flake8 task, r=garndt Enables flake8 linting! To start, only these directories are actually linted: - python/mozlint - tools/lint To enable new directories, add them to the 'include' directive at the bottom of: tools/lint/flake8.lint Edit topsrcdir/.flake8 to modify global configuration. Add a new .flake8 to a subdirectory to override the global. The current configuration is more or less just the default and we should tweak it to our needs. MozReview-Commit-ID: iXbToRhm3b
testing/taskcluster/tasks/branches/base_jobs.yml
testing/taskcluster/tasks/tests/mozlint-flake8.yml
tools/lint/mach_commands.py
--- a/testing/taskcluster/tasks/branches/base_jobs.yml
+++ b/testing/taskcluster/tasks/branches/base_jobs.yml
@@ -513,16 +513,26 @@ 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'
new file mode 100644
--- /dev/null
+++ b/testing/taskcluster/tasks/tests/mozlint-flake8.yml
@@ -0,0 +1,37 @@
+---
+$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/mach_commands.py
+++ b/tools/lint/mach_commands.py
@@ -50,18 +50,23 @@ 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):