Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable pylint rules and fix exposed bugs. #47219

Merged
merged 4 commits into from Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/compat/ipaddress.py
Expand Up @@ -346,7 +346,7 @@ def _find_address_range(addresses):

"""
it = iter(addresses)
first = last = next(it)
first = last = next(it) # pylint: disable=stop-iteration-return
for ip in it:
if ip._ip != last._ip + 1:
yield first, last
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/module_utils/pycompat24.py
Expand Up @@ -81,7 +81,7 @@ def _convert(node):
if node.name in _safe_names:
return _safe_names[node.name]
elif isinstance(node, ast.UnarySub):
return -_convert(node.expr)
return -_convert(node.expr) # pylint: disable=invalid-unary-operand-type
raise ValueError('malformed string')
return _convert(node_or_string)

Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/clustering/consul_kv.py
Expand Up @@ -233,7 +233,7 @@ def set_value(module):
value = module.params.get('value')

if value is NOT_SET:
raise AssertionError('Cannot set value of "%s" to `NOT_SET`', (key, ))
raise AssertionError('Cannot set value of "%s" to `NOT_SET`' % key)

index, changed = _has_value_changed(consul_api, key, value)

Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/cnos/cnos_backup.py
Expand Up @@ -213,7 +213,7 @@ def doConfigBackUp(module, prompt, answer):
elif(protocol == "tftp"):
command = "copy " + configType + " " + protocol + " " + protocol
command = command + "://" + server + "/" + confPath
command = command + + " vrf management\n"
command = command + " vrf management\n"
# cnos.debugOutput(command)
tftp_cmd = [{'command': command, 'prompt': None, 'answer': None}]
cmd.extend(tftp_cmd)
Expand Down
2 changes: 1 addition & 1 deletion lib/ansible/modules/network/cnos/cnos_image.py
Expand Up @@ -175,7 +175,7 @@ def doImageDownload(module, prompt, answer):
elif(protocol == "tftp"):
command = "copy " + protocol + " " + protocol + "://" + server
command = command + "/" + imgPath + " system-image " + imgType
command = command + + " vrf management"
command = command + " vrf management"
prompt = ['Confirm download operation',
'Do you want to change that to the standby image']
answer = ['y', 'y']
Expand Down
1 change: 0 additions & 1 deletion lib/ansible/modules/packaging/os/apt_repository.py
Expand Up @@ -184,7 +184,6 @@ def __iter__(self):
for n, valid, enabled, source, comment in sources:
if valid:
yield file, n, enabled, source, comment
raise StopIteration

def _expand_path(self, filename):
if '/' in filename:
Expand Down
5 changes: 4 additions & 1 deletion lib/ansible/modules/storage/netapp/netapp_e_storagepool.py
Expand Up @@ -145,7 +145,10 @@ def next(self):
def _grouper(self, tgtkey):
while self.currkey == tgtkey:
yield self.currvalue
self.currvalue = next(self.it) # Exit on StopIteration
try:
self.currvalue = next(self.it) # Exit on StopIteration
except StopIteration:
return
self.currkey = self.keyfunc(self.currvalue)


Expand Down
3 changes: 0 additions & 3 deletions test/sanity/pylint/config/default
Expand Up @@ -46,7 +46,6 @@ disable=
invalid-envvar-default,
invalid-name,
invalid-sequence-index,
invalid-unary-operand-type,
keyword-arg-before-vararg,
len-as-condition,
line-too-long,
Expand All @@ -71,7 +70,6 @@ disable=
pointless-string-statement,
possibly-unused-variable,
protected-access,
raising-format-tuple,
redefined-argument-from-local,
redefined-builtin,
redefined-outer-name,
Expand All @@ -80,7 +78,6 @@ disable=
relative-import,
signature-differs,
simplifiable-if-statement,
stop-iteration-return,
subprocess-popen-preexec-fn,
super-init-not-called,
superfluous-parens,
Expand Down