From b2cc4a94daa946aeb94c2bb9e5d34f56adfa71b2 Mon Sep 17 00:00:00 2001 From: Quinten Yearsley Date: Thu, 15 Dec 2016 13:53:26 -0800 Subject: [PATCH] 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/420412 Reviewed-by: Aaron Gable Commit-Queue: Quinten Yearsley --- apply_issue.py | 2 +- checkout.py | 2 +- commit_queue.py | 2 +- fetch_configs/android.py | 4 +- fetch_configs/breakpad.py | 4 +- fetch_configs/chromium.py | 4 +- fetch_configs/crashpad.py | 4 +- fetch_configs/dart.py | 4 +- fetch_configs/dartino.py | 4 +- fetch_configs/dartium.py | 4 +- fetch_configs/depot_tools.py | 4 +- fetch_configs/gyp.py | 4 +- fetch_configs/infra.py | 4 +- fetch_configs/infra_internal.py | 4 +- fetch_configs/ios.py | 4 +- fetch_configs/ios_internal.py | 4 +- fetch_configs/mojo.py | 4 +- fetch_configs/nacl.py | 4 +- fetch_configs/naclports.py | 4 +- fetch_configs/pdfium.py | 4 +- fetch_configs/skia.py | 4 +- fetch_configs/skia_buildbot.py | 4 +- fetch_configs/syzygy.py | 4 +- fetch_configs/v8.py | 4 +- fetch_configs/webrtc.py | 4 +- fetch_configs/webrtc_android.py | 4 +- fetch_configs/webrtc_ios.py | 4 +- fix_encoding.py | 12 +- gclient.py | 2 +- gclient_scm.py | 2 +- gclient_utils.py | 4 +- git_cache.py | 2 +- git_cherry_pick_upload.py | 8 +- git_cl.py | 10 +- man/src/filter_demo_output.py | 4 +- my_activity.py | 6 +- my_reviews.py | 2 +- owners.py | 2 +- presubmit_canned_checks.py | 2 +- presubmit_support.py | 8 +- pylintrc | 139 +++++++++++------- rietveld.py | 14 +- subprocess2.py | 10 +- testing_support/gerrit_test_case.py | 4 +- testing_support/git_test_utils.py | 4 +- testing_support/super_mox.py | 6 +- tests/bot_update_coverage_test.py | 2 +- tests/checkout_test.py | 6 +- .../download_from_google_storage_unittests.py | 2 +- tests/gclient_scm_test.py | 18 +-- tests/gclient_smoketest.py | 9 +- tests/gclient_test.py | 4 +- tests/gclient_utils_test.py | 4 +- tests/git_cl_test.py | 4 +- tests/git_common_test.py | 2 +- tests/presubmit_unittest.py | 6 +- tests/rietveld_test.py | 5 +- tests/scm_unittest.py | 2 +- tests/subprocess2_test.py | 16 +- tests/upload_to_google_storage_unittests.py | 2 +- tests/watchlists_unittest.py | 2 +- 61 files changed, 224 insertions(+), 203 deletions(-) diff --git a/apply_issue.py b/apply_issue.py index 8a2f573ac..9e407a654 100755 --- a/apply_issue.py +++ b/apply_issue.py @@ -159,7 +159,7 @@ def main(): properties = None # Bad except clauses order (HTTPError is an ancestor class of # ClientLoginError) - # pylint: disable=E0701 + # pylint: disable=bad-except-order try: properties = rietveld_obj.get_issue_properties(options.issue, False) except urllib2.HTTPError as e: diff --git a/checkout.py b/checkout.py index 2c599674c..4a5900009 100644 --- a/checkout.py +++ b/checkout.py @@ -414,7 +414,7 @@ class ReadOnlyCheckout(object): return self.checkout.apply_patch( 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' % ( user, message)) return 'FAKE' diff --git a/commit_queue.py b/commit_queue.py index eb667a49a..714c9024c 100755 --- a/commit_queue.py +++ b/commit_queue.py @@ -276,7 +276,7 @@ def gen_usage(parser, command): def main(args=None): # Do it late so all commands are listed. - # pylint: disable=E1101 + # pylint: disable=no-member parser = OptionParser(version=__version__) if args is None: args = sys.argv[1:] diff --git a/fetch_configs/android.py b/fetch_configs/android.py index 226347090..4365e0e77 100644 --- a/fetch_configs/android.py +++ b/fetch_configs/android.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Android(config_util.Config): """Basic Config alias for Android -> Chromium.""" diff --git a/fetch_configs/breakpad.py b/fetch_configs/breakpad.py index b023e7665..11d311a6d 100644 --- a/fetch_configs/breakpad.py +++ b/fetch_configs/breakpad.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Breakpad(config_util.Config): @staticmethod def fetch_spec(props): diff --git a/fetch_configs/chromium.py b/fetch_configs/chromium.py index d4dae2dc0..293383c71 100644 --- a/fetch_configs/chromium.py +++ b/fetch_configs/chromium.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Chromium(config_util.Config): """Basic Config class for Chromium.""" diff --git a/fetch_configs/crashpad.py b/fetch_configs/crashpad.py index d50992b3d..281672bdb 100644 --- a/fetch_configs/crashpad.py +++ b/fetch_configs/crashpad.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class CrashpadConfig(config_util.Config): """Basic Config class for Crashpad.""" diff --git a/fetch_configs/dart.py b/fetch_configs/dart.py index fea854355..5a0d467b7 100644 --- a/fetch_configs/dart.py +++ b/fetch_configs/dart.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Dart(config_util.Config): """Basic Config class for Dart.""" diff --git a/fetch_configs/dartino.py b/fetch_configs/dartino.py index 9cf51863e..6f402a323 100644 --- a/fetch_configs/dartino.py +++ b/fetch_configs/dartino.py @@ -4,10 +4,10 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Dartino(config_util.Config): """Basic Config class for Dartino.""" diff --git a/fetch_configs/dartium.py b/fetch_configs/dartium.py index 10870dd09..600f1318f 100644 --- a/fetch_configs/dartium.py +++ b/fetch_configs/dartium.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Dart(config_util.Config): """Basic Config class for Dart.""" diff --git a/fetch_configs/depot_tools.py b/fetch_configs/depot_tools.py index bdbf954e5..cde9aad84 100644 --- a/fetch_configs/depot_tools.py +++ b/fetch_configs/depot_tools.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class DepotTools(config_util.Config): """Basic Config class for DepotTools.""" diff --git a/fetch_configs/gyp.py b/fetch_configs/gyp.py index aef3e1191..4075ee537 100644 --- a/fetch_configs/gyp.py +++ b/fetch_configs/gyp.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Chromium(config_util.Config): """Basic Config class for Chromium.""" diff --git a/fetch_configs/infra.py b/fetch_configs/infra.py index 29681b21b..16370c836 100644 --- a/fetch_configs/infra.py +++ b/fetch_configs/infra.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Infra(config_util.Config): """Basic Config class for the Infrastructure repositories.""" diff --git a/fetch_configs/infra_internal.py b/fetch_configs/infra_internal.py index 5643fc111..f5bc9b6ae 100644 --- a/fetch_configs/infra_internal.py +++ b/fetch_configs/infra_internal.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class InfraInternal(config_util.Config): """Basic Config class for the whole set of Infrastructure repositories.""" diff --git a/fetch_configs/ios.py b/fetch_configs/ios.py index 57f5a695f..14eb59d09 100644 --- a/fetch_configs/ios.py +++ b/fetch_configs/ios.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class IOS(config_util.Config): """Basic Config alias for iOS -> Chromium.""" diff --git a/fetch_configs/ios_internal.py b/fetch_configs/ios_internal.py index d89120128..3adfa28b0 100644 --- a/fetch_configs/ios_internal.py +++ b/fetch_configs/ios_internal.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class IOSInternal(config_util.Config): """Basic Config class for Chrome on iOS.""" diff --git a/fetch_configs/mojo.py b/fetch_configs/mojo.py index 3442044c6..24e65a39b 100644 --- a/fetch_configs/mojo.py +++ b/fetch_configs/mojo.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Mojo(config_util.Config): """Basic Config class for Mojo.""" diff --git a/fetch_configs/nacl.py b/fetch_configs/nacl.py index 469be1860..bda48181e 100644 --- a/fetch_configs/nacl.py +++ b/fetch_configs/nacl.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class NaCl(config_util.Config): """Basic Config class for NaCl.""" diff --git a/fetch_configs/naclports.py b/fetch_configs/naclports.py index b38e5bffa..5035f5bbb 100644 --- a/fetch_configs/naclports.py +++ b/fetch_configs/naclports.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Naclports(config_util.Config): """Basic Config class for naclports.""" diff --git a/fetch_configs/pdfium.py b/fetch_configs/pdfium.py index a8400c182..2be624a1e 100644 --- a/fetch_configs/pdfium.py +++ b/fetch_configs/pdfium.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class PdfiumConfig(config_util.Config): """Basic Config class for pdfium.""" diff --git a/fetch_configs/skia.py b/fetch_configs/skia.py index 930173a0c..57d562fd8 100644 --- a/fetch_configs/skia.py +++ b/fetch_configs/skia.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Skia(config_util.Config): """Basic Config class for the Skia repository.""" diff --git a/fetch_configs/skia_buildbot.py b/fetch_configs/skia_buildbot.py index 0e7f2d043..009916ea7 100644 --- a/fetch_configs/skia_buildbot.py +++ b/fetch_configs/skia_buildbot.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class SkiaBuildbot(config_util.Config): """Basic Config class for the Skia Buildbot repository.""" diff --git a/fetch_configs/syzygy.py b/fetch_configs/syzygy.py index cb1ac6e37..5311c515f 100644 --- a/fetch_configs/syzygy.py +++ b/fetch_configs/syzygy.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class Syzygy(config_util.Config): """Basic Config class for Syzygy.""" diff --git a/fetch_configs/v8.py b/fetch_configs/v8.py index ce45a3bd3..7752f5026 100644 --- a/fetch_configs/v8.py +++ b/fetch_configs/v8.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class V8(config_util.Config): """Basic Config class for V8.""" diff --git a/fetch_configs/webrtc.py b/fetch_configs/webrtc.py index 8ef4d71a7..eb62892ad 100644 --- a/fetch_configs/webrtc.py +++ b/fetch_configs/webrtc.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class WebRTC(config_util.Config): """Basic Config class for WebRTC.""" diff --git a/fetch_configs/webrtc_android.py b/fetch_configs/webrtc_android.py index 5b53235d6..fd9038e85 100644 --- a/fetch_configs/webrtc_android.py +++ b/fetch_configs/webrtc_android.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class WebRTCAndroid(config_util.Config): """Basic Config alias for Android -> WebRTC.""" diff --git a/fetch_configs/webrtc_ios.py b/fetch_configs/webrtc_ios.py index f51fe22d0..7237a6269 100644 --- a/fetch_configs/webrtc_ios.py +++ b/fetch_configs/webrtc_ios.py @@ -4,11 +4,11 @@ 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 -# pylint: disable=W0232 +# pylint: disable=no-init class WebRTCIOS(config_util.Config): """Basic Config alias for iOS -> WebRTC.""" diff --git a/fix_encoding.py b/fix_encoding.py index a086af3d2..34f6cb8ee 100644 --- a/fix_encoding.py +++ b/fix_encoding.py @@ -40,7 +40,7 @@ def fix_default_encoding(): # Regenerate setdefaultencoding. reload(sys) # Module 'sys' has no 'setdefaultencoding' member - # pylint: disable=E1101 + # pylint: disable=no-member sys.setdefaultencoding('utf-8') for attr in dir(locale): if attr[0:3] != 'LC_': @@ -82,7 +82,7 @@ def fix_win_sys_argv(encoding): return False # 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.wintypes import LPCWSTR, LPWSTR @@ -189,10 +189,10 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase): # Loads the necessary function. # 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.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._byref = byref @@ -271,7 +271,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase): def win_handle_is_a_console(handle): """Returns True if a Windows file handle is a handle to a console.""" # 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.wintypes import BOOL, DWORD, HANDLE @@ -304,7 +304,7 @@ def win_get_unicode_stream(stream, excepted_fileno, output_handle, encoding): old_fileno = getattr(stream, 'fileno', lambda: None)() if old_fileno == excepted_fileno: # 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.wintypes import DWORD, HANDLE diff --git a/gclient.py b/gclient.py index 1fed7086c..c1d7bc755 100755 --- a/gclient.py +++ b/gclient.py @@ -746,7 +746,7 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): return bad_deps # Arguments number differs from overridden method - # pylint: disable=W0221 + # pylint: disable=arguments-differ def run(self, revision_overrides, command, args, work_queue, options): """Runs |command| then parse the DEPS file.""" logging.info('Dependency(%s).run()' % self.name) diff --git a/gclient_scm.py b/gclient_scm.py index e64754ce7..1050e28d0 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1162,7 +1162,7 @@ class GitWrapper(SCMWrapper): self._Fetch(options, prune=options.force) 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('stdout', self.out_fh) kwargs['filter_fn'] = self.filter diff --git a/gclient_utils.py b/gclient_utils.py index deea47efa..c21a3fdda 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -1169,9 +1169,9 @@ def NumLocalCpus(): try: import multiprocessing return multiprocessing.cpu_count() - except NotImplementedError: # pylint: disable=W0702 + except NotImplementedError: # pylint: disable=bare-except # (UNIX) Query 'os.sysconf'. - # pylint: disable=E1101 + # pylint: disable=no-member if hasattr(os, 'sysconf') and 'SC_NPROCESSORS_ONLN' in os.sysconf_names: return int(os.sysconf('SC_NPROCESSORS_ONLN')) diff --git a/git_cache.py b/git_cache.py index d4c35df40..bae45e71c 100755 --- a/git_cache.py +++ b/git_cache.py @@ -29,7 +29,7 @@ GC_AUTOPACKLIMIT = 50 GIT_CACHE_CORRUPT_MESSAGE = 'WARNING: The Git cache is corrupt.' try: - # pylint: disable=E0602 + # pylint: disable=undefined-variable WinErr = WindowsError except NameError: class WinErr(Exception): diff --git a/git_cherry_pick_upload.py b/git_cherry_pick_upload.py index 3090364c6..9d2281bbf 100755 --- a/git_cherry_pick_upload.py +++ b/git_cherry_pick_upload.py @@ -52,7 +52,7 @@ def cherry_pick(target_branch, commit, auth_config): ]) rietveld = Rietveld(config('rietveld.server'), auth_config, author) - # pylint: disable=W0212 + # pylint: disable=protected-access output = rietveld._send( '/upload', payload=payload, @@ -92,7 +92,7 @@ def cherry_pick(target_branch, commit, auth_config): ('data', filename, content), ]) - # pylint: disable=W0212 + # pylint: disable=protected-access print ' Uploading base file for %s:' % filename, rietveld._send( '/%s/upload_content/%s/%s' % (issue, patchset, file_id), payload=payload, @@ -115,14 +115,14 @@ def cherry_pick(target_branch, commit, auth_config): ('data', filename, content), ]) - # pylint: disable=W0212 + # pylint: disable=protected-access print ' Uploading %s:' % filename, rietveld._send( '/%s/upload_content/%s/%s' % (issue, patchset, file_id), payload=payload, content_type=content_type, ) - # pylint: disable=W0212 + # pylint: disable=protected-access print 'Finalizing upload:', rietveld._send('/%s/upload_complete/1' % issue) diff --git a/git_cl.py b/git_cl.py index 7d915927a..b6026eb06 100755 --- a/git_cl.py +++ b/git_cl.py @@ -34,7 +34,7 @@ import webbrowser import zlib try: - import readline # pylint: disable=F0401,W0611 + import readline # pylint: disable=import-error,W0611 except ImportError: pass @@ -3163,7 +3163,7 @@ class ChangeDescription(object): self._description_lines = (description or '').strip().splitlines() @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) def set_description(self, desc): @@ -3738,7 +3738,7 @@ def upload_branch_deps(cl, args): if CMDupload(OptionParser(), args) != 0: print('Upload failed for %s!' % dependent_branch) failures[dependent_branch] = 1 - except: # pylint: disable=W0702 + except: # pylint: disable=bare-except failures[dependent_branch] = 1 print() finally: @@ -4156,7 +4156,7 @@ def CMDlint(parser, args): auth_config = auth.extract_auth_config_from_options(options) # Access to a protected member _XX of a client class - # pylint: disable=W0212 + # pylint: disable=protected-access try: import cpplint import cpplint_chromium @@ -4726,7 +4726,7 @@ def SendUpstream(parser, args, cmd): revision = re.match( '.*?\nCommitted r(\\d+)', output, re.DOTALL).group(1) logging.debug(output) - except: # pylint: disable=W0702 + except: # pylint: disable=bare-except if _IS_BEING_TESTED: logging.exception('this is likely your ACTUAL cause of test failure.\n' + '-' * 30 + '8<' + '-' * 30) diff --git a/man/src/filter_demo_output.py b/man/src/filter_demo_output.py index 3b3afb8d0..92816db7c 100755 --- a/man/src/filter_demo_output.py +++ b/man/src/filter_demo_output.py @@ -20,8 +20,8 @@ if not os.path.exists('ansi2html'): # if it doesn't exist, run ./make_docs.sh first sys.path.insert(0, 'ansi2html') -import ansi2html # pylint: disable=F0401, W0611 -import ansi2html.converter # pylint: disable=F0401, W0611 +import ansi2html # pylint: disable=import-error, W0611 +import ansi2html.converter # pylint: disable=import-error, W0611 def simpleXML(string): BRIGHT = 1 diff --git a/my_activity.py b/my_activity.py index 92763d1d7..de862882b 100755 --- a/my_activity.py +++ b/my_activity.py @@ -46,14 +46,14 @@ import auth from third_party import httplib2 try: - from dateutil.relativedelta import relativedelta # pylint: disable=F0401 + from dateutil.relativedelta import relativedelta # pylint: disable=import-error except ImportError: print 'python-dateutil package required' exit(1) # python-keyring provides easy access to the system keyring. try: - import keyring # pylint: disable=W0611,F0401 + import keyring # pylint: disable=unused-import,F0401 except ImportError: print 'Consider installing python-keyring' @@ -665,7 +665,7 @@ def main(): # Remove description formatting parser.format_description = ( - lambda _: parser.description) # pylint: disable=E1101 + lambda _: parser.description) # pylint: disable=no-member options, args = parser.parse_args() options.local_user = os.environ.get('USER') diff --git a/my_reviews.py b/my_reviews.py index a26aa02a2..4f2359bd4 100755 --- a/my_reviews.py +++ b/my_reviews.py @@ -338,7 +338,7 @@ def main(): auth.add_auth_options(parser) # Remove description formatting parser.format_description = ( - lambda _: parser.description) # pylint: disable=E1101 + lambda _: parser.description) # pylint: disable=no-member options, args = parser.parse_args() auth_config = auth.extract_auth_config_from_options(options) if args: diff --git a/owners.py b/owners.py index b97405926..34662f0ed 100644 --- a/owners.py +++ b/owners.py @@ -71,7 +71,7 @@ BASIC_EMAIL_REGEXP = r'^[\w\-\+\%\.]+\@[\w\-\+\%\.]+$' def _assert_is_collection(obj): assert not isinstance(obj, basestring) # Module 'collections' has no 'Iterable' member - # pylint: disable=E1101 + # pylint: disable=no-member if hasattr(collections, 'Iterable') and hasattr(collections, 'Sized'): assert (isinstance(obj, collections.Iterable) and isinstance(obj, collections.Sized)) diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index df167e3a8..c38c013be 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -154,7 +154,7 @@ def CheckChangeLintsClean(input_api, output_api, source_file_filter=None, cpplint = input_api.cpplint # Access to a protected member _XX of a client class - # pylint: disable=W0212 + # pylint: disable=protected-access cpplint._cpplint_state.ResetErrorCounts() lint_filters = lint_filters or DEFAULT_LINT_FILTERS diff --git a/presubmit_support.py b/presubmit_support.py index 4161e7bb3..0d1d5550a 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -282,7 +282,7 @@ class InputApi(object): know stuff about the change they're looking at. """ # Method could be a function - # pylint: disable=R0201 + # pylint: disable=no-self-use # File extensions that are considered source files from a style guide # perspective. Don't modify this list from a presubmit script! @@ -401,7 +401,7 @@ class InputApi(object): # Replace and as headers that need to be included # with "base/containers/hash_tables.h" instead. # Access to a protected member _XX of a client class - # pylint: disable=W0212 + # pylint: disable=protected-access self.cpplint._re_pattern_templates = [ (a, b, 'base/containers/hash_tables.h') if header in ('', '') else (a, b, header) @@ -606,7 +606,7 @@ class AffectedFile(object): DIFF_CACHE = _DiffCache # Method could be a function - # pylint: disable=R0201 + # pylint: disable=no-self-use def __init__(self, path, action, repository_root, diff_cache): self._path = path self._action = action @@ -695,7 +695,7 @@ class AffectedFile(object): class GitAffectedFile(AffectedFile): """Representation of a file in a change out of a git checkout.""" # Method 'NNN' is abstract in class 'NNN' but is not overridden - # pylint: disable=W0223 + # pylint: disable=abstract-method DIFF_CACHE = _GitDiffCache diff --git a/pylintrc b/pylintrc index 77b006391..d34d8c218 100644 --- a/pylintrc +++ b/pylintrc @@ -33,64 +33,91 @@ load-plugins= # 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 # 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 -# R0901: Too many ancestors (8/7) -# R0902: Too many instance attributes (N/7) -# R0903: Too few public methods (N/2) -# R0904: Too many public methods (N/20) -# R0911: Too many return statements (N/6) -# R0912: Too many branches (N/12) -# R0913: Too many arguments (N/5) -# R0914: Too many local variables (N/15) -# R0915: Too many statements (N/50) -# R0921: Abstract class not referenced -# R0922: Abstract class is only referenced 1 times -# W0122: Use of the exec statement -# W0141: Used builtin function '' -# W0142: Used * or ** magic -# W0402: Uses of a deprecated module 'string' -# W0404: 41: Reimport 'XX' (imported line NN) -# W0511: TODO -# W0603: Using the global statement -# W0703: Catch "Exception" -# W1201: Specify string format arguments as logging function parameters +# These should get enabled, but the codebase has too many violations currently: +# 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 # -# These should get enabled, but the codebase has too many violations currently. -# 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 -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 +# CHANGED: +disable= + invalid-name, + missing-docstring, + too-many-lines, + bad-inline-option, + locally-disabled, + duplicate-code, + too-many-ancestors, + too-many-instance-attributes, + too-few-public-methods, + too-many-public-methods, + too-many-return-statements, + too-many-branches, + too-many-arguments, + too-many-locals, + too-many-statements, + abstract-class-not-used, + abstract-class-little-used, + exec-used, + bad-builtin, + star-args, + deprecated-module, + reimported, + fixme, + global-statement, + broad-except, + logging-not-lazy, + 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] diff --git a/rietveld.py b/rietveld.py index c9f939e2b..5ef935e35 100644 --- a/rietveld.py +++ b/rietveld.py @@ -604,7 +604,7 @@ class JwtOAuth2Rietveld(Rietveld): access is restricted to service accounts. """ # The parent__init__ is not called on purpose. - # pylint: disable=W0231 + # pylint: disable=super-init-not-called def __init__(self, url, client_email, @@ -718,7 +718,7 @@ class ReadOnlyRietveld(object): if not self._get_local_changes(issue).get('closed', False) and 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) ReadOnlyRietveld._local_changes.setdefault(issue, {})['closed'] = True @@ -736,18 +736,18 @@ class ReadOnlyRietveld(object): def get_patch(self, 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' % (issue, description)) - def add_comment(self, # pylint:disable=R0201 + def add_comment(self, # pylint:disable=no-self-use issue, message, add_as_reviewer=False): logging.info('ReadOnlyRietveld: posting comment "%s" to issue %d' % (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' % (flag, value, issue)) ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value @@ -756,13 +756,13 @@ class ReadOnlyRietveld(object): for flag, value in flags.iteritems(): 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, master=None, category='cq'): logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % (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, category='cq'): logging.info('ReadOnlyRietveld: triggering try jobs %r for issue %d' % diff --git a/subprocess2.py b/subprocess2.py index a00592f47..26f626968 100644 --- a/subprocess2.py +++ b/subprocess2.py @@ -58,7 +58,7 @@ def kill_pid(pid): """Kills a process by its process id.""" try: # Unable to import 'module' - # pylint: disable=E1101,F0401 + # pylint: disable=no-member,F0401 import signal return os.kill(pid, signal.SIGKILL) except ImportError: @@ -72,10 +72,10 @@ def kill_win(process): """ try: # Unable to import 'module' - # pylint: disable=F0401 + # pylint: disable=import-error import win32process # Access to a protected member _handle of a client class - # pylint: disable=W0212 + # pylint: disable=protected-access return win32process.TerminateProcess(process._handle, -1) except ImportError: pass @@ -261,7 +261,7 @@ class Popen(subprocess.Popen): 'Check that %s or %s exist and have execution permission.' % (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. It's the simplest and slowest implementation. Expect very slow behavior. @@ -391,7 +391,7 @@ class Popen(subprocess.Popen): if 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, nag_max=None): """Adds timeout and callbacks support. diff --git a/testing_support/gerrit_test_case.py b/testing_support/gerrit_test_case.py index 65c573b42..63a8dae7c 100644 --- a/testing_support/gerrit_test_case.py +++ b/testing_support/gerrit_test_case.py @@ -346,7 +346,7 @@ class GerritTestCase(unittest.TestCase): except OSError as e: if e.errno == errno.ECHILD: # If gerrit shut down cleanly, os.waitpid will land here. - # pylint: disable=W0150 + # pylint: disable=lost-exception return # If we get here, the gerrit process is still alive. Send the process @@ -357,7 +357,7 @@ class GerritTestCase(unittest.TestCase): if e.errno == errno.ESRCH: # os.kill raised an error because the process doesn't exist. Maybe # gerrit shut down cleanly after all. - # pylint: disable=W0150 + # pylint: disable=lost-exception return # Announce that gerrit didn't shut down cleanly. diff --git a/testing_support/git_test_utils.py b/testing_support/git_test_utils.py index 3fe2b1e2c..ae48dbe22 100644 --- a/testing_support/git_test_utils.py +++ b/testing_support/git_test_utils.py @@ -85,7 +85,7 @@ class OrderedSet(collections.MutableSet): prev[2] = nxt nxt[1] = prev - def pop(self, last=True): # pylint: disable=W0221 + def pop(self, last=True): # pylint: disable=arguments-differ if not self: raise KeyError('set is empty') key = self.end[1][0] if last else self.end[2][0] @@ -415,7 +415,7 @@ class GitRepo(object): stdout = sys.stdout stderr = sys.stderr 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: sys.stdout = out sys.stderr = err diff --git a/testing_support/super_mox.py b/testing_support/super_mox.py index cbb6df478..4b8cc6d68 100644 --- a/testing_support/super_mox.py +++ b/testing_support/super_mox.py @@ -69,7 +69,7 @@ class TestCaseUtils(object): 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]) print >> sys.stderr, diff - # pylint: disable=E1101 + # pylint: disable=no-member self.assertEqual(actual_members, expected_members) def setUp(self): @@ -92,7 +92,7 @@ class StdoutCheck(object): def tearDown(self): try: # If sys.stdout was used, self.checkstdout() must be called. - # pylint: disable=E1101 + # pylint: disable=no-member if not sys.stdout.closed: self.assertEquals('', sys.stdout.getvalue()) except AttributeError: @@ -102,7 +102,7 @@ class StdoutCheck(object): def checkstdout(self, expected): value = sys.stdout.getvalue() sys.stdout.close() - # pylint: disable=E1101 + # pylint: disable=no-member self.assertEquals(expected, value) diff --git a/tests/bot_update_coverage_test.py b/tests/bot_update_coverage_test.py index 07814542e..6d4a3ddae 100755 --- a/tests/bot_update_coverage_test.py +++ b/tests/bot_update_coverage_test.py @@ -10,7 +10,7 @@ import os import sys 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( os.path.dirname(os.path.dirname(os.path.abspath(__file__))), diff --git a/tests/checkout_test.py b/tests/checkout_test.py index bd6b9b712..7696b5e17 100755 --- a/tests/checkout_test.py +++ b/tests/checkout_test.py @@ -87,7 +87,7 @@ class FakeRepos(fake_repos.FakeReposBase): return fs -# pylint: disable=R0201 +# pylint: disable=no-self-use class BaseTest(fake_repos.FakeReposTestBase): name = 'foo' FAKE_REPOS_CLASS = FakeRepos @@ -188,7 +188,7 @@ class GitBaseTest(BaseTest): self.assertTrue(self.enabled) self.previous_log = self._log() - # pylint: disable=W0221 + # pylint: disable=arguments-differ def _log(self, log_from_local_repo=False): if log_from_local_repo: repo_root = os.path.join(self.root_dir, self.name) @@ -231,7 +231,7 @@ class GitBaseTest(BaseTest): patches.filenames) # Hackish to verify _branches() internal function. - # pylint: disable=W0212 + # pylint: disable=protected-access self.assertEquals( (['master', 'working_branch'], 'working_branch'), co._branches()) diff --git a/tests/download_from_google_storage_unittests.py b/tests/download_from_google_storage_unittests.py index 3334462d9..d2ed8a8e1 100755 --- a/tests/download_from_google_storage_unittests.py +++ b/tests/download_from_google_storage_unittests.py @@ -2,7 +2,7 @@ # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# pylint: disable=W0212 +# pylint: disable=protected-access """Unit tests for download_from_google_storage.py.""" diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 7acd59cb3..8c62491f4 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -42,14 +42,10 @@ def strip_timestamps(value): lines[i] = m.group(1) return ''.join(lines) -# Access to a protected member XXX of a client class -# pylint: disable=W0212 - class GCBaseTestCase(object): def assertRaisesError(self, msg, fn, *args, **kwargs): """Like unittest's assertRaises() but checks for Gclient.Error.""" - # pylint: disable=E1101 try: fn(*args, **kwargs) except gclient_scm.gclient_utils.Error, e: @@ -192,7 +188,7 @@ from :3 def checkstdout(self, expected): value = sys.stdout.getvalue() sys.stdout.close() - # pylint: disable=E1101 + # pylint: disable=no-member self.assertEquals(expected, strip_timestamps(value)) @staticmethod @@ -572,7 +568,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): def checkstdout(self, expected): value = sys.stdout.getvalue() sys.stdout.close() - # pylint: disable=E1101 + # pylint: disable=no-member self.assertEquals(expected, strip_timestamps(value)) def setUp(self): @@ -590,7 +586,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): BaseTestCase.tearDown(self) def testGetUsableRevGit(self): - # pylint: disable=E1101 + # pylint: disable=no-member options = self.Options(verbose=True) self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsValidRevision', True) @@ -631,7 +627,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') ).AndReturn(False) 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, options) self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) @@ -662,7 +658,7 @@ class ManagedGitWrapperTestCaseMox(BaseTestCase): gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') ).AndReturn(False) 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, options ).AndRaise(gclient_scm.subprocess2.CalledProcessError(None, None, None, @@ -693,13 +689,13 @@ class UnmanagedGitWrapperTestCase(BaseGitWrapperTestCase): def checkInStdout(self, expected): value = sys.stdout.getvalue() sys.stdout.close() - # pylint: disable=E1101 + # pylint: disable=no-member self.assertIn(expected, value) def checkNotInStdout(self, expected): value = sys.stdout.getvalue() sys.stdout.close() - # pylint: disable=E1101 + # pylint: disable=no-member self.assertNotIn(expected, value) def getCurrentBranch(self): diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py index dace58728..ffbe94c80 100755 --- a/tests/gclient_smoketest.py +++ b/tests/gclient_smoketest.py @@ -52,7 +52,6 @@ class GClientSmokeBase(fake_repos.FakeReposTestBase): (stdout, stderr) = process.communicate() logging.debug("XXX: %s\n%s\nXXX" % (' '.join(cmd), stdout)) logging.debug("YYY: %s\n%s\nYYY" % (' '.join(cmd), stderr)) - # pylint: disable=E1103 return (stdout.replace('\r\n', '\n'), stderr.replace('\r\n', '\n'), process.returncode) @@ -565,7 +564,7 @@ class GClientSmokeGITMutates(GClientSmokeBase): new_deps = cur_deps.replace('repo_2@%s\'' % repo_2_hash, 'repo_2@\' + Var(\'r2hash\')') 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, 'origin': 'git/repo_1@3\n', }) @@ -609,7 +608,7 @@ class GClientSmokeGITMutates(GClientSmokeBase): self.assertTree(tree) # 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', }) @@ -639,13 +638,13 @@ class GClientSmokeGITMutates(GClientSmokeBase): # 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'] 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', }) 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) 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, 'origin': 'git/repo_1@4\n', }) diff --git a/tests/gclient_test.py b/tests/gclient_test.py index cbdaac1ae..9b1b3a2f1 100755 --- a/tests/gclient_test.py +++ b/tests/gclient_test.py @@ -45,7 +45,7 @@ class SCMMock(object): def FullUrlForRelativeUrl(self, url): return self.url + url - # pylint: disable=R0201 + # pylint: disable=no-self-use def DoesRemoteURLMatch(self, _): return True @@ -247,7 +247,7 @@ class GclientTest(trial_dir.TestCase): ], []) # Make sure __str__() works fine. - # pylint: disable=W0212 + # pylint: disable=protected-access obj.dependencies[0]._file_list.append('foo') str_obj = str(obj) self.assertEquals(370, len(str_obj), '%d\n%s' % (len(str_obj), str_obj)) diff --git a/tests/gclient_utils_test.py b/tests/gclient_utils_test.py index 39a3d772d..4eccc7896 100755 --- a/tests/gclient_utils_test.py +++ b/tests/gclient_utils_test.py @@ -29,7 +29,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase): def __init__(self, test_string): self.stdout = StringIO.StringIO(test_string) self.pid = 9284 - # pylint: disable=R0201 + # pylint: disable=no-self-use def wait(self): return 0 @@ -39,7 +39,7 @@ class CheckCallAndFilterTestCase(GclientUtilBase): '\n________ running \'boo foo bar\' in \'bleh\'\n') for i in test_string: gclient_utils.sys.stdout.write(i) - # pylint: disable=E1101 + # pylint: disable=no-member subprocess2.Popen( args, cwd=cwd, diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 198afb12b..8e43e363c 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -115,7 +115,7 @@ class WatchlistsMock(object): class CodereviewSettingsFileMock(object): def __init__(self): pass - # pylint: disable=R0201 + # pylint: disable=no-self-use def read(self): return ("CODE_REVIEW_SERVER: gerrit.chromium.org\n" + "GERRIT_HOST: True\n") @@ -142,7 +142,7 @@ def CookiesAuthenticatorMockFactory(hosts_with_creds=None, same_cookie=False): CookiesAuthenticatorMockFactory(cookie='cookie')) """ 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. pass @classmethod diff --git a/tests/git_common_test.py b/tests/git_common_test.py index c33e9bed8..a8192ace7 100755 --- a/tests/git_common_test.py +++ b/tests/git_common_test.py @@ -741,7 +741,7 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, def testStatus(self): def inner(): 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) } self.repo.git('mv', 'file', 'cat') diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index a52d64307..a30822995 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -5,7 +5,7 @@ """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" -# pylint: disable=E1101,E1103 +# pylint: disable=no-member,E1103 import StringIO import functools @@ -32,7 +32,7 @@ presubmit_canned_checks = presubmit.presubmit_canned_checks # Access to a protected member XXX of a client class -# pylint: disable=W0212 +# pylint: disable=protected-access class PresubmitTestsBase(SuperMoxTestBase): @@ -1518,7 +1518,7 @@ class CannedChecksUnittest(PresubmitTestsBase): """Tests presubmit_canned_checks.py.""" def MockInputApi(self, change, committing): - # pylint: disable=R0201 + # pylint: disable=no-self-use input_api = self.mox.CreateMock(presubmit.InputApi) input_api.cStringIO = presubmit.cStringIO input_api.json = presubmit.json diff --git a/tests/rietveld_test.py b/tests/rietveld_test.py index 880d17e70..7eb8ececb 100755 --- a/tests/rietveld_test.py +++ b/tests/rietveld_test.py @@ -52,7 +52,7 @@ class BaseFixture(unittest.TestCase): def setUp(self): super(BaseFixture, self).setUp() # 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._send = self._rietveld_send self.requests = [] @@ -276,8 +276,7 @@ class RietveldTest(BaseFixture): is_new=True) def test_svn_properties(self): - # Line too long (N/80) - # pylint: disable=C0301 + # pylint: disable=line-too-long # To test one of these, run something like # import json, pprint, urllib diff --git a/tests/scm_unittest.py b/tests/scm_unittest.py index 49e9ee2f9..343446e7c 100755 --- a/tests/scm_unittest.py +++ b/tests/scm_unittest.py @@ -20,7 +20,7 @@ import subprocess2 # Access to a protected member XXX of a client class -# pylint: disable=W0212 +# pylint: disable=protected-access class BaseTestCase(SuperMoxTestBase): diff --git a/tests/subprocess2_test.py b/tests/subprocess2_test.py index 0160ad0a9..4aac67c37 100755 --- a/tests/subprocess2_test.py +++ b/tests/subprocess2_test.py @@ -13,7 +13,7 @@ import time import unittest try: - import fcntl # pylint: disable=F0401 + import fcntl # pylint: disable=import-error except ImportError: fcntl = None @@ -25,7 +25,7 @@ import subprocess2 from testing_support import auto_stub # 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 @@ -77,7 +77,7 @@ class DefaultsTest(auto_stub.TestCase): results.update(kwargs) results['args'] = args @staticmethod - # pylint: disable=W0622 + # pylint: disable=redefined-builtin def communicate(input=None, timeout=None, nag_max=None, nag_timer=None): return None, None self.mock(subprocess2, 'Popen', fake_Popen) @@ -132,7 +132,7 @@ class DefaultsTest(auto_stub.TestCase): results = self._fake_subprocess_Popen() proc = subprocess2.Popen(['foo'], a=True) # Cleanup code in subprocess.py needs this member to be set. - # pylint: disable=W0201 + # pylint: disable=attribute-defined-outside-init proc._child_created = None expected = { 'args': ['foo'], @@ -236,11 +236,11 @@ class RegressionTest(BaseTestCase): self.fail() except ValueError: pass - + if (sys.version_info[0] * 10 + sys.version_info[1]) >= 27: # python 2.7+ try: - # pylint: disable=E1101 + # pylint: disable=no-member subprocess.check_output(self.exe, stdout=subprocess.PIPE) self.fail() except ValueError: @@ -617,11 +617,11 @@ class S2Test(BaseTestCase): 'No output for 9 seconds from command:', proc.cmd_str] self.assertEquals(w, expected) - + def child_main(args): if sys.platform == 'win32': # Annoying, make sure the output is not translated on Windows. - # pylint: disable=E1101,F0401 + # pylint: disable=no-member,import-error import msvcrt msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY) diff --git a/tests/upload_to_google_storage_unittests.py b/tests/upload_to_google_storage_unittests.py index 9a13e6a64..3f37823e4 100755 --- a/tests/upload_to_google_storage_unittests.py +++ b/tests/upload_to_google_storage_unittests.py @@ -116,7 +116,7 @@ class UploadTests(unittest.TestCase): work_queue.put((None, None)) self.gsutil.add_expected(1, '', '') # For the first ls call. self.gsutil.add_expected(20, '', 'Expected error message') - # pylint: disable=W0212 + # pylint: disable=protected-access upload_to_google_storage._upload_worker( 0, work_queue, diff --git a/tests/watchlists_unittest.py b/tests/watchlists_unittest.py index eac4fd809..556589120 100755 --- a/tests/watchlists_unittest.py +++ b/tests/watchlists_unittest.py @@ -5,7 +5,7 @@ """Unit tests for watchlists.py.""" -# pylint: disable=E1103,E1120,W0212 +# pylint: disable=E1103,no-value-for-parameter,protected-access import os import sys