Merge pull request #31825 from jtand/udpate_pylintrc

Updated .testing.pylintrc to match newer versions of pylint
This commit is contained in:
Mike Place 2016-03-15 12:12:44 -06:00
commit 440e0dcbe0
13 changed files with 40 additions and 20 deletions

View File

@ -48,11 +48,21 @@ disable=R,
I0011,
I0012,
I0013,
E0302,
E0401,
E1101,
E1103,
E1136,
E8114,
C0102,
C0103,
C0111,
C0112,
C0122,
C0123,
C0411,
C0412,
C0413,
C0203,
C0204,
C0301,
@ -98,11 +108,19 @@ disable=R,
# I0011 (locally-disabling)
# I0012 (locally-enabling)
# I0013 (file-ignored)
# E0302 (unexpected-special-method-signature)
# E0401 (import-error)
# E1101 (no-member) [pylint isn't smart enough]
# E1103 (maybe-no-member)
# E1136 (unsubscriptable-object)
# E8114 (indentation-is-not-a-multiple-of-four-comment)
# C0102 (blacklisted-name) [because it activates C0103 too]
# C0103 (invalid-name)
# C0111 (missing-docstring)
# C0113 (unneeded-not)
# C0122 (misplaced-comparison-constant)
# C0123 (unidiomatic-typecheck)
# C0412 (ungrouped-imports)
# C0203 (bad-mcs-method-argument)
# C0204 (bad-mcs-classmethod-argument)
# C0301 (line-too-long)
@ -138,6 +156,7 @@ disable=R,
[REPORTS]
# Tells whether to display a full report or only the messages
# This will be removed in pylint 1.6
reports=no
# Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -70,9 +70,9 @@ def beacon(config):
__context__[LOC_KEY] = fp_.tell()
pack = struct.unpack(FMT, raw)
event = {}
for ind in range(len(FIELDS)):
event[FIELDS[ind]] = pack[ind]
if isinstance(event[FIELDS[ind]], str):
event[FIELDS[ind]] = event[FIELDS[ind]].strip('\x00')
for ind, field in enumerate(FIELDS):
event[field] = pack[ind]
if isinstance(event[field], str):
event[field] = event[field].strip('\x00')
ret.append(event)
return ret

View File

@ -78,12 +78,12 @@ def beacon(config):
'tag': pid}
if 'execve' in line:
comps = line.split('execve')[1].split('"')
for ind in range(len(comps)):
for ind, field in enumerate(comps):
if ind == 1:
event['cmd'] = comps[ind]
event['cmd'] = field
continue
if ind % 2 != 0:
event['args'].append(comps[ind])
event['args'].append(field)
event['user'] = __context__[pkey][pid]['user']
ret.append(event)
if not __context__[pkey][pid]['vt'].isalive():

View File

@ -70,9 +70,9 @@ def beacon(config):
__context__[LOC_KEY] = fp_.tell()
pack = struct.unpack(FMT, raw)
event = {}
for ind in range(len(FIELDS)):
event[FIELDS[ind]] = pack[ind]
if isinstance(event[FIELDS[ind]], str):
event[FIELDS[ind]] = event[FIELDS[ind]].strip('\x00')
for ind, field in enumerate(FIELDS):
event[field] = pack[ind]
if isinstance(event[field], str):
event[field] = event[field].strip('\x00')
ret.append(event)
return ret

View File

@ -750,7 +750,7 @@ class Single(object):
fsclient=self.fsclient,
minion_opts=self.minion_opts,
**self.target)
opts_pkg = pre_wrapper['test.opts_pkg']()
opts_pkg = pre_wrapper['test.opts_pkg']() # pylint: disable=E1102
opts_pkg['file_roots'] = self.opts['file_roots']
opts_pkg['pillar_roots'] = self.opts['pillar_roots']
opts_pkg['ext_pillar'] = self.opts['ext_pillar']

View File

@ -136,7 +136,7 @@ def main(argv): # pylint: disable=W0613
# Salt thin now is available to use
else:
scpstat = subprocess.Popen(['/bin/sh', '-c', 'command -v scp']).wait()
if not scpstat == 0:
if scpstat != 0:
sys.exit(EX_SCP_NOT_FOUND)
if not os.path.exists(OPTIONS.saltdir):

View File

@ -204,7 +204,7 @@ def query_instance(vm_=None, call=None):
if isinstance(data, dict) and 'error' in data:
log.warn(
'There was an error in the query. {0}'.format(data['error'])
'There was an error in the query. {0}'.format(data.get('error'))
)
# Trigger a failure in the wait for IP function
return False

View File

@ -947,7 +947,7 @@ def _format_instance_info_select(vm, selection):
if 'files' in selection:
file_full_info = {}
if "layoutEx.file" in file:
if "layoutEx.file" in file: # pylint: disable=E1135
for file in vm["layoutEx.file"]:
file_full_info[file.key] = {
'key': file.key,

View File

@ -292,7 +292,7 @@ def __process_tokens_internal(tokens, start_at=0):
log.debug(" TYPE: ASSIGNMENT")
is_assignment = True
else:
raise CommandExecutionError('Unknown token!', 'Token:'+token)
raise CommandExecutionError('Unknown token! Token: {0}'.format(token))
token_no = token_no + 1

View File

@ -2754,7 +2754,7 @@ def update_lxc_conf(name, lxc_conf, lxc_conf_unset):
({line[0]: line[1:]}, {key: item}))
break
if not matched:
if not (key, item) in lines:
if (key, item) not in lines:
lines.append((key, item))
changes['added'].append({key: item})
dest_lxc_conf = []

View File

@ -37,6 +37,7 @@ from distutils.version import StrictVersion # pylint: disable=no-name-in-module
try:
import boto.ec2
import boto.utils
import boto.exception
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
@ -123,7 +124,7 @@ def ext_pillar(minion_id,
try:
conn = boto.ec2.connect_to_region(region)
except boto.exception as e:
except boto.exception as e: # pylint: disable=E0712
log.error("%s: invalid AWS credentials.", __name__)
return None

View File

@ -178,7 +178,7 @@ def datasource_exists(name, jboss_config, datasource_properties, recreate=False)
ret['result'] = False
ret['comment'] = 'Could not create datasource. Stdout: '+create_result['stdout']
else:
raise CommandExecutionError('Unable to handle error', ds_result['failure-description'])
raise CommandExecutionError('Unable to handle error: {0}'.format(ds_result['failure-description']))
if ret['result']:
log.debug("ds_new_properties=%s", str(ds_new_properties))

View File

@ -1562,7 +1562,7 @@ def rm_rf(path):
os.chmod(path, stat.S_IWUSR)
func(path)
else:
raise
raise # pylint: disable=E0704
shutil.rmtree(path, onerror=_onerror)