Commit b2cc4a94 authored by Quinten Yearsley's avatar Quinten Yearsley Committed by Commit Bot

depot_tools: Replace pylint error numbers with symbolic names.

This affects a bunch of files, but only changes comments,
and shouldn't make any difference to behavior.

The purpose is to slightly improve readability of pylint
disable comments.

Change-Id: Ic6cd0f8de792b31d91c6125f6da2616450b30f11
Reviewed-on: https://chromium-review.googlesource.com/420412Reviewed-by: 's avatarAaron Gable <agable@chromium.org>
Commit-Queue: Quinten Yearsley <qyearsley@chromium.org>
parent 442fb64c
...@@ -159,7 +159,7 @@ def main(): ...@@ -159,7 +159,7 @@ def main():
properties = None properties = None
# Bad except clauses order (HTTPError is an ancestor class of # Bad except clauses order (HTTPError is an ancestor class of
# ClientLoginError) # ClientLoginError)
# pylint: disable=E0701 # pylint: disable=bad-except-order
try: try:
properties = rietveld_obj.get_issue_properties(options.issue, False) properties = rietveld_obj.get_issue_properties(options.issue, False)
except urllib2.HTTPError as e: except urllib2.HTTPError as e:
......
...@@ -414,7 +414,7 @@ class ReadOnlyCheckout(object): ...@@ -414,7 +414,7 @@ class ReadOnlyCheckout(object):
return self.checkout.apply_patch( return self.checkout.apply_patch(
patches, post_processors or self.post_processors, verbose) patches, post_processors or self.post_processors, verbose)
def commit(self, message, user): # pylint: disable=R0201 def commit(self, message, user): # pylint: disable=no-self-use
logging.info('Would have committed for %s with message: %s' % ( logging.info('Would have committed for %s with message: %s' % (
user, message)) user, message))
return 'FAKE' return 'FAKE'
......
...@@ -276,7 +276,7 @@ def gen_usage(parser, command): ...@@ -276,7 +276,7 @@ def gen_usage(parser, command):
def main(args=None): def main(args=None):
# Do it late so all commands are listed. # Do it late so all commands are listed.
# pylint: disable=E1101 # pylint: disable=no-member
parser = OptionParser(version=__version__) parser = OptionParser(version=__version__)
if args is None: if args is None:
args = sys.argv[1:] args = sys.argv[1:]
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Android(config_util.Config): class Android(config_util.Config):
"""Basic Config alias for Android -> Chromium.""" """Basic Config alias for Android -> Chromium."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Breakpad(config_util.Config): class Breakpad(config_util.Config):
@staticmethod @staticmethod
def fetch_spec(props): def fetch_spec(props):
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Chromium(config_util.Config): class Chromium(config_util.Config):
"""Basic Config class for Chromium.""" """Basic Config class for Chromium."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class CrashpadConfig(config_util.Config): class CrashpadConfig(config_util.Config):
"""Basic Config class for Crashpad.""" """Basic Config class for Crashpad."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Dart(config_util.Config): class Dart(config_util.Config):
"""Basic Config class for Dart.""" """Basic Config class for Dart."""
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Dartino(config_util.Config): class Dartino(config_util.Config):
"""Basic Config class for Dartino.""" """Basic Config class for Dartino."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Dart(config_util.Config): class Dart(config_util.Config):
"""Basic Config class for Dart.""" """Basic Config class for Dart."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class DepotTools(config_util.Config): class DepotTools(config_util.Config):
"""Basic Config class for DepotTools.""" """Basic Config class for DepotTools."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Chromium(config_util.Config): class Chromium(config_util.Config):
"""Basic Config class for Chromium.""" """Basic Config class for Chromium."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Infra(config_util.Config): class Infra(config_util.Config):
"""Basic Config class for the Infrastructure repositories.""" """Basic Config class for the Infrastructure repositories."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class InfraInternal(config_util.Config): class InfraInternal(config_util.Config):
"""Basic Config class for the whole set of Infrastructure repositories.""" """Basic Config class for the whole set of Infrastructure repositories."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class IOS(config_util.Config): class IOS(config_util.Config):
"""Basic Config alias for iOS -> Chromium.""" """Basic Config alias for iOS -> Chromium."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class IOSInternal(config_util.Config): class IOSInternal(config_util.Config):
"""Basic Config class for Chrome on iOS.""" """Basic Config class for Chrome on iOS."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Mojo(config_util.Config): class Mojo(config_util.Config):
"""Basic Config class for Mojo.""" """Basic Config class for Mojo."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class NaCl(config_util.Config): class NaCl(config_util.Config):
"""Basic Config class for NaCl.""" """Basic Config class for NaCl."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Naclports(config_util.Config): class Naclports(config_util.Config):
"""Basic Config class for naclports.""" """Basic Config class for naclports."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class PdfiumConfig(config_util.Config): class PdfiumConfig(config_util.Config):
"""Basic Config class for pdfium.""" """Basic Config class for pdfium."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Skia(config_util.Config): class Skia(config_util.Config):
"""Basic Config class for the Skia repository.""" """Basic Config class for the Skia repository."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class SkiaBuildbot(config_util.Config): class SkiaBuildbot(config_util.Config):
"""Basic Config class for the Skia Buildbot repository.""" """Basic Config class for the Skia Buildbot repository."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class Syzygy(config_util.Config): class Syzygy(config_util.Config):
"""Basic Config class for Syzygy.""" """Basic Config class for Syzygy."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class V8(config_util.Config): class V8(config_util.Config):
"""Basic Config class for V8.""" """Basic Config class for V8."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class WebRTC(config_util.Config): class WebRTC(config_util.Config):
"""Basic Config class for WebRTC.""" """Basic Config class for WebRTC."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class WebRTCAndroid(config_util.Config): class WebRTCAndroid(config_util.Config):
"""Basic Config alias for Android -> WebRTC.""" """Basic Config alias for Android -> WebRTC."""
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
import sys import sys
import config_util # pylint: disable=F0401 import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning # This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232 # pylint: disable=no-init
class WebRTCIOS(config_util.Config): class WebRTCIOS(config_util.Config):
"""Basic Config alias for iOS -> WebRTC.""" """Basic Config alias for iOS -> WebRTC."""
......
...@@ -40,7 +40,7 @@ def fix_default_encoding(): ...@@ -40,7 +40,7 @@ def fix_default_encoding():
# Regenerate setdefaultencoding. # Regenerate setdefaultencoding.
reload(sys) reload(sys)
# Module 'sys' has no 'setdefaultencoding' member # Module 'sys' has no 'setdefaultencoding' member
# pylint: disable=E1101 # pylint: disable=no-member
sys.setdefaultencoding('utf-8') sys.setdefaultencoding('utf-8')
for attr in dir(locale): for attr in dir(locale):
if attr[0:3] != 'LC_': if attr[0:3] != 'LC_':
...@@ -82,7 +82,7 @@ def fix_win_sys_argv(encoding): ...@@ -82,7 +82,7 @@ def fix_win_sys_argv(encoding):
return False return False
# These types are available on linux but not Mac. # These types are available on linux but not Mac.
# pylint: disable=E0611,F0401 # pylint: disable=no-name-in-module,F0401
from ctypes import byref, c_int, POINTER, windll, WINFUNCTYPE from ctypes import byref, c_int, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import LPCWSTR, LPWSTR from ctypes.wintypes import LPCWSTR, LPWSTR
...@@ -189,10 +189,10 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase): ...@@ -189,10 +189,10 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase):
# Loads the necessary function. # Loads the necessary function.
# These types are available on linux but not Mac. # These types are available on linux but not Mac.
# pylint: disable=E0611,F0401 # pylint: disable=no-name-in-module,F0401
from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE from ctypes import byref, GetLastError, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR from ctypes.wintypes import BOOL, DWORD, HANDLE, LPWSTR
from ctypes.wintypes import LPVOID # pylint: disable=E0611 from ctypes.wintypes import LPVOID # pylint: disable=no-name-in-module
self._DWORD = DWORD self._DWORD = DWORD
self._byref = byref self._byref = byref
...@@ -271,7 +271,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase): ...@@ -271,7 +271,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase):
def win_handle_is_a_console(handle): def win_handle_is_a_console(handle):
"""Returns True if a Windows file handle is a handle to a console.""" """Returns True if a Windows file handle is a handle to a console."""
# These types are available on linux but not Mac. # These types are available on linux but not Mac.
# pylint: disable=E0611,F0401 # pylint: disable=no-name-in-module,F0401
from ctypes import byref, POINTER, windll, WINFUNCTYPE from ctypes import byref, POINTER, windll, WINFUNCTYPE
from ctypes.wintypes import BOOL, DWORD, HANDLE from ctypes.wintypes import BOOL, DWORD, HANDLE
...@@ -304,7 +304,7 @@ def win_get_unicode_stream(stream, excepted_fileno, output_handle, encoding): ...@@ -304,7 +304,7 @@ def win_get_unicode_stream(stream, excepted_fileno, output_handle, encoding):
old_fileno = getattr(stream, 'fileno', lambda: None)() old_fileno = getattr(stream, 'fileno', lambda: None)()
if old_fileno == excepted_fileno: if old_fileno == excepted_fileno:
# These types are available on linux but not Mac. # These types are available on linux but not Mac.
# pylint: disable=E0611,F0401 # pylint: disable=no-name-in-module,F0401
from ctypes import windll, WINFUNCTYPE from ctypes import windll, WINFUNCTYPE
from ctypes.wintypes import DWORD, HANDLE from ctypes.wintypes import DWORD, HANDLE
......
...@@ -746,7 +746,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): ...@@ -746,7 +746,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
return bad_deps return bad_deps
# Arguments number differs from overridden method # Arguments number differs from overridden method
# pylint: disable=W0221 # pylint: disable=arguments-differ
def run(self, revision_overrides, command, args, work_queue, options): def run(self, revision_overrides, command, args, work_queue, options):
"""Runs |command| then parse the DEPS file.""" """Runs |command| then parse the DEPS file."""
logging.info('Dependency(%s).run()' % self.name) logging.info('Dependency(%s).run()' % self.name)
......
...@@ -1162,7 +1162,7 @@ class GitWrapper(SCMWrapper): ...@@ -1162,7 +1162,7 @@ class GitWrapper(SCMWrapper):
self._Fetch(options, prune=options.force) self._Fetch(options, prune=options.force)
def _Run(self, args, options, show_header=True, **kwargs): def _Run(self, args, options, show_header=True, **kwargs):
# Disable 'unused options' warning | pylint: disable=W0613 # Disable 'unused options' warning | pylint: disable=unused-argument
kwargs.setdefault('cwd', self.checkout_path) kwargs.setdefault('cwd', self.checkout_path)
kwargs.setdefault('stdout', self.out_fh) kwargs.setdefault('stdout', self.out_fh)
kwargs['filter_fn'] = self.filter kwargs['filter_fn'] = self.filter
......
...@@ -1169,9 +1169,9 @@ def NumLocalCpus(): ...@@ -1169,9 +1169,9 @@ def NumLocalCpus():
try: try:
import multiprocessing import multiprocessing
return multiprocessing.cpu_count() return multiprocessing.cpu_count()
except NotImplementedError: # pylint: disable=W0702 except NotImplementedError: # pylint: disable=bare-except
# (UNIX) Query 'os.sysconf'. # (UNIX) Query 'os.sysconf'.
# pylint: disable=E1101 # pylint: disable=no-member
if hasattr(os, 'sysconf') and 'SC_NPROCESSORS_ONLN' in os.sysconf_names: if hasattr(os, 'sysconf') and 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
return int(os.sysconf('SC_NPROCESSORS_ONLN')) return int(os.sysconf('SC_NPROCESSORS_ONLN'))
......
...@@ -29,7 +29,7 @@ GC_AUTOPACKLIMIT = 50 ...@@ -29,7 +29,7 @@ GC_AUTOPACKLIMIT = 50
GIT_CACHE_CORRUPT_MESSAGE = 'WARNING: The Git cache is corrupt.' GIT_CACHE_CORRUPT_MESSAGE = 'WARNING: The Git cache is corrupt.'
try: try:
# pylint: disable=E0602 # pylint: disable=undefined-variable
WinErr = WindowsError WinErr = WindowsError
except NameError: except NameError:
class WinErr(Exception): class WinErr(Exception):
......
...@@ -52,7 +52,7 @@ def cherry_pick(target_branch, commit, auth_config): ...@@ -52,7 +52,7 @@ def cherry_pick(target_branch, commit, auth_config):
]) ])
rietveld = Rietveld(config('rietveld.server'), auth_config, author) rietveld = Rietveld(config('rietveld.server'), auth_config, author)
# pylint: disable=W0212 # pylint: disable=protected-access
output = rietveld._send( output = rietveld._send(
'/upload', '/upload',
payload=payload, payload=payload,
...@@ -92,7 +92,7 @@ def cherry_pick(target_branch, commit, auth_config): ...@@ -92,7 +92,7 @@ def cherry_pick(target_branch, commit, auth_config):
('data', filename, content), ('data', filename, content),
]) ])
# pylint: disable=W0212 # pylint: disable=protected-access
print ' Uploading base file for %s:' % filename, rietveld._send( print ' Uploading base file for %s:' % filename, rietveld._send(
'/%s/upload_content/%s/%s' % (issue, patchset, file_id), '/%s/upload_content/%s/%s' % (issue, patchset, file_id),
payload=payload, payload=payload,
...@@ -115,14 +115,14 @@ def cherry_pick(target_branch, commit, auth_config): ...@@ -115,14 +115,14 @@ def cherry_pick(target_branch, commit, auth_config):
('data', filename, content), ('data', filename, content),
]) ])
# pylint: disable=W0212 # pylint: disable=protected-access
print ' Uploading %s:' % filename, rietveld._send( print ' Uploading %s:' % filename, rietveld._send(
'/%s/upload_content/%s/%s' % (issue, patchset, file_id), '/%s/upload_content/%s/%s' % (issue, patchset, file_id),
payload=payload, payload=payload,
content_type=content_type, content_type=content_type,
) )
# pylint: disable=W0212 # pylint: disable=protected-access
print 'Finalizing upload:', rietveld._send('/%s/upload_complete/1' % issue) print 'Finalizing upload:', rietveld._send('/%s/upload_complete/1' % issue)
......
...@@ -34,7 +34,7 @@ import webbrowser ...@@ -34,7 +34,7 @@ import webbrowser
import zlib import zlib
try: try:
import readline # pylint: disable=F0401,W0611 import readline # pylint: disable=import-error,W0611
except ImportError: except ImportError:
pass pass
...@@ -3163,7 +3163,7 @@ class ChangeDescription(object): ...@@ -3163,7 +3163,7 @@ class ChangeDescription(object):
self._description_lines = (description or '').strip().splitlines() self._description_lines = (description or '').strip().splitlines()
@property # www.logilab.org/ticket/89786 @property # www.logilab.org/ticket/89786
def description(self): # pylint: disable=E0202 def description(self): # pylint: disable=method-hidden
return '\n'.join(self._description_lines) return '\n'.join(self._description_lines)
def set_description(self, desc): def set_description(self, desc):
...@@ -3738,7 +3738,7 @@ def upload_branch_deps(cl, args): ...@@ -3738,7 +3738,7 @@ def upload_branch_deps(cl, args):
if CMDupload(OptionParser(), args) != 0: if CMDupload(OptionParser(), args) != 0:
print('Upload failed for %s!' % dependent_branch) print('Upload failed for %s!' % dependent_branch)
failures[dependent_branch] = 1 failures[dependent_branch] = 1
except: # pylint: disable=W0702 except: # pylint: disable=bare-except
failures[dependent_branch] = 1 failures[dependent_branch] = 1
print() print()
finally: finally:
...@@ -4156,7 +4156,7 @@ def CMDlint(parser, args): ...@@ -4156,7 +4156,7 @@ def CMDlint(parser, args):
auth_config = auth.extract_auth_config_from_options(options) auth_config = auth.extract_auth_config_from_options(options)
# Access to a protected member _XX of a client class # Access to a protected member _XX of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
try: try:
import cpplint import cpplint
import cpplint_chromium import cpplint_chromium
...@@ -4726,7 +4726,7 @@ def SendUpstream(parser, args, cmd): ...@@ -4726,7 +4726,7 @@ def SendUpstream(parser, args, cmd):
revision = re.match( revision = re.match(
'.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) '.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1)
logging.debug(output) logging.debug(output)
except: # pylint: disable=W0702 except: # pylint: disable=bare-except
if _IS_BEING_TESTED: if _IS_BEING_TESTED:
logging.exception('this is likely your ACTUAL cause of test failure.\n' logging.exception('this is likely your ACTUAL cause of test failure.\n'
+ '-' * 30 + '8<' + '-' * 30) + '-' * 30 + '8<' + '-' * 30)
......
...@@ -20,8 +20,8 @@ if not os.path.exists('ansi2html'): ...@@ -20,8 +20,8 @@ if not os.path.exists('ansi2html'):
# if it doesn't exist, run ./make_docs.sh first # if it doesn't exist, run ./make_docs.sh first
sys.path.insert(0, 'ansi2html') sys.path.insert(0, 'ansi2html')
import ansi2html # pylint: disable=F0401, W0611 import ansi2html # pylint: disable=import-error, W0611
import ansi2html.converter # pylint: disable=F0401, W0611 import ansi2html.converter # pylint: disable=import-error, W0611
def simpleXML(string): def simpleXML(string):
BRIGHT = 1 BRIGHT = 1
......
...@@ -46,14 +46,14 @@ import auth ...@@ -46,14 +46,14 @@ import auth
from third_party import httplib2 from third_party import httplib2
try: try:
from dateutil.relativedelta import relativedelta # pylint: disable=F0401 from dateutil.relativedelta import relativedelta # pylint: disable=import-error
except ImportError: except ImportError:
print 'python-dateutil package required' print 'python-dateutil package required'
exit(1) exit(1)
# python-keyring provides easy access to the system keyring. # python-keyring provides easy access to the system keyring.
try: try:
import keyring # pylint: disable=W0611,F0401 import keyring # pylint: disable=unused-import,F0401
except ImportError: except ImportError:
print 'Consider installing python-keyring' print 'Consider installing python-keyring'
...@@ -665,7 +665,7 @@ def main(): ...@@ -665,7 +665,7 @@ def main():
# Remove description formatting # Remove description formatting
parser.format_description = ( parser.format_description = (
lambda _: parser.description) # pylint: disable=E1101 lambda _: parser.description) # pylint: disable=no-member
options, args = parser.parse_args() options, args = parser.parse_args()
options.local_user = os.environ.get('USER') options.local_user = os.environ.get('USER')
......
...@@ -338,7 +338,7 @@ def main(): ...@@ -338,7 +338,7 @@ def main():
auth.add_auth_options(parser) auth.add_auth_options(parser)
# Remove description formatting # Remove description formatting
parser.format_description = ( parser.format_description = (
lambda _: parser.description) # pylint: disable=E1101 lambda _: parser.description) # pylint: disable=no-member
options, args = parser.parse_args() options, args = parser.parse_args()
auth_config = auth.extract_auth_config_from_options(options) auth_config = auth.extract_auth_config_from_options(options)
if args: if args:
......
...@@ -71,7 +71,7 @@ BASIC_EMAIL_REGEXP = r'^[\w\-\+\%\.]+\@[\w\-\+\%\.]+$' ...@@ -71,7 +71,7 @@ BASIC_EMAIL_REGEXP = r'^[\w\-\+\%\.]+\@[\w\-\+\%\.]+$'
def _assert_is_collection(obj): def _assert_is_collection(obj):
assert not isinstance(obj, basestring) assert not isinstance(obj, basestring)
# Module 'collections' has no 'Iterable' member # Module 'collections' has no 'Iterable' member
# pylint: disable=E1101 # pylint: disable=no-member
if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'): if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'):
assert (isinstance(obj, collections.Iterable) and assert (isinstance(obj, collections.Iterable) and
isinstance(obj, collections.Sized)) isinstance(obj, collections.Sized))
......
...@@ -154,7 +154,7 @@ def CheckChangeLintsClean(input_api, output_api, source_file_filter=None, ...@@ -154,7 +154,7 @@ def CheckChangeLintsClean(input_api, output_api, source_file_filter=None,
cpplint = input_api.cpplint cpplint = input_api.cpplint
# Access to a protected member _XX of a client class # Access to a protected member _XX of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
cpplint._cpplint_state.ResetErrorCounts() cpplint._cpplint_state.ResetErrorCounts()
lint_filters = lint_filters or DEFAULT_LINT_FILTERS lint_filters = lint_filters or DEFAULT_LINT_FILTERS
......
...@@ -282,7 +282,7 @@ class InputApi(object): ...@@ -282,7 +282,7 @@ class InputApi(object):
know stuff about the change they're looking at. know stuff about the change they're looking at.
""" """
# Method could be a function # Method could be a function
# pylint: disable=R0201 # pylint: disable=no-self-use
# File extensions that are considered source files from a style guide # File extensions that are considered source files from a style guide
# perspective. Don't modify this list from a presubmit script! # perspective. Don't modify this list from a presubmit script!
...@@ -401,7 +401,7 @@ class InputApi(object): ...@@ -401,7 +401,7 @@ class InputApi(object):
# Replace <hash_map> and <hash_set> as headers that need to be included # Replace <hash_map> and <hash_set> as headers that need to be included
# with "base/containers/hash_tables.h" instead. # with "base/containers/hash_tables.h" instead.
# Access to a protected member _XX of a client class # Access to a protected member _XX of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
self.cpplint._re_pattern_templates = [ self.cpplint._re_pattern_templates = [
(a, b, 'base/containers/hash_tables.h') (a, b, 'base/containers/hash_tables.h')
if header in ('<hash_map>', '<hash_set>') else (a, b, header) if header in ('<hash_map>', '<hash_set>') else (a, b, header)
...@@ -606,7 +606,7 @@ class AffectedFile(object): ...@@ -606,7 +606,7 @@ class AffectedFile(object):
DIFF_CACHE = _DiffCache DIFF_CACHE = _DiffCache
# Method could be a function # Method could be a function
# pylint: disable=R0201 # pylint: disable=no-self-use
def __init__(self, path, action, repository_root, diff_cache): def __init__(self, path, action, repository_root, diff_cache):
self._path = path self._path = path
self._action = action self._action = action
...@@ -695,7 +695,7 @@ class AffectedFile(object): ...@@ -695,7 +695,7 @@ class AffectedFile(object):
class GitAffectedFile(AffectedFile): class GitAffectedFile(AffectedFile):
"""Representation of a file in a change out of a git checkout.""" """Representation of a file in a change out of a git checkout."""
# Method 'NNN' is abstract in class 'NNN' but is not overridden # Method 'NNN' is abstract in class 'NNN' but is not overridden
# pylint: disable=W0223 # pylint: disable=abstract-method
DIFF_CACHE = _GitDiffCache DIFF_CACHE = _GitDiffCache
......
...@@ -33,64 +33,91 @@ load-plugins= ...@@ -33,64 +33,91 @@ load-plugins=
# can either give multiple identifier separated by comma (,) or put this option # can either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where # multiple time (only on the command line, not in the configuration file where
# it should appear only once). # it should appear only once).
# CHANGED:
# C0103: Invalid name ""
# C0111: Missing docstring
# C0302: Too many lines in module (N)
# I0010: Unable to consider inline option ''
# I0011: Locally disabling WNNNN
# #
# R0801: Similar lines in N files # These should get enabled, but the codebase has too many violations currently:
# R0901: Too many ancestors (8/7) # bad-continuation
# R0902: Too many instance attributes (N/7) # anomalous-backslash-in-string
# R0903: Too few public methods (N/2) # bad-context-manager
# R0904: Too many public methods (N/20) # bad-indentation
# R0911: Too many return statements (N/6) # bad-str-strip-call
# R0912: Too many branches (N/12) # bad-whitespace
# R0913: Too many arguments (N/5) # cell-var-from-loop
# R0914: Too many local variables (N/15) # deprecated-lambda
# R0915: Too many statements (N/50) # eval-used
# R0921: Abstract class not referenced # function-redefined
# R0922: Abstract class is only referenced 1 times # import-error
# W0122: Use of the exec statement # locally-enabled
# W0141: Used builtin function '' # missing-final-newline
# W0142: Used * or ** magic # no-init
# W0402: Uses of a deprecated module 'string' # no-name-in-module
# W0404: 41: Reimport 'XX' (imported line NN) # no-self-use
# W0511: TODO # not-callable
# W0603: Using the global statement # old-style-class
# W0703: Catch "Exception" # protected-access
# W1201: Specify string format arguments as logging function parameters # superfluous-parens
# super-on-old-class
# too-many-function-args
# trailing-whitespace
# unnecessary-semicolon
# unpacking-non-sequence
# unused-import
# useless-else-on-loop
# #
# These should get enabled, but the codebase has too many violations currently. # CHANGED:
# bad-continuation disable=
# anomalous-backslash-in-string invalid-name,
# bad-context-manager missing-docstring,
# bad-indentation too-many-lines,
# bad-str-strip-call bad-inline-option,
# bad-whitespace locally-disabled,
# cell-var-from-loop duplicate-code,
# deprecated-lambda too-many-ancestors,
# eval-used too-many-instance-attributes,
# function-redefined too-few-public-methods,
# import-error too-many-public-methods,
# locally-enabled too-many-return-statements,
# missing-final-newline too-many-branches,
# no-init too-many-arguments,
# no-name-in-module too-many-locals,
# no-self-use too-many-statements,
# not-callable abstract-class-not-used,
# old-style-class abstract-class-little-used,
# protected-access exec-used,
# superfluous-parens bad-builtin,
# super-on-old-class star-args,
# too-many-function-args deprecated-module,
# trailing-whitespace reimported,
# unnecessary-semicolon fixme,
# unpacking-non-sequence global-statement,
# unused-import broad-except,
# useless-else-on-loop logging-not-lazy,
disable=C0103,C0111,C0302,I0010,I0011,R0801,R0901,R0902,R0903,R0904,R0911,R0912,R0913,R0914,R0915,R0921,R0922,W0122,W0141,W0142,W0402,W0404,W0511,W0603,W0703,W1201,bad-continuation,anomalous-backslash-in-string,bad-context-manager,bad-indentation,bad-str-strip-call,bad-whitespace,cell-var-from-loop,deprecated-lambda,eval-used,function-redefined,import-error,locally-enabled,missing-final-newline,no-init,no-name-in-module,no-self-use,not-callable,old-style-class,protected-access,superfluous-parens,super-on-old-class,too-many-function-args,trailing-whitespace,unnecessary-semicolon,unpacking-non-sequence,unused-import,useless-else-on-loop bad-continuation,
anomalous-backslash-in-string,
bad-context-manager,
bad-indentation,
bad-str-strip-call,
bad-whitespace,
cell-var-from-loop,
deprecated-lambda,
eval-used,
function-redefined,
import-error,
locally-enabled,
missing-final-newline,
no-init,
no-name-in-module,
no-self-use,
not-callable,
old-style-class,
protected-access,
superfluous-parens,
super-on-old-class,
too-many-function-args,
trailing-whitespace,
unnecessary-semicolon,
unpacking-non-sequence,
unused-import,
useless-else-on-loop
[REPORTS] [REPORTS]
......
...@@ -604,7 +604,7 @@ class JwtOAuth2Rietveld(Rietveld): ...@@ -604,7 +604,7 @@ class JwtOAuth2Rietveld(Rietveld):
access is restricted to service accounts. access is restricted to service accounts.
""" """
# The parent__init__ is not called on purpose. # The parent__init__ is not called on purpose.
# pylint: disable=W0231 # pylint: disable=super-init-not-called
def __init__(self, def __init__(self,
url, url,
client_email, client_email,
...@@ -718,7 +718,7 @@ class ReadOnlyRietveld(object): ...@@ -718,7 +718,7 @@ class ReadOnlyRietveld(object):
if not self._get_local_changes(issue).get('closed', False) and if not self._get_local_changes(issue).get('closed', False) and
self._get_local_changes(issue).get('commit', True)] self._get_local_changes(issue).get('commit', True)]
def close_issue(self, issue): # pylint:disable=R0201 def close_issue(self, issue): # pylint:disable=no-self-use
logging.info('ReadOnlyRietveld: closing issue %d' % issue) logging.info('ReadOnlyRietveld: closing issue %d' % issue)
ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True
...@@ -736,18 +736,18 @@ class ReadOnlyRietveld(object): ...@@ -736,18 +736,18 @@ class ReadOnlyRietveld(object):
def get_patch(self, issue, patchset): def get_patch(self, issue, patchset):
return self._rietveld.get_patch(issue, patchset) return self._rietveld.get_patch(issue, patchset)
def update_description(self, issue, description): # pylint:disable=R0201 def update_description(self, issue, description): # pylint:disable=no-self-use
logging.info('ReadOnlyRietveld: new description for issue %d: %s' % logging.info('ReadOnlyRietveld: new description for issue %d: %s' %
(issue, description)) (issue, description))
def add_comment(self, # pylint:disable=R0201 def add_comment(self, # pylint:disable=no-self-use
issue, issue,
message, message,
add_as_reviewer=False): add_as_reviewer=False):
logging.info('ReadOnlyRietveld: posting comment "%s" to issue %d' % logging.info('ReadOnlyRietveld: posting comment "%s" to issue %d' %
(message, issue)) (message, issue))
def set_flag(self, issue, patchset, flag, value): # pylint:disable=R0201 def set_flag(self, issue, patchset, flag, value): # pylint:disable=no-self-use
logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' % logging.info('ReadOnlyRietveld: setting flag "%s" to "%s" for issue %d' %
(flag, value, issue)) (flag, value, issue))
ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value
...@@ -756,13 +756,13 @@ class ReadOnlyRietveld(object): ...@@ -756,13 +756,13 @@ class ReadOnlyRietveld(object):
for flag, value in flags.iteritems(): for flag, value in flags.iteritems():
self.set_flag(issue, patchset, flag, value) self.set_flag(issue, patchset, flag, value)
def trigger_try_jobs( # pylint:disable=R0201 def trigger_try_jobs( # pylint:disable=no-self-use
self, issue, patchset, reason, clobber, revision, builders_and_tests, self, issue, patchset, reason, clobber, revision, builders_and_tests,
master=None, category='cq'): master=None, category='cq'):
logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
(builders_and_tests, issue)) (builders_and_tests, issue))
def trigger_distributed_try_jobs( # pylint:disable=R0201 def trigger_distributed_try_jobs( # pylint:disable=no-self-use
self, issue, patchset, reason, clobber, revision, masters, self, issue, patchset, reason, clobber, revision, masters,
category='cq'): category='cq'):
logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' %
......
...@@ -58,7 +58,7 @@ def kill_pid(pid): ...@@ -58,7 +58,7 @@ def kill_pid(pid):
"""Kills a process by its process id.""" """Kills a process by its process id."""
try: try:
# Unable to import 'module' # Unable to import 'module'
# pylint: disable=E1101,F0401 # pylint: disable=no-member,F0401
import signal import signal
return os.kill(pid, signal.SIGKILL) return os.kill(pid, signal.SIGKILL)
except ImportError: except ImportError:
...@@ -72,10 +72,10 @@ def kill_win(process): ...@@ -72,10 +72,10 @@ def kill_win(process):
""" """
try: try:
# Unable to import 'module' # Unable to import 'module'
# pylint: disable=F0401 # pylint: disable=import-error
import win32process import win32process
# Access to a protected member _handle of a client class # Access to a protected member _handle of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
return win32process.TerminateProcess(process._handle, -1) return win32process.TerminateProcess(process._handle, -1)
except ImportError: except ImportError:
pass pass
...@@ -261,7 +261,7 @@ class Popen(subprocess.Popen): ...@@ -261,7 +261,7 @@ class Popen(subprocess.Popen):
'Check that %s or %s exist and have execution permission.' 'Check that %s or %s exist and have execution permission.'
% (str(e), kwargs.get('cwd'), args[0])) % (str(e), kwargs.get('cwd'), args[0]))
def _tee_threads(self, input): # pylint: disable=W0622 def _tee_threads(self, input): # pylint: disable=redefined-builtin
"""Does I/O for a process's pipes using threads. """Does I/O for a process's pipes using threads.
It's the simplest and slowest implementation. Expect very slow behavior. It's the simplest and slowest implementation. Expect very slow behavior.
...@@ -391,7 +391,7 @@ class Popen(subprocess.Popen): ...@@ -391,7 +391,7 @@ class Popen(subprocess.Popen):
if timed_out: if timed_out:
self.returncode = TIMED_OUT self.returncode = TIMED_OUT
# pylint: disable=W0221,W0622 # pylint: disable=arguments-differ,W0622
def communicate(self, input=None, timeout=None, nag_timer=None, def communicate(self, input=None, timeout=None, nag_timer=None,
nag_max=None): nag_max=None):
"""Adds timeout and callbacks support. """Adds timeout and callbacks support.
......
...@@ -346,7 +346,7 @@ class GerritTestCase(unittest.TestCase): ...@@ -346,7 +346,7 @@ class GerritTestCase(unittest.TestCase):
except OSError as e: except OSError as e:
if e.errno == errno.ECHILD: if e.errno == errno.ECHILD:
# If gerrit shut down cleanly, os.waitpid will land here. # If gerrit shut down cleanly, os.waitpid will land here.
# pylint: disable=W0150 # pylint: disable=lost-exception
return return
# If we get here, the gerrit process is still alive. Send the process # If we get here, the gerrit process is still alive. Send the process
...@@ -357,7 +357,7 @@ class GerritTestCase(unittest.TestCase): ...@@ -357,7 +357,7 @@ class GerritTestCase(unittest.TestCase):
if e.errno == errno.ESRCH: if e.errno == errno.ESRCH:
# os.kill raised an error because the process doesn't exist. Maybe # os.kill raised an error because the process doesn't exist. Maybe
# gerrit shut down cleanly after all. # gerrit shut down cleanly after all.
# pylint: disable=W0150 # pylint: disable=lost-exception
return return
# Announce that gerrit didn't shut down cleanly. # Announce that gerrit didn't shut down cleanly.
......
...@@ -85,7 +85,7 @@ class OrderedSet(collections.MutableSet): ...@@ -85,7 +85,7 @@ class OrderedSet(collections.MutableSet):
prev[2] = nxt prev[2] = nxt
nxt[1] = prev nxt[1] = prev
def pop(self, last=True): # pylint: disable=W0221 def pop(self, last=True): # pylint: disable=arguments-differ
if not self: if not self:
raise KeyError('set is empty') raise KeyError('set is empty')
key = self.end[1][0] if last else self.end[2][0] key = self.end[1][0] if last else self.end[2][0]
...@@ -415,7 +415,7 @@ class GitRepo(object): ...@@ -415,7 +415,7 @@ class GitRepo(object):
stdout = sys.stdout stdout = sys.stdout
stderr = sys.stderr stderr = sys.stderr
try: try:
# "multiple statements on a line" pylint: disable=C0321 # "multiple statements on a line" pylint: disable=multiple-statements
with tempfile.TemporaryFile() as out, tempfile.TemporaryFile() as err: with tempfile.TemporaryFile() as out, tempfile.TemporaryFile() as err:
sys.stdout = out sys.stdout = out
sys.stderr = err sys.stderr = err
......
...@@ -69,7 +69,7 @@ class TestCaseUtils(object): ...@@ -69,7 +69,7 @@ class TestCaseUtils(object):
diff = ([i for i in actual_members if i not in expected_members] + diff = ([i for i in actual_members if i not in expected_members] +
[i for i in expected_members if i not in actual_members]) [i for i in expected_members if i not in actual_members])
print >> sys.stderr, diff print >> sys.stderr, diff
# pylint: disable=E1101 # pylint: disable=no-member
self.assertEqual(actual_members, expected_members) self.assertEqual(actual_members, expected_members)
def setUp(self): def setUp(self):
...@@ -92,7 +92,7 @@ class StdoutCheck(object): ...@@ -92,7 +92,7 @@ class StdoutCheck(object):
def tearDown(self): def tearDown(self):
try: try:
# If sys.stdout was used, self.checkstdout() must be called. # If sys.stdout was used, self.checkstdout() must be called.
# pylint: disable=E1101 # pylint: disable=no-member
if not sys.stdout.closed: if not sys.stdout.closed:
self.assertEquals('', sys.stdout.getvalue()) self.assertEquals('', sys.stdout.getvalue())
except AttributeError: except AttributeError:
...@@ -102,7 +102,7 @@ class StdoutCheck(object): ...@@ -102,7 +102,7 @@ class StdoutCheck(object):
def checkstdout(self, expected): def checkstdout(self, expected):
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout.close() sys.stdout.close()
# pylint: disable=E1101 # pylint: disable=no-member
self.assertEquals(expected, value) self.assertEquals(expected, value)
......
...@@ -10,7 +10,7 @@ import os ...@@ -10,7 +10,7 @@ import os
import sys import sys
import unittest import unittest
#import test_env # pylint: disable=W0403,W0611 #import test_env # pylint: disable=relative-import,unused-import
sys.path.insert(0, os.path.join( sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), os.path.dirname(os.path.dirname(os.path.abspath(__file__))),
......
...@@ -87,7 +87,7 @@ class FakeRepos(fake_repos.FakeReposBase): ...@@ -87,7 +87,7 @@ class FakeRepos(fake_repos.FakeReposBase):
return fs return fs
# pylint: disable=R0201 # pylint: disable=no-self-use
class BaseTest(fake_repos.FakeReposTestBase): class BaseTest(fake_repos.FakeReposTestBase):
name = 'foo' name = 'foo'
FAKE_REPOS_CLASS = FakeRepos FAKE_REPOS_CLASS = FakeRepos
...@@ -188,7 +188,7 @@ class GitBaseTest(BaseTest): ...@@ -188,7 +188,7 @@ class GitBaseTest(BaseTest):
self.assertTrue(self.enabled) self.assertTrue(self.enabled)
self.previous_log = self._log() self.previous_log = self._log()
# pylint: disable=W0221 # pylint: disable=arguments-differ
def _log(self, log_from_local_repo=False): def _log(self, log_from_local_repo=False):
if log_from_local_repo: if log_from_local_repo:
repo_root = os.path.join(self.root_dir, self.name) repo_root = os.path.join(self.root_dir, self.name)
...@@ -231,7 +231,7 @@ class GitBaseTest(BaseTest): ...@@ -231,7 +231,7 @@ class GitBaseTest(BaseTest):
patches.filenames) patches.filenames)
# Hackish to verify _branches() internal function. # Hackish to verify _branches() internal function.
# pylint: disable=W0212 # pylint: disable=protected-access
self.assertEquals( self.assertEquals(
(['master', 'working_branch'], 'working_branch'), (['master', 'working_branch'], 'working_branch'),
co._branches()) co._branches())
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# pylint: disable=W0212 # pylint: disable=protected-access
"""Unit tests for download_from_google_storage.py.""" """Unit tests for download_from_google_storage.py."""
......
...@@ -42,14 +42,10 @@ def strip_timestamps(value): ...@@ -42,14 +42,10 @@ def strip_timestamps(value):
lines[i] = m.group(1) lines[i] = m.group(1)
return ''.join(lines) return ''.join(lines)
# Access to a protected member XXX of a client class
# pylint: disable=W0212
class GCBaseTestCase(object): class GCBaseTestCase(object):
def assertRaisesError(self, msg, fn, *args, **kwargs): def assertRaisesError(self, msg, fn, *args, **kwargs):
"""Like unittest's assertRaises() but checks for Gclient.Error.""" """Like unittest's assertRaises() but checks for Gclient.Error."""
# pylint: disable=E1101
try: try:
fn(*args, **kwargs) fn(*args, **kwargs)
except gclient_scm.gclient_utils.Error, e: except gclient_scm.gclient_utils.Error, e:
...@@ -192,7 +188,7 @@ from :3 ...@@ -192,7 +188,7 @@ from :3
def checkstdout(self, expected): def checkstdout(self, expected):
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout.close() sys.stdout.close()
# pylint: disable=E1101 # pylint: disable=no-member
self.assertEquals(expected, strip_timestamps(value)) self.assertEquals(expected, strip_timestamps(value))
@staticmethod @staticmethod
...@@ -572,7 +568,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): ...@@ -572,7 +568,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
def checkstdout(self, expected): def checkstdout(self, expected):
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout.close() sys.stdout.close()
# pylint: disable=E1101 # pylint: disable=no-member
self.assertEquals(expected, strip_timestamps(value)) self.assertEquals(expected, strip_timestamps(value))
def setUp(self): def setUp(self):
...@@ -590,7 +586,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): ...@@ -590,7 +586,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
BaseTestCase.tearDown(self) BaseTestCase.tearDown(self)
def testGetUsableRevGit(self): def testGetUsableRevGit(self):
# pylint: disable=E1101 # pylint: disable=no-member
options = self.Options(verbose=True) options = self.Options(verbose=True)
self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsValidRevision', True) self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsValidRevision', True)
...@@ -631,7 +627,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): ...@@ -631,7 +627,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
).AndReturn(False) ).AndReturn(False)
self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
# pylint: disable=E1120 # pylint: disable=no-value-for-parameter
gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
options) options)
self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
...@@ -662,7 +658,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): ...@@ -662,7 +658,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase):
gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
).AndReturn(False) ).AndReturn(False)
self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
# pylint: disable=E1120 # pylint: disable=no-value-for-parameter
gclient_scm.GitWrapper._Clone( gclient_scm.GitWrapper._Clone(
'refs/remotes/origin/master', self.url, options 'refs/remotes/origin/master', self.url, options
).AndRaise(gclient_scm.subprocess2.CalledProcessError(None, None, None, ).AndRaise(gclient_scm.subprocess2.CalledProcessError(None, None, None,
...@@ -693,13 +689,13 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): ...@@ -693,13 +689,13 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase):
def checkInStdout(self, expected): def checkInStdout(self, expected):
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout.close() sys.stdout.close()
# pylint: disable=E1101 # pylint: disable=no-member
self.assertIn(expected, value) self.assertIn(expected, value)
def checkNotInStdout(self, expected): def checkNotInStdout(self, expected):
value = sys.stdout.getvalue() value = sys.stdout.getvalue()
sys.stdout.close() sys.stdout.close()
# pylint: disable=E1101 # pylint: disable=no-member
self.assertNotIn(expected, value) self.assertNotIn(expected, value)
def getCurrentBranch(self): def getCurrentBranch(self):
......
...@@ -52,7 +52,6 @@ class GClientSmokeBase(fake_repos.FakeReposTestBase): ...@@ -52,7 +52,6 @@ class GClientSmokeBase(fake_repos.FakeReposTestBase):
(stdout, stderr) = process.communicate() (stdout, stderr) = process.communicate()
logging.debug("XXX: %s\n%s\nXXX" % (' '.join(cmd), stdout)) logging.debug("XXX: %s\n%s\nXXX" % (' '.join(cmd), stdout))
logging.debug("YYY: %s\n%s\nYYY" % (' '.join(cmd), stderr)) logging.debug("YYY: %s\n%s\nYYY" % (' '.join(cmd), stderr))
# pylint: disable=E1103
return (stdout.replace('\r\n', '\n'), stderr.replace('\r\n', '\n'), return (stdout.replace('\r\n', '\n'), stderr.replace('\r\n', '\n'),
process.returncode) process.returncode)
...@@ -565,7 +564,7 @@ class GClientSmokeGITMutates(GClientSmokeBase): ...@@ -565,7 +564,7 @@ class GClientSmokeGITMutates(GClientSmokeBase):
new_deps = cur_deps.replace('repo_2@%s\'' % repo_2_hash, new_deps = cur_deps.replace('repo_2@%s\'' % repo_2_hash,
'repo_2@\' + Var(\'r2hash\')') 'repo_2@\' + Var(\'r2hash\')')
new_deps = 'vars = {\'r2hash\': \'%s\'}\n%s' % (repo_2_hash, new_deps) new_deps = 'vars = {\'r2hash\': \'%s\'}\n%s' % (repo_2_hash, new_deps)
self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=W0212 self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=protected-access
'DEPS': new_deps, 'DEPS': new_deps,
'origin': 'git/repo_1@3\n', 'origin': 'git/repo_1@3\n',
}) })
...@@ -609,7 +608,7 @@ class GClientSmokeGITMutates(GClientSmokeBase): ...@@ -609,7 +608,7 @@ class GClientSmokeGITMutates(GClientSmokeBase):
self.assertTree(tree) self.assertTree(tree)
# Make a new commit object in the origin repo, to force reset to fetch. # Make a new commit object in the origin repo, to force reset to fetch.
self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=W0212 self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=protected-access
'origin': 'git/repo_2@3\n', 'origin': 'git/repo_2@3\n',
}) })
...@@ -639,13 +638,13 @@ class GClientSmokeGITMutates(GClientSmokeBase): ...@@ -639,13 +638,13 @@ class GClientSmokeGITMutates(GClientSmokeBase):
# Create an extra commit in repo_2 and point DEPS to its hash. # Create an extra commit in repo_2 and point DEPS to its hash.
cur_deps = self.FAKE_REPOS.git_hashes['repo_1'][-1][1]['DEPS'] cur_deps = self.FAKE_REPOS.git_hashes['repo_1'][-1][1]['DEPS']
repo_2_hash_old = self.FAKE_REPOS.git_hashes['repo_2'][1][0][:7] repo_2_hash_old = self.FAKE_REPOS.git_hashes['repo_2'][1][0][:7]
self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=W0212 self.FAKE_REPOS._commit_git('repo_2', { # pylint: disable=protected-access
'last_file': 'file created in last commit', 'last_file': 'file created in last commit',
}) })
repo_2_hash_new = self.FAKE_REPOS.git_hashes['repo_2'][-1][0] repo_2_hash_new = self.FAKE_REPOS.git_hashes['repo_2'][-1][0]
new_deps = cur_deps.replace(repo_2_hash_old, repo_2_hash_new) new_deps = cur_deps.replace(repo_2_hash_old, repo_2_hash_new)
self.assertNotEqual(new_deps, cur_deps) self.assertNotEqual(new_deps, cur_deps)
self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=W0212 self.FAKE_REPOS._commit_git('repo_1', { # pylint: disable=protected-access
'DEPS': new_deps, 'DEPS': new_deps,
'origin': 'git/repo_1@4\n', 'origin': 'git/repo_1@4\n',
}) })
......
...@@ -45,7 +45,7 @@ class SCMMock(object): ...@@ -45,7 +45,7 @@ class SCMMock(object):
def FullUrlForRelativeUrl(self, url): def FullUrlForRelativeUrl(self, url):
return self.url + url return self.url + url
# pylint: disable=R0201 # pylint: disable=no-self-use
def DoesRemoteURLMatch(self, _): def DoesRemoteURLMatch(self, _):
return True return True
...@@ -247,7 +247,7 @@ class GclientTest(trial_dir.TestCase): ...@@ -247,7 +247,7 @@ class GclientTest(trial_dir.TestCase):
], ],
[]) [])
# Make sure __str__() works fine. # Make sure __str__() works fine.
# pylint: disable=W0212 # pylint: disable=protected-access
obj.dependencies[0]._file_list.append('foo') obj.dependencies[0]._file_list.append('foo')
str_obj = str(obj) str_obj = str(obj)
self.assertEquals(370, len(str_obj), '%d\n%s' % (len(str_obj), str_obj)) self.assertEquals(370, len(str_obj), '%d\n%s' % (len(str_obj), str_obj))
......
...@@ -29,7 +29,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase): ...@@ -29,7 +29,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase):
def __init__(self, test_string): def __init__(self, test_string):
self.stdout = StringIO.StringIO(test_string) self.stdout = StringIO.StringIO(test_string)
self.pid = 9284 self.pid = 9284
# pylint: disable=R0201 # pylint: disable=no-self-use
def wait(self): def wait(self):
return 0 return 0
...@@ -39,7 +39,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase): ...@@ -39,7 +39,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase):
'\n________ running \'boo foo bar\' in \'bleh\'\n') '\n________ running \'boo foo bar\' in \'bleh\'\n')
for i in test_string: for i in test_string:
gclient_utils.sys.stdout.write(i) gclient_utils.sys.stdout.write(i)
# pylint: disable=E1101 # pylint: disable=no-member
subprocess2.Popen( subprocess2.Popen(
args, args,
cwd=cwd, cwd=cwd,
......
...@@ -115,7 +115,7 @@ class WatchlistsMock(object): ...@@ -115,7 +115,7 @@ class WatchlistsMock(object):
class CodereviewSettingsFileMock(object): class CodereviewSettingsFileMock(object):
def __init__(self): def __init__(self):
pass pass
# pylint: disable=R0201 # pylint: disable=no-self-use
def read(self): def read(self):
return ("CODE_REVIEW_SERVER: gerrit.chromium.org\n" + return ("CODE_REVIEW_SERVER: gerrit.chromium.org\n" +
"GERRIT_HOST: True\n") "GERRIT_HOST: True\n")
...@@ -142,7 +142,7 @@ def CookiesAuthenticatorMockFactory(hosts_with_creds=None, same_cookie=False): ...@@ -142,7 +142,7 @@ def CookiesAuthenticatorMockFactory(hosts_with_creds=None, same_cookie=False):
CookiesAuthenticatorMockFactory(cookie='cookie')) CookiesAuthenticatorMockFactory(cookie='cookie'))
""" """
class CookiesAuthenticatorMock(git_cl.gerrit_util.CookiesAuthenticator): class CookiesAuthenticatorMock(git_cl.gerrit_util.CookiesAuthenticator):
def __init__(self): # pylint: disable=W0231 def __init__(self): # pylint: disable=super-init-not-called
# Intentionally not calling super() because it reads actual cookie files. # Intentionally not calling super() because it reads actual cookie files.
pass pass
@classmethod @classmethod
......
...@@ -741,7 +741,7 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, ...@@ -741,7 +741,7 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase,
def testStatus(self): def testStatus(self):
def inner(): def inner():
dictified_status = lambda: { dictified_status = lambda: {
k: dict(v._asdict()) # pylint: disable=W0212 k: dict(v._asdict()) # pylint: disable=protected-access
for k, v in self.repo.run(self.gc.status) for k, v in self.repo.run(self.gc.status)
} }
self.repo.git('mv', 'file', 'cat') self.repo.git('mv', 'file', 'cat')
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"""Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" """Unit tests for presubmit_support.py and presubmit_canned_checks.py."""
# pylint: disable=E1101,E1103 # pylint: disable=no-member,E1103
import StringIO import StringIO
import functools import functools
...@@ -32,7 +32,7 @@ presubmit_canned_checks = presubmit.presubmit_canned_checks ...@@ -32,7 +32,7 @@ presubmit_canned_checks = presubmit.presubmit_canned_checks
# Access to a protected member XXX of a client class # Access to a protected member XXX of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
class PresubmitTestsBase(SuperMoxTestBase): class PresubmitTestsBase(SuperMoxTestBase):
...@@ -1518,7 +1518,7 @@ class CannedChecksUnittest(PresubmitTestsBase): ...@@ -1518,7 +1518,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
"""Tests presubmit_canned_checks.py.""" """Tests presubmit_canned_checks.py."""
def MockInputApi(self, change, committing): def MockInputApi(self, change, committing):
# pylint: disable=R0201 # pylint: disable=no-self-use
input_api = self.mox.CreateMock(presubmit.InputApi) input_api = self.mox.CreateMock(presubmit.InputApi)
input_api.cStringIO = presubmit.cStringIO input_api.cStringIO = presubmit.cStringIO
input_api.json = presubmit.json input_api.json = presubmit.json
......
...@@ -52,7 +52,7 @@ class BaseFixture(unittest.TestCase): ...@@ -52,7 +52,7 @@ class BaseFixture(unittest.TestCase):
def setUp(self): def setUp(self):
super(BaseFixture, self).setUp() super(BaseFixture, self).setUp()
# Access to a protected member XX of a client class # Access to a protected member XX of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
self.rietveld = self.TESTED_CLASS('url', None, 'email') self.rietveld = self.TESTED_CLASS('url', None, 'email')
self.rietveld._send = self._rietveld_send self.rietveld._send = self._rietveld_send
self.requests = [] self.requests = []
...@@ -276,8 +276,7 @@ class RietveldTest(BaseFixture): ...@@ -276,8 +276,7 @@ class RietveldTest(BaseFixture):
is_new=True) is_new=True)
def test_svn_properties(self): def test_svn_properties(self):
# Line too long (N/80) # pylint: disable=line-too-long
# pylint: disable=C0301
# To test one of these, run something like # To test one of these, run something like
# import json, pprint, urllib # import json, pprint, urllib
......
...@@ -20,7 +20,7 @@ import subprocess2 ...@@ -20,7 +20,7 @@ import subprocess2
# Access to a protected member XXX of a client class # Access to a protected member XXX of a client class
# pylint: disable=W0212 # pylint: disable=protected-access
class BaseTestCase(SuperMoxTestBase): class BaseTestCase(SuperMoxTestBase):
......
...@@ -13,7 +13,7 @@ import time ...@@ -13,7 +13,7 @@ import time
import unittest import unittest
try: try:
import fcntl # pylint: disable=F0401 import fcntl # pylint: disable=import-error
except ImportError: except ImportError:
fcntl = None fcntl = None
...@@ -25,7 +25,7 @@ import subprocess2 ...@@ -25,7 +25,7 @@ import subprocess2
from testing_support import auto_stub from testing_support import auto_stub
# Method could be a function # Method could be a function
# pylint: disable=R0201 # pylint: disable=no-self-use
# Create aliases for subprocess2 specific tests. They shouldn't be used for # Create aliases for subprocess2 specific tests. They shouldn't be used for
...@@ -77,7 +77,7 @@ class DefaultsTest(auto_stub.TestCase): ...@@ -77,7 +77,7 @@ class DefaultsTest(auto_stub.TestCase):
results.update(kwargs) results.update(kwargs)
results['args'] = args results['args'] = args
@staticmethod @staticmethod
# pylint: disable=W0622 # pylint: disable=redefined-builtin
def communicate(input=None, timeout=None, nag_max=None, nag_timer=None): def communicate(input=None, timeout=None, nag_max=None, nag_timer=None):
return None, None return None, None
self.mock(subprocess2, 'Popen', fake_Popen) self.mock(subprocess2, 'Popen', fake_Popen)
...@@ -132,7 +132,7 @@ class DefaultsTest(auto_stub.TestCase): ...@@ -132,7 +132,7 @@ class DefaultsTest(auto_stub.TestCase):
results = self._fake_subprocess_Popen() results = self._fake_subprocess_Popen()
proc = subprocess2.Popen(['foo'], a=True) proc = subprocess2.Popen(['foo'], a=True)
# Cleanup code in subprocess.py needs this member to be set. # Cleanup code in subprocess.py needs this member to be set.
# pylint: disable=W0201 # pylint: disable=attribute-defined-outside-init
proc._child_created = None proc._child_created = None
expected = { expected = {
'args': ['foo'], 'args': ['foo'],
...@@ -236,11 +236,11 @@ class RegressionTest(BaseTestCase): ...@@ -236,11 +236,11 @@ class RegressionTest(BaseTestCase):
self.fail() self.fail()
except ValueError: except ValueError:
pass pass
if (sys.version_info[0] * 10 + sys.version_info[1]) >= 27: if (sys.version_info[0] * 10 + sys.version_info[1]) >= 27:
# python 2.7+ # python 2.7+
try: try:
# pylint: disable=E1101 # pylint: disable=no-member
subprocess.check_output(self.exe, stdout=subprocess.PIPE) subprocess.check_output(self.exe, stdout=subprocess.PIPE)
self.fail() self.fail()
except ValueError: except ValueError:
...@@ -617,11 +617,11 @@ class S2Test(BaseTestCase): ...@@ -617,11 +617,11 @@ class S2Test(BaseTestCase):
'No output for 9 seconds from command:', proc.cmd_str] 'No output for 9 seconds from command:', proc.cmd_str]
self.assertEquals(w, expected) self.assertEquals(w, expected)
def child_main(args): def child_main(args):
if sys.platform == 'win32': if sys.platform == 'win32':
# Annoying, make sure the output is not translated on Windows. # Annoying, make sure the output is not translated on Windows.
# pylint: disable=E1101,F0401 # pylint: disable=no-member,import-error
import msvcrt import msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
......
...@@ -116,7 +116,7 @@ class UploadTests(unittest.TestCase): ...@@ -116,7 +116,7 @@ class UploadTests(unittest.TestCase):
work_queue.put((None, None)) work_queue.put((None, None))
self.gsutil.add_expected(1, '', '') # For the first ls call. self.gsutil.add_expected(1, '', '') # For the first ls call.
self.gsutil.add_expected(20, '', 'Expected error message') self.gsutil.add_expected(20, '', 'Expected error message')
# pylint: disable=W0212 # pylint: disable=protected-access
upload_to_google_storage._upload_worker( upload_to_google_storage._upload_worker(
0, 0,
work_queue, work_queue,
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
"""Unit tests for watchlists.py.""" """Unit tests for watchlists.py."""
# pylint: disable=E1103,E1120,W0212 # pylint: disable=E1103,no-value-for-parameter,protected-access
import os import os
import sys import sys
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment