Fix issues reported by the latest pylint.

pull/47036/head
Matt Clay 6 years ago
parent db304c27c7
commit 4db054364a

@ -117,7 +117,7 @@ class AnsibleCoreCI(object):
region = 'us-east-1' region = 'us-east-1'
self.path = "%s-%s" % (self.path, region) self.path = "%s-%s" % (self.path, region)
self.endpoints = AWS_ENDPOINTS[region], self.endpoints = (AWS_ENDPOINTS[region],)
self.ssh_key = SshKey(args) self.ssh_key = SshKey(args)
if self.platform == 'windows': if self.platform == 'windows':
@ -192,7 +192,7 @@ class AnsibleCoreCI(object):
if self.started: if self.started:
display.info('Skipping started %s/%s instance %s.' % (self.platform, self.version, self.instance_id), display.info('Skipping started %s/%s instance %s.' % (self.platform, self.version, self.instance_id),
verbosity=1) verbosity=1)
return return None
if is_shippable(): if is_shippable():
return self.start_shippable() return self.start_shippable()

@ -117,7 +117,7 @@ def delegate_tox(args, exclude, require, integration_targets):
:type integration_targets: tuple[IntegrationTarget] :type integration_targets: tuple[IntegrationTarget]
""" """
if args.python: if args.python:
versions = args.python_version, versions = (args.python_version,)
if args.python_version not in SUPPORTED_PYTHON_VERSIONS: if args.python_version not in SUPPORTED_PYTHON_VERSIONS:
raise ApplicationError('tox does not support Python version %s' % args.python_version) raise ApplicationError('tox does not support Python version %s' % args.python_version)

@ -99,7 +99,7 @@ class PylintTest(SanitySingleVersion):
invalid_ignores.append((line, 'Invalid version: %s' % version)) invalid_ignores.append((line, 'Invalid version: %s' % version))
continue continue
if version != args.python_version and version != args.python_version.split('.')[0]: if version not in (args.python_version, args.python_version.split('.')[0]):
continue # ignore version specific entries for other versions continue # ignore version specific entries for other versions
ignore[path][code] = line ignore[path][code] = line
@ -121,12 +121,26 @@ class PylintTest(SanitySingleVersion):
contexts[context_name] = sorted(filtered_paths) contexts[context_name] = sorted(filtered_paths)
available_paths -= filtered_paths available_paths -= filtered_paths
add_context(remaining_paths, 'ansible-test', lambda p: p.startswith('test/runner/')) def filter_path(path_filter=None):
add_context(remaining_paths, 'units', lambda p: p.startswith('test/units/')) """
add_context(remaining_paths, 'test', lambda p: p.startswith('test/')) :type path_filter: str
add_context(remaining_paths, 'hacking', lambda p: p.startswith('hacking/')) :rtype: (str) -> bool
add_context(remaining_paths, 'modules', lambda p: p.startswith('lib/ansible/modules/')) """
add_context(remaining_paths, 'module_utils', lambda p: p.startswith('lib/ansible/module_utils/')) def context_filter(path_to_filter):
"""
:type path_to_filter: str
:rtype: bool
"""
return path_to_filter.startswith(path_filter)
return context_filter
add_context(remaining_paths, 'ansible-test', filter_path('test/runner/'))
add_context(remaining_paths, 'units', filter_path('test/units/'))
add_context(remaining_paths, 'test', filter_path('test/'))
add_context(remaining_paths, 'hacking', filter_path('hacking/'))
add_context(remaining_paths, 'modules', filter_path('lib/ansible/modules/'))
add_context(remaining_paths, 'module_utils', filter_path('lib/ansible/module_utils/'))
add_context(remaining_paths, 'ansible', lambda p: True) add_context(remaining_paths, 'ansible', lambda p: True)
messages = [] messages = []

@ -448,7 +448,7 @@ class TestTarget(CompletionTarget):
if module_path and path.startswith(module_path) and name != '__init__' and ext in MODULE_EXTENSIONS: if module_path and path.startswith(module_path) and name != '__init__' and ext in MODULE_EXTENSIONS:
self.module = name[len(module_prefix or ''):].lstrip('_') self.module = name[len(module_prefix or ''):].lstrip('_')
self.modules = self.module, self.modules = (self.module,)
else: else:
self.module = None self.module = None
self.modules = tuple() self.modules = tuple()

Loading…
Cancel
Save