Bug 1464869 - Fix flake8/pep8 issue by hand in mobile/ r?nalexander draft
authorSylvestre Ledru <sledru@mozilla.com>
Mon, 04 Jun 2018 22:37:17 +0200
changeset 804686 2241e9b9c976e9e25d0e2d6eb4faa4218c038e2a
parent 804685 89143d6b462c7d447c285eb676bc5eda132a48f2
child 804687 e36ad8179576e0e80e4da7c7955e4d6d144aeb65
push id112435
push usersledru@mozilla.com
push dateWed, 06 Jun 2018 11:45:50 +0000
reviewersnalexander
bugs1464869
milestone62.0a1
Bug 1464869 - Fix flake8/pep8 issue by hand in mobile/ r?nalexander MozReview-Commit-ID: 3cG5FY3F2G5
mobile/android/base/generate_build_config.py
mobile/android/debug_sign_tool.py
mobile/android/docs/conf.py
mobile/android/mach_commands.py
--- a/mobile/android/base/generate_build_config.py
+++ b/mobile/android/base/generate_build_config.py
@@ -18,17 +18,16 @@ transition to Gradle.
 
 from __future__ import (
     print_function,
     unicode_literals,
 )
 
 from collections import defaultdict
 import os
-import sys
 
 import buildconfig
 
 from mozbuild import preprocessor
 from mozbuild.android_version_code import android_version_code
 
 
 def _defines():
--- a/mobile/android/debug_sign_tool.py
+++ b/mobile/android/debug_sign_tool.py
@@ -68,17 +68,17 @@ class DebugKeystore:
                 '-storepass', 'android',
                 '-alias', self.alias,
                 ]
         if self.verbose:
             args.append('-v')
         contains = True
         try:
             self._check(args)
-        except subprocess.CalledProcessError as e:
+        except subprocess.CalledProcessError:
             contains = False
         if self.verbose:
             log.info('Keystore %s %s alias %s' %
                      (self.keystore,
                       'contains' if contains else 'does not contain',
                       self.alias))
         return contains
 
--- a/mobile/android/docs/conf.py
+++ b/mobile/android/docs/conf.py
@@ -7,42 +7,39 @@
 # containing dir.
 #
 # Note that not all possible configuration values are present in this
 # autogenerated file.
 #
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
-import sys
-import os
-
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.insert(0, os.path.abspath('.'))
+# sys.path.insert(0, os.path.abspath('.'))
 
 # -- General configuration ------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
+# needs_sphinx = '1.0'
 
 # Add any Sphinx extension module names here, as strings. They can be
 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
 # ones.
 extensions = []
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['_templates']
 
 # The suffix of source filenames.
 source_suffix = '.rst'
 
 # The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig'
 
 # The master toctree document.
 master_doc = 'index'
 
 # General information about the project.
 project = u'Firefox for Android'
 copyright = u'2015, mobile team'
 
@@ -52,133 +49,133 @@ copyright = u'2015, mobile team'
 #
 # The short X.Y version.
 version = '1.0'
 # The full version, including alpha/beta/rc tags.
 release = '1.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
-#language = None
+# language = None
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
-#today = ''
+# today = ''
 # Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
 
 # List of patterns, relative to source directory, that match files and
 # directories to ignore when looking for source files.
 exclude_patterns = ['_build']
 
 # The reST default role (used for this markup: `text`) to use for all
 # documents.
-#default_role = None
+# default_role = None
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
 
 # If true, the current module name will be prepended to all description
 # unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
 
 # If true, sectionauthor and moduleauthor directives will be shown in the
 # output. They are ignored by default.
-#show_authors = False
+# show_authors = False
 
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
 
 # A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
 
 # If true, keep warnings as "system message" paragraphs in the built documents.
-#keep_warnings = False
+# keep_warnings = False
 
 
 # -- Options for HTML output ----------------------------------------------
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
 html_theme = 'default'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-#html_theme_options = {}
+# html_theme_options = {}
 
 # Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
