Reduce the number of pylint warnings in gcl.py to make refactoring simpler.

Doing static analysis on the script greatly easy refactoring since it reduces
the chances of leaving a typo in rarely executed & untested & untested code.

This is in preparation to refactor changelist on-disk format to use json.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/4184008

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@64427 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
maruel@chromium.org 15 years ago
parent 463042941a
commit 3a17425279

@ -20,9 +20,7 @@ import time
from third_party import upload
import urllib2
__pychecker__ = 'unusednames=breakpad'
import breakpad
__pychecker__ = ''
# gcl now depends on gclient.
from scm import SVN
@ -669,6 +667,7 @@ def defer_attributes(a, b):
def need_change(function):
"""Converts args -> change_info."""
# pylint: disable=W0612,W0621
def hook(args):
if not len(args) == 1:
ErrorExit("You need to pass a change list name")
@ -682,6 +681,7 @@ def need_change(function):
def need_change_and_args(function):
"""Converts args -> change_info."""
# pylint: disable=W0612,W0621
def hook(args):
if not args:
ErrorExit("You need to pass a change list name")
@ -694,6 +694,7 @@ def need_change_and_args(function):
def no_args(function):
"""Make sure no args are passed."""
# pylint: disable=W0612,W0621
def hook(args):
if args:
ErrorExit("Doesn't support arguments")
@ -1041,8 +1042,8 @@ def CMDchange(args):
filename = line[7:]
new_cl_files.append((status, filename))
if (not len(change_info._files)) and (not change_info.issue) and \
(not len(new_description) and (not new_cl_files)):
if (not len(change_info.GetFiles()) and not change_info.issue and
not len(new_description) and not new_cl_files):
ErrorExit("Empty changelist not saved")
change_info._files = new_cl_files
@ -1143,7 +1144,7 @@ def CMDdeleteempties():
print "\n--- Deleting:"
for cl in GetCLs():
change_info = ChangeInfo.Load(cl, GetRepositoryRoot(), True, True)
if not len(change_info._files):
if not len(change_info.GetFiles()):
print change_info.name
change_info.Delete()
return 0
@ -1264,13 +1265,13 @@ def GenUsage(command):
more = getattr(obj, 'usage', '')
if command == 'help':
display = '<command>'
need_change = ''
need_change_val = ''
if getattr(obj, 'need_change', None):
need_change = ' <change_list>'
need_change_val = ' <change_list>'
options = ' [options]'
if getattr(obj, 'no_args', None):
options = ''
res = 'Usage: gcl %s%s%s %s\n\n' % (display, need_change, options, more)
res = 'Usage: gcl %s%s%s %s\n\n' % (display, need_change_val, options, more)
res += re.sub('\n ', '\n', obj.__doc__)
return res

@ -35,6 +35,7 @@ load-plugins=
# C0103: Invalid name ""
# C0111: Missing docstring
# C0302: Too many lines in module (N)
# I0011: Locally disabling WNNNN
# R0901: Too many ancestors (8/7)
# R0902: Too many instance attributes (N/7)
# R0903: Too few public methods (N/2)
@ -48,7 +49,7 @@ load-plugins=
# W0603: Using the global statement
# W0613: Unused argument ''
# W6501: Specify string format arguments as logging function parameters
disable=C0103,C0111,C0302,R0901,R0902,R0903,R0911,R0912,R0913,R0914,R0915,W0122,W0141,W0603,W0613,W6501
disable=C0103,C0111,C0302,I0011,R0901,R0902,R0903,R0911,R0912,R0913,R0914,R0915,W0122,W0141,W0603,W0613,W6501
[REPORTS]

Loading…
Cancel
Save