Sanity checks: test for print statement (#65219)

* Add test for print() call in module_utils and modules.

* Add changelog fragment.

* Add ignore.txt entries.

* Use blacklist plugin instead of adding a new.

* Update ignore.txt
This commit is contained in:
Felix Fontein 2019-12-05 20:31:31 +01:00 committed by Jordan Borean
parent e1be5a8acb
commit a0f26b40cb
3 changed files with 16 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- "ansible-test - add check for ``print()`` calls in modules and module_utils."

View file

@ -129,6 +129,13 @@ class AnsibleBlacklistChecker(BaseChecker):
'/lib/ansible/module_utils/common/removed.py',
),
modules_only=True),
'builtins.print': BlacklistEntry('module.log or module.debug',
ignore_paths=(
'/lib/ansible/module_utils/basic.py',
'/lib/ansible/module_utils/common/removed.py',
),
modules_only=True),
}
def visit_import(self, node):

View file

@ -196,6 +196,7 @@ lib/ansible/module_utils/facts/__init__.py empty-init # breaks namespacing, depr
lib/ansible/module_utils/facts/network/linux.py pylint:blacklisted-name
lib/ansible/module_utils/facts/sysctl.py future-import-boilerplate
lib/ansible/module_utils/facts/sysctl.py metaclass-boilerplate
lib/ansible/module_utils/facts/system/distribution.py pylint:ansible-bad-function
lib/ansible/module_utils/facts/utils.py future-import-boilerplate
lib/ansible/module_utils/facts/utils.py metaclass-boilerplate
lib/ansible/module_utils/firewalld.py future-import-boilerplate
@ -1320,6 +1321,7 @@ lib/ansible/modules/cloud/packet/packet_sshkey.py validate-modules:doc-missing-t
lib/ansible/modules/cloud/packet/packet_sshkey.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/cloud/packet/packet_sshkey.py validate-modules:undocumented-parameter
lib/ansible/modules/cloud/packet/packet_volume_attachment.py validate-modules:doc-required-mismatch
lib/ansible/modules/cloud/packet/packet_volume_attachment.py pylint:ansible-bad-function
lib/ansible/modules/cloud/podman/podman_image.py validate-modules:doc-type-does-not-match-spec
lib/ansible/modules/cloud/podman/podman_image.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/cloud/podman/podman_image.py validate-modules:undocumented-parameter
@ -1798,6 +1800,7 @@ lib/ansible/modules/files/copy.py validate-modules:doc-default-does-not-match-sp
lib/ansible/modules/files/copy.py validate-modules:nonexistent-parameter-documented
lib/ansible/modules/files/copy.py validate-modules:undocumented-parameter
lib/ansible/modules/files/file.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/files/file.py pylint:ansible-bad-function
lib/ansible/modules/files/file.py validate-modules:undocumented-parameter
lib/ansible/modules/files/find.py use-argspec-type-path # fix needed
lib/ansible/modules/files/find.py validate-modules:parameter-type-not-in-doc
@ -2199,6 +2202,7 @@ lib/ansible/modules/network/aci/mso_schema.py validate-modules:doc-required-mism
lib/ansible/modules/network/aci/mso_schema_site.py validate-modules:doc-required-mismatch
lib/ansible/modules/network/aci/mso_schema_site_anp_epg.py validate-modules:doc-required-mismatch
lib/ansible/modules/network/aci/mso_schema_site_anp_epg_domain.py validate-modules:doc-required-mismatch
lib/ansible/modules/network/aci/mso_schema_site_anp_epg_domain.py pylint:ansible-bad-function
lib/ansible/modules/network/aci/mso_schema_site_anp_epg_staticleaf.py validate-modules:doc-required-mismatch
lib/ansible/modules/network/aci/mso_schema_site_anp_epg_staticport.py validate-modules:doc-required-mismatch
lib/ansible/modules/network/aci/mso_schema_site_anp_epg_subnet.py validate-modules:doc-required-mismatch
@ -3993,6 +3997,7 @@ lib/ansible/modules/network/meraki/meraki_mr_l3_firewall.py validate-modules:doc
lib/ansible/modules/network/meraki/meraki_mx_l3_firewall.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/network/meraki/meraki_mx_l7_firewall.py validate-modules:nonexistent-parameter-documented
lib/ansible/modules/network/meraki/meraki_mx_l7_firewall.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/network/meraki/meraki_mx_l7_firewall.py pylint:ansible-bad-function
lib/ansible/modules/network/meraki/meraki_nat.py validate-modules:doc-type-does-not-match-spec
lib/ansible/modules/network/meraki/meraki_nat.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/network/meraki/meraki_network.py validate-modules:parameter-type-not-in-doc
@ -4038,6 +4043,7 @@ lib/ansible/modules/network/netscaler/netscaler_lb_vserver.py validate-modules:p
lib/ansible/modules/network/netscaler/netscaler_nitro_request.py validate-modules:doc-missing-type
lib/ansible/modules/network/netscaler/netscaler_nitro_request.py validate-modules:doc-required-mismatch
lib/ansible/modules/network/netscaler/netscaler_nitro_request.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/network/netscaler/netscaler_nitro_request.py pylint:ansible-bad-function
lib/ansible/modules/network/netscaler/netscaler_save_config.py validate-modules:doc-missing-type
lib/ansible/modules/network/netscaler/netscaler_save_config.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/network/netscaler/netscaler_server.py validate-modules:doc-default-does-not-match-spec
@ -5742,6 +5748,7 @@ lib/ansible/modules/utilities/logic/async_status.py use-argspec-type-path
lib/ansible/modules/utilities/logic/async_status.py validate-modules!skip
lib/ansible/modules/utilities/logic/async_wrapper.py ansible-doc!skip # not an actual module
lib/ansible/modules/utilities/logic/async_wrapper.py use-argspec-type-path
lib/ansible/modules/utilities/logic/async_wrapper.py pylint:ansible-bad-function
lib/ansible/modules/web_infrastructure/_nginx_status_facts.py validate-modules:doc-missing-type
lib/ansible/modules/web_infrastructure/_nginx_status_facts.py validate-modules:parameter-type-not-in-doc
lib/ansible/modules/web_infrastructure/ansible_tower/tower_credential.py validate-modules:doc-choices-do-not-match-spec