-#html_title = None
+# html_title = None
 
 # A shorter title for the navigation bar.  Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
 
 # The name of an image file (relative to this directory) to place at the top
 # of the sidebar.
-#html_logo = None
+# html_logo = None
 
 # The name of an image file (within the static path) to use as favicon of the
 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
 # pixels large.
-#html_favicon = None
+# html_favicon = None
 
 # Add any paths that contain custom static files (such as style sheets) here,
 # relative to this directory. They are copied after the builtin static files,
 # so a file named "default.css" will overwrite the builtin "default.css".
 html_static_path = ['_static']
 
 # Add any extra paths that contain custom files (such as robots.txt or
 # .htaccess) here, relative to this directory. These files are copied
 # directly to the root of the documentation.
-#html_extra_path = []
+# html_extra_path = []
 
 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
 # using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
 
 # If true, SmartyPants will be used to convert quotes and dashes to
 # typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
 
 # Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
 
 # Additional templates that should be rendered to pages, maps page names to
 # template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
 
 # If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True
 
 # If false, no index is generated.
-#html_use_index = True
+# html_use_index = True
 
 # If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
 
 # If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True
 
 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
 
 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
 
 # If true, an OpenSearch description file will be output, and all pages will
 # contain a <link> tag referring to it.  The value of this option must be the
 # base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
 
 # This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
 
 # Output file base name for HTML help builder.
 htmlhelp_basename = 'FirefoxforAndroiddoc'
 
 
 # -- Options for LaTeX output ---------------------------------------------
 
 latex_elements = {
@@ -197,62 +194,62 @@ latex_elements = {
 #  author, documentclass [howto, manual, or own class]).
 latex_documents = [
   ('index', 'FirefoxforAndroid.tex', u'Firefox for Android Documentation',
    u'mobile team', 'manual'),
 ]
 
 # The name of an image file (relative to this directory) to place at the top of
 # the title page.
-#latex_logo = None
+# latex_logo = None
 
 # For "manual" documents, if this is true, then toplevel headings are parts,
 # not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
 
 # If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
 
 # If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
 
 # Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
 
 # If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True
 
 
 # -- Options for manual page output ---------------------------------------
 
 # One entry per manual page. List of tuples
 # (source start file, name, description, authors, manual section).
 man_pages = [
     ('index', 'firefoxforandroid', u'Firefox for Android Documentation',
      [u'mobile team'], 1)
 ]
 
 # If true, show URL addresses after external links.
-#man_show_urls = False
+# man_show_urls = False
 
 
 # -- Options for Texinfo output -------------------------------------------
 
 # Grouping the document tree into Texinfo files. List of tuples
 # (source start file, target name, title, author,
 #  dir menu entry, description, category)
 texinfo_documents = [
   ('index', 'FirefoxforAndroid', u'Firefox for Android Documentation',
    u'mobile team', 'FirefoxforAndroid', 'One line description of project.',
    'Miscellaneous'),
 ]
 
 # Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# texinfo_appendices = []
 
 # If false, no module index is generated.
-#texinfo_domain_indices = True
+# texinfo_domain_indices = True
 
 # How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+# texinfo_show_urls = 'footnote'
 
 # If true, do not generate a @detailmenu in the "Top" node's menu.
-#texinfo_no_detailmenu = False
+# texinfo_no_detailmenu = False
--- a/mobile/android/mach_commands.py
+++ b/mobile/android/mach_commands.py
@@ -26,97 +26,105 @@ from mach.decorators import (
     SubCommand,
 )
 
 
 # NOTE python/mach/mach/commands/commandinfo.py references this function
 #      by name. If this function is renamed or removed, that file should
 #      be updated accordingly as well.
 def REMOVED(cls):
-    """Command no longer exists! Use the Gradle configuration rooted in the top source directory instead.
+    """Command no longer exists! Use the Gradle configuration rooted in the top source directory
+    instead.
 
-    See https://developer.mozilla.org/en-US/docs/Simple_Firefox_for_Android_build#Developing_Firefox_for_Android_in_Android_Studio_or_IDEA_IntelliJ.
+    See https://developer.mozilla.org/en-US/docs/Simple_Firefox_for_Android_build#Developing_Firefox_for_Android_in_Android_Studio_or_IDEA_IntelliJ.  # NOQA: E501
     """
     return False
 
 
 @CommandProvider
 class MachCommands(MachCommandBase):
     def _root_url(self, artifactdir=None, objdir=None):
         if 'TASK_ID' in os.environ and 'RUN_ID' in os.environ:
-            return 'https://queue.taskcluster.net/v1/task/{}/runs/{}/artifacts/{}'.format(os.environ['TASK_ID'], os.environ['RUN_ID'], artifactdir)
+            return 'https://queue.taskcluster.net/v1/task/{}/runs/{}/artifacts/{}'.format(
+                os.environ['TASK_ID'], os.environ['RUN_ID'], artifactdir)
         else:
             return os.path.join(self.topobjdir, objdir)
 
     @Command('android', category='devenv',
              description='Run Android-specific commands.',
              conditions=[conditions.is_android])
     def android(self):
         pass
 
     @SubCommand('android', 'assemble-app',
                 """Assemble Firefox for Android.
-        See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")
+        See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_assemble_app(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_APP_TASKS'] +
                           ['-x', 'lint', '--continue'] + args, verbose=True)
 
         return ret
 
     @SubCommand('android', 'generate-sdk-bindings',
                 """Generate SDK bindings used when building GeckoView.""")
-    @CommandArgument('inputs', nargs='+', help='config files, like [/path/to/ClassName-classes.txt]+')
+    @CommandArgument('inputs', nargs='+', help='config files, '
+                     'like [/path/to/ClassName-classes.txt]+')
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_generate_sdk_bindings(self, inputs, args):
         import itertools
 
         def stem(input):
             # Turn "/path/to/ClassName-classes.txt" into "ClassName".
             return os.path.basename(input).rsplit('-classes.txt', 1)[0]
 
         bindings_inputs = list(itertools.chain(*((input, stem(input)) for input in inputs)))
         bindings_args = '-Pgenerate_sdk_bindings_args={}'.format(':'.join(bindings_inputs))
 
         ret = self.gradle(
-            self.substs['GRADLE_ANDROID_GENERATE_SDK_BINDINGS_TASKS'] + [bindings_args] + args, verbose=True)
+            self.substs['GRADLE_ANDROID_GENERATE_SDK_BINDINGS_TASKS'] + [bindings_args] + args,
+            verbose=True)
 
         return ret
 
     @SubCommand('android', 'generate-generated-jni-wrappers',
                 """Generate GeckoView JNI wrappers used when building GeckoView.""")
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_generate_generated_jni_wrappers(self, args):
         ret = self.gradle(
-            self.substs['GRADLE_ANDROID_GENERATE_GENERATED_JNI_WRAPPERS_TASKS'] + args, verbose=True)
+            self.substs['GRADLE_ANDROID_GENERATE_GENERATED_JNI_WRAPPERS_TASKS'] + args,
+            verbose=True)
 
         return ret
 
     @SubCommand('android', 'generate-fennec-jni-wrappers',
-                """Generate Fennec-specific JNI wrappers used when building Firefox for Android.""")
+                """Generate Fennec-specific JNI wrappers used when building
+                Firefox for Android.""")
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_generate_fennec_jni_wrappers(self, args):
         ret = self.gradle(
             self.substs['GRADLE_ANDROID_GENERATE_FENNEC_JNI_WRAPPERS_TASKS'] + args, verbose=True)
 
         return ret
 
     @SubCommand('android', 'test',
                 """Run Android local unit tests.
-        See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-test""")
+                See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-test""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_test(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_TEST_TASKS'] +
                           ["--continue"] + args, verbose=True)
 
