summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2013-02-13 09:05:03 +0100
committerMartin Kosek <mkosek@redhat.com>2013-02-13 09:31:24 +0100
commitf3809627efa2eaf1c4e8dabb04dd6cbeb568c1d0 (patch)
tree0f6de847889e8661a36a69115110a30ec1c89430
parenta6541122699629b2e1cea44595d4f39d8bbf35c7 (diff)
downloadfreeipa.git-f3809627efa2eaf1c4e8dabb04dd6cbeb568c1d0.tar.gz
freeipa.git-f3809627efa2eaf1c4e8dabb04dd6cbeb568c1d0.tar.xz
freeipa.git-f3809627efa2eaf1c4e8dabb04dd6cbeb568c1d0.zip
Pylint cleanup
Add more dynamic attribute info to IPATypeChecker in make-lint. Remove unnecessary pylint comments. Fix false positivies introduced by Pylint 0.26. https://fedorahosted.org/freeipa/ticket/3379
-rwxr-xr-xipa-client/ipa-install/ipa-client-install1
-rw-r--r--ipalib/frontend.py20
-rw-r--r--ipalib/krb_utils.py6
-rw-r--r--ipalib/parameters.py5
-rw-r--r--ipalib/plugins/dns.py4
-rw-r--r--ipaserver/install/plugins/updateclient.py2
-rwxr-xr-xmake-lint67
7 files changed, 60 insertions, 45 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install
index 0f79961b..150bbd26 100755
--- a/ipa-client/ipa-install/ipa-client-install
+++ b/ipa-client/ipa-install/ipa-client-install
@@ -1139,7 +1139,6 @@ def get_ca_cert_from_file(url):
Raises errors.FileError if unable to write cert.
'''
- # pylint: disable=E1101
try:
parsed = urlparse.urlparse(url, 'file')
except Exception, e:
diff --git a/ipalib/frontend.py b/ipalib/frontend.py
index f6659634..ded0478a 100644
--- a/ipalib/frontend.py
+++ b/ipalib/frontend.py
@@ -478,10 +478,10 @@ class Command(HasParam):
>>> list(c._repr_iter(login=u'Okay.', passwd=u'Private!'))
["u'Okay.'", "passwd=u'********'"]
"""
- for arg in self.args(): #pylint: disable=E1102
+ for arg in self.args():
value = params.get(arg.name, None)
yield repr(arg.safe_value(value))
- for option in self.options(): #pylint: disable=E1102
+ for option in self.options():
if option.name not in params:
continue
value = params[option.name]
@@ -506,7 +506,7 @@ class Command(HasParam):
def __args_2_params(self, values):
multivalue = False
- for (i, arg) in enumerate(self.args()): #pylint: disable=E1102
+ for (i, arg) in enumerate(self.args()):
assert not multivalue
if len(values) > i:
if arg.multivalue:
@@ -786,7 +786,7 @@ class Command(HasParam):
else:
self.max_args = None
self._create_param_namespace('options')
- params_nosort = tuple(self.args()) + tuple(self.options()) #pylint: disable=E1102
+ params_nosort = tuple(self.args()) + tuple(self.options())
def get_key(p):
if p.required:
if p.sortorder < 0:
@@ -962,7 +962,7 @@ class Command(HasParam):
rv = 0
- order = [p.name for p in self.output_params()] #pylint: disable=E1102
+ order = [p.name for p in self.output_params()]
if options.get('all', False):
order.insert(0, 'dn')
print_all = True
@@ -972,8 +972,8 @@ class Command(HasParam):
if options.get('raw', False):
labels = None
else:
- labels = dict((p.name, unicode(p.label)) for p in self.output_params()) #pylint: disable=E1102
- flags = dict((p.name, p.flags) for p in self.output_params()) #pylint: disable=E1102
+ labels = dict((p.name, unicode(p.label)) for p in self.output_params())
+ flags = dict((p.name, p.flags) for p in self.output_params())
for o in self.output:
outp = self.output[o]
@@ -1092,7 +1092,7 @@ class Object(HasParam):
self.__get_attrs('Property'), sort=False, name_attr='attr_name'
)
self._create_param_namespace('params')
- pkeys = filter(lambda p: p.primary_key, self.params()) #pylint: disable=E1102
+ pkeys = filter(lambda p: p.primary_key, self.params())
if len(pkeys) > 1:
raise ValueError(
'%s (Object) has multiple primary keys: %s' % (
@@ -1103,7 +1103,7 @@ class Object(HasParam):
if len(pkeys) == 1:
self.primary_key = pkeys[0]
self.params_minus_pk = NameSpace(
- filter(lambda p: not p.primary_key, self.params()), sort=False #pylint: disable=E1102
+ filter(lambda p: not p.primary_key, self.params()), sort=False
)
else:
self.primary_key = None
@@ -1121,7 +1121,7 @@ class Object(HasParam):
if len(names) == 1 and not isinstance(names[0], (Param, str)):
names = names[0]
minus = frozenset(names)
- for param in self.params(): #pylint: disable=E1102
+ for param in self.params():
if param.name in minus or param in minus:
continue
yield param
diff --git a/ipalib/krb_utils.py b/ipalib/krb_utils.py
index b0010e9e..9a557ce5 100644
--- a/ipalib/krb_utils.py
+++ b/ipalib/krb_utils.py
@@ -231,7 +231,7 @@ class KRB5_CCache(object):
error_code = e.args[0]
if error_code == KRB5_CC_NOTFOUND:
raise KeyError('"%s" credential not found in "%s" ccache' % \
- (krbV_principal.name, self.ccache_str())) #pylint: disable=E1103
+ (krbV_principal.name, self.ccache_str()))
raise e
except Exception, e:
raise e
@@ -282,7 +282,7 @@ class KRB5_CCache(object):
authtime, starttime, endtime, renew_till = cred[3]
self.debug('get_credential_times: principal=%s, authtime=%s, starttime=%s, endtime=%s, renew_till=%s',
- krbV_principal.name, #pylint: disable=E1103
+ krbV_principal.name,
krb5_format_time(authtime), krb5_format_time(starttime),
krb5_format_time(endtime), krb5_format_time(renew_till))
@@ -291,7 +291,7 @@ class KRB5_CCache(object):
except KeyError, e:
raise e
except Exception, e:
- self.error('get_credential_times failed, principal="%s" error="%s"', krbV_principal.name, e) #pylint: disable=E1103
+ self.error('get_credential_times failed, principal="%s" error="%s"', krbV_principal.name, e)
raise e
def credential_is_valid(self, principal):
diff --git a/ipalib/parameters.py b/ipalib/parameters.py
index 35dbdd95..9d21756c 100644
--- a/ipalib/parameters.py
+++ b/ipalib/parameters.py
@@ -1122,8 +1122,7 @@ class Int(Number):
)
def __init__(self, name, *rules, **kw):
- #pylint: disable=E1003
- super(Number, self).__init__(name, *rules, **kw)
+ super(Int, self).__init__(name, *rules, **kw)
if (self.minvalue > self.maxvalue) and (self.minvalue is not None and self.maxvalue is not None):
raise ValueError(
@@ -1478,7 +1477,7 @@ class Str(Data):
Do not allow leading/trailing spaces.
"""
assert type(value) is unicode
- if self.noextrawhitespace is False: #pylint: disable=E1101
+ if self.noextrawhitespace is False:
return
if len(value) != len(value.strip()):
return _('Leading and trailing spaces are not allowed')
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index b0e65ab9..a41c6d07 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -596,7 +596,7 @@ class DNSRecord(Str):
return super(DNSRecord, self)._convert_scalar(value, index)
def normalize(self, value):
- if self.normalizedns: #pylint: disable=E1101
+ if self.normalizedns:
if isinstance(value, (tuple, list)):
value = tuple(
self._normalize_parts(v) for v in value \
@@ -633,7 +633,7 @@ class DNSRecord(Str):
return value
def _rule_validatedns(self, _, value):
- if not self.validatedns: #pylint: disable=E1101
+ if not self.validatedns:
return
if value is None:
diff --git a/ipaserver/install/plugins/updateclient.py b/ipaserver/install/plugins/updateclient.py
index 8f463fa6..4a1fe625 100644
--- a/ipaserver/install/plugins/updateclient.py
+++ b/ipaserver/install/plugins/updateclient.py
@@ -162,7 +162,7 @@ class updateclient(backend.Executioner):
"""
Execute the update plugin.
"""
- return self.Updater[method](**kw) #pylint: disable=E1101
+ return self.Updater[method](**kw)
def restart(self, dm_password, live_run):
if os.getegid() != 0:
diff --git a/make-lint b/make-lint
index 7ecd59d7..f513785c 100755
--- a/make-lint
+++ b/make-lint
@@ -37,44 +37,61 @@ except ImportError:
# File names to ignore when searching for python source files
IGNORE_FILES = ('.*', '*~', '*.in', '*.pyc', '*.pyo')
-IGNORE_PATHS = ('build', 'rpmbuild', 'dist', 'install/po/test_i18n.py', 'lite-server.py',
- 'make-lint', 'make-test', 'tests')
+IGNORE_PATHS = ('build', 'rpmbuild', 'dist', 'install/po/test_i18n.py',
+ 'lite-server.py', 'make-lint', 'make-test', 'tests')
class IPATypeChecker(TypeChecker):
- # 'class': ('generated', 'properties',)
+ NAMESPACE_ATTRS = ['Command', 'Object', 'Method', 'Property', 'Backend',
+ 'Updater']
+ LOGGING_ATTRS = ['log', 'debug', 'info', 'warning', 'error', 'exception',
+ 'critical']
+
+ # 'class': ['generated', 'properties']
ignore = {
- 'ipalib.base.NameSpace': ['find'],
+ # Python standard library & 3rd party classes
+ 'krbV.Principal': ['name'],
+ 'socket._socketobject': ['sendall'],
+ # should be 'subprocess.Popen'
+ '.Popen': ['stdin', 'stdout', 'stderr', 'pid', 'returncode', 'poll',
+ 'wait', 'communicate'],
+ 'urlparse.ResultMixin': ['scheme', 'netloc', 'path', 'query',
+ 'fragment', 'username', 'password', 'hostname', 'port'],
+ 'urlparse.ParseResult': ['params'],
+
+ # IPA classes
+ 'ipapython.admintool.AdminTool': LOGGING_ATTRS,
+ 'ipalib.base.NameSpace': ['add', 'mod', 'del', 'show', 'find'],
'ipalib.cli.Collector': ['__options'],
'ipalib.config.Env': ['*'],
- 'ipalib.plugable.API': ['Command', 'Object', 'Method', 'Property',
- 'Backend', 'log', 'plugins'],
- 'ipalib.plugable.Plugin': ['Command', 'Object', 'Method', 'Property',
- 'Backend', 'env', 'debug', 'info', 'warning', 'error', 'critical',
- 'exception', 'context', 'log'],
'ipalib.plugins.baseldap.CallbackInterface': ['pre_callback',
'post_callback', 'exc_callback'],
- 'ipalib.plugins.misc.env': ['env'],
+ 'ipalib.krb_utils.KRB5_CCache': LOGGING_ATTRS,
'ipalib.parameters.Param': ['cli_name', 'cli_short_name', 'label',
- 'doc', 'required', 'multivalue', 'primary_key', 'normalizer',
- 'default', 'default_from', 'autofill', 'query', 'attribute',
+ 'default', 'doc', 'required', 'multivalue', 'primary_key',
+ 'normalizer', 'default_from', 'autofill', 'query', 'attribute',
'include', 'exclude', 'flags', 'hint', 'alwaysask', 'sortorder',
- 'csv', 'csv_separator', 'csv_skipspace'],
+ 'csv', 'csv_separator', 'csv_skipspace', 'option_group'],
'ipalib.parameters.Bool': ['truths', 'falsehoods'],
- 'ipalib.parameters.Int': ['minvalue', 'maxvalue'],
- 'ipalib.parameters.Decimal': ['minvalue', 'maxvalue', 'precision'],
'ipalib.parameters.Data': ['minlength', 'maxlength', 'length',
'pattern', 'pattern_errmsg'],
- 'ipalib.parameters.Enum': ['values'],
+ 'ipalib.parameters.Str': ['noextrawhitespace'],
+ 'ipalib.parameters.Password': ['confirm'],
'ipalib.parameters.File': ['stdin_if_missing'],
- 'urlparse.SplitResult': ['netloc'],
- 'ipaserver.rpcserver.KerberosSession' : ['api', 'log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipaserver.rpcserver.HTTP_Status' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipalib.krb_utils.KRB5_CCache' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipalib.session.AuthManager' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipalib.session.SessionAuthManager' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipalib.session.SessionManager' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipalib.session.SessionCCache' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
- 'ipalib.session.MemcacheSessionManager' : ['log', 'debug', 'info', 'warning', 'error', 'critical', 'exception'],
+ 'ipalib.plugins.dns.DNSRecord': ['validatedns', 'normalizedns'],
+ 'ipalib.parameters.Enum': ['values'],
+ 'ipalib.parameters.Number': ['minvalue', 'maxvalue'],
+ 'ipalib.parameters.Decimal': ['precision', 'exponential',
+ 'numberclass'],
+ 'ipalib.plugable.API': NAMESPACE_ATTRS + LOGGING_ATTRS,
+ 'ipalib.plugable.Plugin': ['api', 'env'] + NAMESPACE_ATTRS +
+ LOGGING_ATTRS,
+ 'ipalib.session.AuthManager': LOGGING_ATTRS,
+ 'ipalib.session.SessionAuthManager': LOGGING_ATTRS,
+ 'ipalib.session.SessionManager': LOGGING_ATTRS,
+ 'ipaserver.install.ldapupdate.LDAPUpdate': LOGGING_ATTRS,
+ 'ipaserver.plugins.ldap2.IPASimpleLDAPObject': LOGGING_ATTRS,
+ 'ipaserver.plugins.ldap2.SchemaCache': LOGGING_ATTRS,
+ 'ipaserver.rpcserver.KerberosSession': ['api'] + LOGGING_ATTRS,
}
def _related_classes(self, klass):