Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More sanity test updates for collections. #59841

Merged
merged 2 commits into from
Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
43 changes: 0 additions & 43 deletions test/sanity/code-smell/action-plugin-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,6 @@

def main():
"""Main entry point."""
skip = set([
'__init__', # action plugin base class, not an actual action plugin
'net_base', # base class for other net_* action plugins which have a matching module
'normal', # default action plugin for modules without a dedicated action plugin
'network', # base class for network action plugins

# The following action plugins existed without modules to document them before this test was put in place.
# They should either be removed, have a module added to document them, or have the exception documented here.
'bigip',
'bigiq',
'ce_template',

# The following action plugins provide base classes for network platform specific modules to support `connection: local`.
# Once we fully deprecate the use of connection local, the base classes will go away.
'aireos',
'aruba',
'asa',
'ce',
'cnos',
'dellos10',
'dellos6',
'dellos9',
'enos',
'eos',
'ios',
'iosxr',
'ironware',
'junos',
'netconf',
'nxos',
'sros',
'vyos',
])

paths = sys.argv[1:] or sys.stdin.read().splitlines()

module_names = set()
Expand All @@ -59,24 +25,15 @@ def main():

module_names.add(name)

unused_skip = set(skip)

for path in paths:
if not path.startswith('lib/ansible/plugins/action/'):
continue

name = os.path.splitext(os.path.basename(path))[0]

if name not in module_names:
if name in skip:
unused_skip.remove(name)
continue

print('%s: action plugin has no matching module to provide documentation' % path)

for filename in sorted(unused_skip):
print("%s: remove '%s' from skip list since it does not exist" % ('test/sanity/code-smell/action-plugin-docs.py', filename))


if __name__ == '__main__':
main()
5 changes: 4 additions & 1 deletion test/sanity/code-smell/package-data.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"disabled": true,
"no_targets": true,
"all_targets": true,
"prefixes": [
"lib/ansible/"
],
"output": "path-message"
}
21 changes: 10 additions & 11 deletions test/sanity/code-smell/package-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,28 @@
import fnmatch
import os
import re
import sys
import tempfile
import subprocess


def main():
ignore_files = frozenset((
'*/.git_keep',
'*/galaxy/data/default/*/.git_keep',
'*/galaxy/data/default/role/*/main.yml.j2',
'*/galaxy/data/default/role/*/test.yml.j2',
'*/galaxy/data/default/collection/plugins/README.md.j2',
))

non_py_files = []
for root, _dummy, files in os.walk('lib/ansible/'):
for filename in files:
path = os.path.join(root, filename)
if os.path.splitext(path)[1] not in ('.py', '.pyc', '.pyo'):
add = True
for ignore in ignore_files:
if fnmatch.fnmatch(path, ignore):
add = False
if add:
non_py_files.append(os.path.relpath(path, 'lib/ansible'))
for path in sys.argv[1:] or sys.stdin.read().splitlines():
if os.path.splitext(path)[1] != '.py':
add = True
for ignore in ignore_files:
if fnmatch.fnmatch(path, ignore):
add = False
if add:
non_py_files.append(os.path.relpath(path, 'lib/ansible'))

with tempfile.TemporaryDirectory() as tmp_dir:
stdout, _dummy = subprocess.Popen(
Expand Down
25 changes: 25 additions & 0 deletions test/sanity/ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6889,6 +6889,31 @@ lib/ansible/parsing/vault/__init__.py pylint:blacklisted-name
lib/ansible/playbook/base.py pylint:blacklisted-name
lib/ansible/playbook/helpers.py pylint:blacklisted-name
lib/ansible/playbook/role/__init__.py pylint:blacklisted-name
lib/ansible/plugins/action/__init__.py action-plugin-docs # action plugin base class, not an actual action plugin
lib/ansible/plugins/action/aireos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/aruba.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/asa.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/bigip.py action-plugin-docs # undocumented action plugin to fix, existed before sanity test was added
lib/ansible/plugins/action/bigiq.py action-plugin-docs # undocumented action plugin to fix, existed before sanity test was added
lib/ansible/plugins/action/ce.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/ce_template.py action-plugin-docs # undocumented action plugin to fix, existed before sanity test was added
lib/ansible/plugins/action/cnos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/dellos10.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/dellos6.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/dellos9.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/enos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/eos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/ios.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/ironware.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/net_base.py action-plugin-docs # base class for other net_* action plugins which have a matching module
lib/ansible/plugins/action/netconf.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/network.py action-plugin-docs # base class for network action plugins
lib/ansible/plugins/action/normal.py action-plugin-docs # default action plugin for modules without a dedicated action plugin
lib/ansible/plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/sros.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/action/vyos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
lib/ansible/plugins/cache/base.py ansible-doc # not a plugin, but a stub for backwards compatibility
lib/ansible/plugins/callback/hipchat.py pylint:blacklisted-name
lib/ansible/plugins/connection/lxc.py pylint:blacklisted-name
Expand Down