-        ret |= self._parse_android_test_results('public/app/unittest', 'gradle/build/mobile/android/app',
+        ret |= self._parse_android_test_results('public/app/unittest',
+                                                'gradle/build/mobile/android/app',
                                                 (self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],))
 
-        ret |= self._parse_android_test_results('public/geckoview/unittest', 'gradle/build/mobile/android/geckoview',
-                                                (self.substs['GRADLE_ANDROID_GECKOVIEW_VARIANT_NAME'],))
+        ret |= self._parse_android_test_results('public/geckoview/unittest',
+                                                'gradle/build/mobile/android/geckoview',
+                                                (self.substs['GRADLE_ANDROID_GECKOVIEW_VARIANT_NAME'],))  # NOQA: E501
 
         return ret
 
     def _parse_android_test_results(self, artifactdir, gradledir, variants):
         # Unit tests produce both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
         import itertools
@@ -142,23 +150,23 @@ class MachCommands(MachCommandBase):
             finder = FileFinder(os.path.join(self.topobjdir, gradledir + '/test-results/', report))
             for p, _ in finder.find('TEST-*.xml'):
                 found_reports = True
                 f = open(os.path.join(finder.base, p), 'rt')
                 tree = ET.parse(f)
                 root = tree.getroot()
 
                 # Log reports for Tree Herder "Job Details".
