diff --git a/test/runner/lib/sanity/pylint.py b/test/runner/lib/sanity/pylint.py index d687049e9ea..a1399e20768 100644 --- a/test/runner/lib/sanity/pylint.py +++ b/test/runner/lib/sanity/pylint.py @@ -2,6 +2,7 @@ from __future__ import absolute_import, print_function import collections +import itertools import json import os import datetime @@ -112,6 +113,13 @@ class PylintTest(SanitySingleVersion): module_paths = [p.split(os.path.sep) for p in paths if p.startswith('lib/ansible/modules/')] module_dirs = sorted(set([p[3] for p in module_paths if len(p) > 4])) + large_module_group_threshold = 500 + large_module_groups = [key for key, value in + itertools.groupby(module_paths, lambda p: p[3] if len(p) > 4 else '') if len(list(value)) > large_module_group_threshold] + + large_module_group_paths = [p.split(os.path.sep) for p in paths if any(p.startswith('lib/ansible/modules/%s/' % g) for g in large_module_groups)] + large_module_group_dirs = sorted(set([os.path.sep.join(p[3:5]) for p in large_module_group_paths if len(p) > 5])) + contexts = [] remaining_paths = set(paths) @@ -144,6 +152,9 @@ class PylintTest(SanitySingleVersion): add_context(remaining_paths, 'test', filter_path('test/')) add_context(remaining_paths, 'hacking', filter_path('hacking/')) + for large_module_group_dir in large_module_group_dirs: + add_context(remaining_paths, 'modules/%s' % large_module_group_dir, filter_path('lib/ansible/modules/%s/' % large_module_group_dir)) + for module_dir in module_dirs: add_context(remaining_paths, 'modules/%s' % module_dir, filter_path('lib/ansible/modules/%s/' % module_dir)) diff --git a/test/runner/requirements/constraints.txt b/test/runner/requirements/constraints.txt index 47f56e02976..5c01db4efb8 100644 --- a/test/runner/requirements/constraints.txt +++ b/test/runner/requirements/constraints.txt @@ -30,13 +30,13 @@ xmltodict < 0.12.0 ; python_version < '2.7' # xmltodict 0.12.0 and later require lxml < 4.3.0 ; python_version < '2.7' # lxml 4.3.0 and later require python 2.7 or later pyvmomi < 6.0.0 ; python_version < '2.7' # pyvmomi 6.0.0 and later require python 2.7 or later pyone == 1.1.9 # newer versions do not pass current integration tests +botocore >= 1.10.0 # adds support for the following AWS services: secretsmanager, fms, and acm-pca # freeze pylint and its requirements for consistent test results -astroid == 2.0.4 -isort == 4.3.4 +astroid == 2.2.5 +isort == 4.3.15 lazy-object-proxy == 1.3.1 mccabe == 0.6.1 -pylint == 2.1.1 -typed-ast == 1.1.0 -wrapt == 1.10.11 -botocore >= 1.10.0 # adds support for the following AWS services: secretsmanager, fms, and acm-pca +pylint == 2.3.1 +typed-ast == 1.3.1 +wrapt == 1.11.1 diff --git a/test/sanity/pylint/config/ansible-test b/test/sanity/pylint/config/ansible-test index 85f95061ea7..dc67921c4dd 100644 --- a/test/sanity/pylint/config/ansible-test +++ b/test/sanity/pylint/config/ansible-test @@ -10,6 +10,7 @@ disable= too-many-nested-blocks, too-many-return-statements, too-many-statements, + unnecessary-pass, unused-import, useless-object-inheritance, consider-using-dict-comprehension, diff --git a/test/sanity/pylint/config/default b/test/sanity/pylint/config/default index c1ac8e791cf..bb338e766a9 100644 --- a/test/sanity/pylint/config/default +++ b/test/sanity/pylint/config/default @@ -49,6 +49,7 @@ disable= method-hidden, misplaced-comparison-constant, missing-docstring, + no-else-raise, no-else-return, no-init, no-member, @@ -71,6 +72,7 @@ disable= reimported, relative-import, signature-differs, + simplifiable-if-expression, simplifiable-if-statement, subprocess-popen-preexec-fn, super-init-not-called, @@ -96,6 +98,7 @@ disable= unexpected-keyword-arg, ungrouped-imports, unidiomatic-typecheck, + unnecessary-pass, unsubscriptable-object, unsupported-assignment-operation, unsupported-delete-operation, diff --git a/test/sanity/pylint/ignore.txt b/test/sanity/pylint/ignore.txt index c2be33bbf41..a52d6a25570 100644 --- a/test/sanity/pylint/ignore.txt +++ b/test/sanity/pylint/ignore.txt @@ -1 +1,2 @@ +lib/ansible/module_utils/network/edgeswitch/edgeswitch_interface.py duplicate-string-formatting-argument test/units/modules/system/test_known_hosts.py ansible-bad-function