Bug 1401309 - Add python/mozversioncontrol to flake8 linter, r?gps draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 20 Sep 2017 10:02:26 -0400
changeset 671955 46ef33cade91b5bf31d1e1ed1aa03b536cc070ac
parent 671801 76a26ef7c493311c170ae83eb0c1d6592a21396d
child 671956 519bd5b9386eaa4cb87101e55a87fb5aa75741bb
push id82100
push userahalberstadt@mozilla.com
push dateThu, 28 Sep 2017 14:54:56 +0000
reviewersgps
bugs1401309
milestone58.0a1
Bug 1401309 - Add python/mozversioncontrol to flake8 linter, r?gps MozReview-Commit-ID: KuyEYa3Mbgd
python/mozversioncontrol/mozversioncontrol/__init__.py
python/mozversioncontrol/mozversioncontrol/repoupdate.py
tools/lint/flake8.yml
--- a/python/mozversioncontrol/mozversioncontrol/__init__.py
+++ b/python/mozversioncontrol/mozversioncontrol/__init__.py
@@ -28,17 +28,17 @@ def get_tool_path(tool):
     # "hg.bat," and "hg" (a Python script). "which" will happily return the
     # Python script, which will cause subprocess to choke. Explicitly favor
     # the Windows version over the plain script.
     try:
         return which.which(tool + '.exe')
     except which.WhichError:
         try:
             return which.which(tool)
-        except which.WhichError as e:
+        except which.WhichError:
             pass
 
     raise MissingVCSTool('Unable to obtain %s path. Try running '
                          '|mach bootstrap| to ensure your environment is up to '
                          'date.' % tool)
 
 
 class Repository(object):
--- a/python/mozversioncontrol/mozversioncontrol/repoupdate.py
+++ b/python/mozversioncontrol/mozversioncontrol/repoupdate.py
@@ -4,28 +4,29 @@
 
 from __future__ import unicode_literals
 
 import os
 import subprocess
 
 # The logic here is far from robust. Improvements are welcome.
 
+
 def update_mercurial_repo(hg, repo, path, revision='default',
                           hostfingerprints=None, global_args=None):
     """Ensure a HG repository exists at a path and is up to date."""
     hostfingerprints = hostfingerprints or {}
 
     args = [hg]
     if global_args:
         args.extend(global_args)
 
     for host, fingerprint in sorted(hostfingerprints.items()):
         args.extend(['--config', 'hostfingerprints.%s=%s' % (host,
-            fingerprint)])
+                     fingerprint)])
 
     if os.path.exists(path):
         subprocess.check_call(args + ['pull', repo], cwd=path)
     else:
         subprocess.check_call(args + ['clone', repo, path])
 
     subprocess.check_call([hg, 'update', '-r', revision], cwd=path)
 
--- a/tools/lint/flake8.yml
+++ b/tools/lint/flake8.yml
@@ -2,16 +2,17 @@
 flake8:
     description: Python linter
     include:
         - config/mozunit.py
         - layout/tools/reftest
         - python/mach
         - python/mach_commands.py
         - python/mozlint
+        - python/mozversioncontrol
         - security/manager
         - taskcluster
         - testing/firefox-ui
         - testing/mach_commands.py
         - testing/marionette/client
         - testing/marionette/harness
         - testing/marionette/puppeteer
         - testing/mozbase