-                print('TinderboxPrint: report<br/><a href="{}/{}/index.html">HTML {} report</a>, visit "Inspect Task" link for details'.format(root_url, report, report))
+                print('TinderboxPrint: report<br/><a href="{}/{}/index.html">HTML {} report</a>, visit "Inspect Task" link for details'.format(root_url, report, report))  # NOQA: E501
 
                 # And make the report display as soon as possible.
                 failed = root.findall('testcase/error') or root.findall('testcase/failure')
                 if failed:
                     print(
-                        'TEST-UNEXPECTED-FAIL | android-test | There were failing tests. See the reports at: {}/{}/index.html'.format(root_url, report))
+                        'TEST-UNEXPECTED-FAIL | android-test | There were failing tests. See the reports at: {}/{}/index.html'.format(root_url, report))  # NOQA: E501
 
                 print('SUITE-START | android-test | {} {}'.format(report, root.get('name')))
 
                 for testcase in root.findall('testcase'):
                     name = testcase.get('name')
                     print('TEST-START | {}'.format(name))
 
                     # Schema cribbed from
@@ -182,24 +190,24 @@ class MachCommands(MachCommandBase):
                             print('TEST-INFO | {} | {}'.format(name, line))
 
                     if not error_count:
                         print('TEST-PASS | {}'.format(name))
 
                 print('SUITE-END | android-test | {} {}'.format(report, root.get('name')))
 
         if not found_reports:
-            print('TEST-UNEXPECTED-FAIL | android-test | No reports found under {}'.format(gradledir))
+            print('TEST-UNEXPECTED-FAIL | android-test | No reports found under {}'.format(gradledir))  # NOQA: E501
             return 1
 
         return ret
 
     @SubCommand('android', 'lint',
                 """Run Android lint.
-        See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-lint""")
+                See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-lint""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_lint(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_LINT_TASKS'] +
                           ["--continue"] + args, verbose=True)
 
         # Android Lint produces both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
@@ -207,75 +215,78 @@ class MachCommands(MachCommandBase):
 
         root_url = self._root_url(
             artifactdir='public/android/lint',
             objdir='gradle/build/mobile/android/app/reports')
 
         reports = (self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],)
         for report in reports:
             f = open(os.path.join(
-                self.topobjdir, 'gradle/build/mobile/android/app/reports/lint-results-{}.xml'.format(report)), 'rt')
+                self.topobjdir,
+                'gradle/build/mobile/android/app/reports/lint-results-{}.xml'.format(report)),
+                     'rt')
             tree = ET.parse(f)
             root = tree.getroot()
 
             # Log reports for Tree Herder "Job Details".
             html_report_url = '{}/lint-results-{}.html'.format(root_url, report)
             xml_report_url = '{}/lint-results-{}.xml'.format(root_url, report)
