From 5a6e05affb00f91adca5d963716f214088c65968 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Tue, 22 Feb 2022 17:02:56 -0800 Subject: [PATCH] More strict pylint checking of ansible-test code. --- .../sanity/pylint/config/ansible-test-target.cfg | 8 +++++--- .../controller/sanity/pylint/config/ansible-test.cfg | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg b/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg index f9db195b4c6..7390e041cf4 100644 --- a/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg +++ b/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test-target.cfg @@ -3,14 +3,11 @@ disable= cyclic-import, # consistent results require running with --jobs 1 and testing all files duplicate-code, # consistent results require running with --jobs 1 and testing all files - import-error, # inconsistent results which depend on the availability of imports import-outside-toplevel, # common pattern in ansible related code - no-name-in-module, # inconsistent results which depend on the availability of imports no-self-use, raise-missing-from, # Python 2.x does not support raise from super-with-arguments, # Python 2.x does not support super without arguments too-few-public-methods, - too-many-ancestors, # inconsistent results between python 3.6 and 3.7+ too-many-arguments, too-many-branches, too-many-instance-attributes, @@ -50,3 +47,8 @@ function-rgx=[a-z_][a-z0-9_]{1,40}$ preferred-modules = distutils.version:ansible.module_utils.compat.version, + +# These modules are used by ansible-test, but will not be present in the virtual environment running pylint. +# Listing them here makes it possible to enable the import-error check. +ignored-modules = + py, diff --git a/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg b/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg index 3c60aa77fe9..76200eb87f7 100644 --- a/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg +++ b/test/lib/ansible_test/_util/controller/sanity/pylint/config/ansible-test.cfg @@ -3,9 +3,7 @@ disable= cyclic-import, # consistent results require running with --jobs 1 and testing all files duplicate-code, # consistent results require running with --jobs 1 and testing all files - import-error, # inconsistent results which depend on the availability of imports import-outside-toplevel, # common pattern in ansible related code - no-name-in-module, # inconsistent results which depend on the availability of imports no-self-use, raise-missing-from, # Python 2.x does not support raise from too-few-public-methods, @@ -48,3 +46,10 @@ function-rgx=[a-z_][a-z0-9_]{1,40}$ preferred-modules = distutils.version:ansible.module_utils.compat.version, + +# These modules are used by ansible-test, but will not be present in the virtual environment running pylint. +# Listing them here makes it possible to enable the import-error check. +ignored-modules = + cryptography, + coverage, + yamllint,