-            print('TinderboxPrint: report<br/><a href="{}">HTML {} report</a>, visit "Inspect Task" link for details'.format(html_report_url, report))
-            print('TinderboxPrint: report<br/><a href="{}">XML {} report</a>, visit "Inspect Task" link for details'.format(xml_report_url, report))
+            print('TinderboxPrint: report<br/><a href="{}">HTML {} report</a>, visit "Inspect Task" link for details'.format(html_report_url, report))  # NOQA: E501
+            print('TinderboxPrint: report<br/><a href="{}">XML {} report</a>, visit "Inspect Task" link for details'.format(xml_report_url, report))  # NOQA: E501
 
             # And make the report display as soon as possible.
             if root.findall("issue[@severity='Error']"):
-                print('TEST-UNEXPECTED-FAIL | android-lint | Lint found errors in the project; aborting build. See the report at: {}'.format(html_report_url))
+                print('TEST-UNEXPECTED-FAIL | android-lint | Lint found errors in the project; aborting build. See the report at: {}'.format(html_report_url))  # NOQA: E501
 
             print('SUITE-START | android-lint | {}'.format(report))
             for issue in root.findall("issue[@severity='Error']"):
                 # There's no particular advantage to formatting the
                 # error, so for now let's just output the <issue> XML
                 # tag.
                 for line in ET.tostring(issue).strip().splitlines():
                     print('TEST-UNEXPECTED-FAIL | {}'.format(line))
                 ret |= 1
             print('SUITE-END | android-lint | {}'.format(report))
 
         return ret
 
     @SubCommand('android', 'checkstyle',
                 """Run Android checkstyle.
-        See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-checkstyle""")
+                See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-checkstyle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_checkstyle(self, args):
         ret = self.gradle(self.substs['GRADLE_ANDROID_CHECKSTYLE_TASKS'] +
                           ["--continue"] + args, verbose=True)
 
         # Checkstyle produces both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
         import xml.etree.ElementTree as ET
 
         f = open(os.path.join(self.topobjdir,
-                              'gradle/build/mobile/android/app/reports/checkstyle/checkstyle.xml'), 'rt')
+                              'gradle/build/mobile/android/app/reports/checkstyle/checkstyle.xml'),
+                 'rt')
         tree = ET.parse(f)
         root = tree.getroot()
 
         # Now the reports, linkified.
         root_url = self._root_url(
             artifactdir='public/android/checkstyle',
             objdir='gradle/build/mobile/android/app/reports/checkstyle')
 
         # Log reports for Tree Herder "Job Details".
-        print('TinderboxPrint: report<br/><a href="{}/checkstyle.html">HTML checkstyle report</a>, visit "Inspect Task" link for details'.format(root_url))
-        print('TinderboxPrint: report<br/><a href="{}/checkstyle.xml">XML checkstyle report</a>, visit "Inspect Task" link for details'.format(root_url))
+        print('TinderboxPrint: report<br/><a href="{}/checkstyle.html">HTML checkstyle report</a>, visit "Inspect Task" link for details'.format(root_url))  # NOQA: E501
+        print('TinderboxPrint: report<br/><a href="{}/checkstyle.xml">XML checkstyle report</a>, visit "Inspect Task" link for details'.format(root_url))  # NOQA: E501
 
         # And make the report display as soon as possible.
         if root.findall('file/error'):
             ret |= 1
 
         if ret:
-            print('TEST-UNEXPECTED-FAIL | android-checkstyle | Checkstyle rule violations were found. See the report at: {}/checkstyle.html'.format(root_url))
+            print('TEST-UNEXPECTED-FAIL | android-checkstyle | Checkstyle rule violations were found. See the report at: {}/checkstyle.html'.format(root_url))  # NOQA: E501
 
         print('SUITE-START | android-checkstyle')
         for file in root.findall('file'):
             name = file.get('name')
 
             print('TEST-START | {}'.format(name))
             error_count = 0
             for error in file.findall('error'):
@@ -290,17 +301,17 @@ class MachCommands(MachCommandBase):
             if not error_count:
                 print('TEST-PASS | {}'.format(name))
         print('SUITE-END | android-checkstyle')
 
         return ret
 
     @SubCommand('android', 'findbugs',
                 """Run Android findbugs.
-        See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-findbugs""")
+                See https://developer.mozilla.org/en-US/docs/Mozilla/Android-specific_test_suites#android-findbugs""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_findbugs(self, dryrun=False, args=[]):
         ret = self.gradle(self.substs['GRADLE_ANDROID_FINDBUGS_TASKS'] +
                           ["--continue"] + args, verbose=True)
 
         # Findbug produces both HTML and XML reports.  Visit the
         # XML report(s) to report errors and link to the HTML
         # report(s) for human consumption.
@@ -308,68 +319,75 @@ class MachCommands(MachCommandBase):
 
         root_url = self._root_url(
             artifactdir='public/android/findbugs',
             objdir='gradle/build/mobile/android/app/reports/findbugs')
 
         reports = (self.substs['GRADLE_ANDROID_APP_VARIANT_NAME'],)
         for report in reports:
             try:
-                f = open(os.path.join(self.topobjdir, 'gradle/build/mobile/android/app/reports/findbugs',
-                                      'findbugs-{}-output.xml'.format(report)), 'rt')
+                f = open(os.path.join(
+                    self.topobjdir, 'gradle/build/mobile/android/app/reports/findbugs',
+                    'findbugs-{}-output.xml'.format(report)),
+                         'rt')
             except IOError:
                 continue
 
             tree = ET.parse(f)
             root = tree.getroot()
 
             # Log reports for Tree Herder "Job Details".
             html_report_url = '{}/findbugs-{}-output.html'.format(root_url, report)
             xml_report_url = '{}/findbugs-{}-output.xml'.format(root_url, report)
-            print('TinderboxPrint: report<br/><a href="{}">HTML {} report</a>, visit "Inspect Task" link for details'.format(html_report_url, report))
-            print('TinderboxPrint: report<br/><a href="{}">XML {} report</a>, visit "Inspect Task" link for details'.format(xml_report_url, report))
+            print('TinderboxPrint: report<br/><a href="{}">HTML {} report</a>, visit "Inspect Task" link for details'.format(html_report_url, report))  # NOQA: E501
+            print('TinderboxPrint: report<br/><a href="{}">XML {} report</a>, visit "Inspect Task" link for details'.format(xml_report_url, report))  # NOQA: E501
 
             # And make the report display as soon as possible.
             if root.findall("./BugInstance"):
-                print('TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: {}'.format(html_report_url))
+                print('TEST-UNEXPECTED-FAIL | android-findbugs | Findbugs found issues in the project. See the report at: {}'.format(html_report_url))  # NOQA: E501
 
             print('SUITE-START | android-findbugs | {}'.format(report))
             for error in root.findall('./BugInstance'):
                 # There's no particular advantage to formatting the
                 # error, so for now let's just output the <error> XML
                 # tag.
                 print('TEST-UNEXPECTED-FAIL | {}:{} | {}'.format(report,
-                                                                 error.get('type'), error.find('Class').get('classname')))
+                                                                 error.get('type'),
+                                                                 error.find('Class')
+                                                                 .get('classname')))
                 for line in ET.tostring(error).strip().splitlines():
-                    print('TEST-UNEXPECTED-FAIL | {}:{} | {}'.format(report, error.get('type'), line))
+                    print('TEST-UNEXPECTED-FAIL | {}:{} | {}'.format(report,
+                                                                     error.get('type'),
+                                                                     line))
                 ret |= 1
             print('SUITE-END | android-findbugs | {}'.format(report))
 
         return ret
 
     @SubCommand('android', 'gradle-dependencies',
                 """Collect Android Gradle dependencies.
-        See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")
+        See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_gradle_dependencies(self, args):
         # We don't want to gate producing dependency archives on clean
         # lint or checkstyle, particularly because toolchain versions
         # can change the outputs for those processes.
         self.gradle(self.substs['GRADLE_ANDROID_DEPENDENCIES_TASKS'] +
                     ["--continue"] + args, verbose=True)
 
         return 0
 
     @SubCommand('android', 'archive-geckoview',
                 """Create GeckoView archives.
-        See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")
+        See http://firefox-source-docs.mozilla.org/build/buildsystem/toolchains.html#firefox-for-android-with-gradle""")  # NOQA: E501
     @CommandArgument('args', nargs=argparse.REMAINDER)
     def android_archive_geckoview(self, args):
         ret = self.gradle(
-            self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + ["--continue"] + args, verbose=True)
+            self.substs['GRADLE_ANDROID_ARCHIVE_GECKOVIEW_TASKS'] + ["--continue"] + args,
+            verbose=True)
 
         return ret
 
     @SubCommand('android', 'geckoview-docs',
                 """Create GeckoView javadoc and optionally upload to Github""")
     @CommandArgument('--archive', action='store_true',
                      help='Generate a javadoc archive.')
     @CommandArgument('--upload', metavar='USER/REPO',
@@ -489,21 +507,22 @@ class MachCommands(MachCommandBase):
         # http://tools.android.com/knownissues/encoding.  See
         # http://stackoverflow.com/a/21267635 for discussion of this approach.
         #
         # It's not even enough to set the encoding just for Gradle; it
         # needs to be for JVMs spawned by Gradle as well.  This
         # happens during the maven deployment generating the GeckoView
         # documents; this works around "error: unmappable character
         # for encoding ASCII" in exoplayer2.  See
-        # https://discuss.gradle.org/t/unmappable-character-for-encoding-ascii-when-building-a-utf-8-project/10692/11
+        # https://discuss.gradle.org/t/unmappable-character-for-encoding-ascii-when-building-a-utf-8-project/10692/11  # NOQA: E501
         # and especially https://stackoverflow.com/a/21755671.
 
-        return self.run_process([self.substs['GRADLE']] + gradle_flags + ['--console=plain'] + args,
-                                append_env={
+        return self.run_process(
+            [self.substs['GRADLE']] + gradle_flags + ['--console=plain'] + args,
+            append_env={
                 'GRADLE_OPTS': '-Dfile.encoding=utf-8',
                 'JAVA_HOME': java_home,
                 'JAVA_TOOL_OPTIONS': '-Dfile.encoding=utf-8',
             },
             pass_thru=True,  # Allow user to run gradle interactively.
             ensure_exit_code=False,  # Don't throw on non-zero exit code.
             cwd=mozpath.join(self.topsrcdir))
 
@@ -518,18 +537,20 @@ class AndroidEmulatorCommands(MachComman
     """
        Run the Android emulator with one of the AVDs used in the Mozilla
        automated test environment. If necessary, the AVD is fetched from
        the tooltool server and installed.
     """
     @Command('android-emulator', category='devenv',
              conditions=[],
              description='Run the Android emulator with an AVD from test automation.')
-    @CommandArgument('--version', metavar='VERSION', choices=['4.3', '6.0', '7.0', 'x86', 'x86-6.0', 'x86-7.0'],
-                     help='Specify Android version to run in emulator. One of "4.3", "6.0", "7.0", "x86", "x86-6.0", or "x86-7.0".',
+    @CommandArgument('--version', metavar='VERSION',
+                     choices=['4.3', '6.0', '7.0', 'x86', 'x86-6.0', 'x86-7.0'],
+                     help='Specify Android version to run in emulator. '
+                     'One of "4.3", "6.0", "7.0", "x86", "x86-6.0", or "x86-7.0".',
                      default='4.3')
     @CommandArgument('--wait', action='store_true',
                      help='Wait for emulator to be closed.')
     @CommandArgument('--force-update', action='store_true',
                      help='Update AVD definition even when AVD is already installed.')
     @CommandArgument('--verbose', action='store_true',
                      help='Log informative status messages.')
     def emulator(self, version, wait=False, force_update=False, verbose=False):