Initial project commit
This commit is contained in:
@ -0,0 +1,11 @@
|
||||
{
|
||||
"include_symlinks": false,
|
||||
"prefixes": [
|
||||
".azure-pipelines/azure-pipelines.yml",
|
||||
"tests/integration/targets/"
|
||||
],
|
||||
"output": "path-message",
|
||||
"requirements": [
|
||||
"PyYAML"
|
||||
]
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check extra collection docs with antsibull-docs."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
||||
paths = [path for path in paths if path.endswith('/aliases')]
|
||||
|
||||
with open('.azure-pipelines/azure-pipelines.yml', 'rb') as f:
|
||||
azp = yaml.safe_load(f)
|
||||
|
||||
allowed_targets = set(['azp/generic/1'])
|
||||
for stage in azp['stages']:
|
||||
if stage['stage'].startswith(('Sanity', 'Unit', 'Generic', 'Summary')):
|
||||
continue
|
||||
for job in stage['jobs']:
|
||||
for group in job['parameters']['groups']:
|
||||
allowed_targets.add('azp/posix/{0}'.format(group))
|
||||
|
||||
for path in paths:
|
||||
targets = []
|
||||
skip = False
|
||||
with open(path, 'r') as f:
|
||||
for line in f:
|
||||
if '#' in line:
|
||||
line = line[:line.find('#')]
|
||||
line = line.strip()
|
||||
if line.startswith('needs/'):
|
||||
continue
|
||||
if line.startswith('skip/'):
|
||||
continue
|
||||
if line.startswith('cloud/'):
|
||||
continue
|
||||
if line.startswith('context/'):
|
||||
continue
|
||||
if line in ('unsupported', 'disabled', 'hidden'):
|
||||
skip = True
|
||||
if line in ('destructive', ):
|
||||
continue
|
||||
if '/' not in line:
|
||||
continue
|
||||
targets.append(line)
|
||||
if skip:
|
||||
continue
|
||||
if not targets:
|
||||
if 'targets/setup_' in path:
|
||||
continue
|
||||
print('%s: %s' % (path, 'found no targets'))
|
||||
for target in targets:
|
||||
if target not in allowed_targets:
|
||||
print('%s: %s' % (path, 'found invalid target "{0}"'.format(target)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"include_symlinks": false,
|
||||
"output": "path-line-column-message",
|
||||
"requirements": [
|
||||
"PyYAML",
|
||||
"voluptuous==0.12.1"
|
||||
]
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
238
collections/ansible_collections/community/general/tests/sanity/extra/botmeta.py
Executable file
238
collections/ansible_collections/community/general/tests/sanity/extra/botmeta.py
Executable file
@ -0,0 +1,238 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check BOTMETA file."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import ast
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
from voluptuous import Any, MultipleInvalid, PREVENT_EXTRA, Schema
|
||||
from voluptuous.humanize import humanize_error
|
||||
|
||||
|
||||
IGNORE_NO_MAINTAINERS = [
|
||||
'docs/docsite/rst/filter_guide.rst',
|
||||
'docs/docsite/rst/filter_guide_abstract_informations.rst',
|
||||
'docs/docsite/rst/filter_guide_paths.rst',
|
||||
'docs/docsite/rst/filter_guide_selecting_json_data.rst',
|
||||
'plugins/cache/memcached.py',
|
||||
'plugins/cache/redis.py',
|
||||
'plugins/callback/cgroup_memory_recap.py',
|
||||
'plugins/callback/context_demo.py',
|
||||
'plugins/callback/counter_enabled.py',
|
||||
'plugins/callback/hipchat.py',
|
||||
'plugins/callback/jabber.py',
|
||||
'plugins/callback/log_plays.py',
|
||||
'plugins/callback/logdna.py',
|
||||
'plugins/callback/logentries.py',
|
||||
'plugins/callback/null.py',
|
||||
'plugins/callback/selective.py',
|
||||
'plugins/callback/slack.py',
|
||||
'plugins/callback/splunk.py',
|
||||
'plugins/callback/yaml.py',
|
||||
'plugins/inventory/nmap.py',
|
||||
'plugins/inventory/virtualbox.py',
|
||||
'plugins/connection/chroot.py',
|
||||
'plugins/connection/iocage.py',
|
||||
'plugins/connection/lxc.py',
|
||||
'plugins/lookup/cartesian.py',
|
||||
'plugins/lookup/chef_databag.py',
|
||||
'plugins/lookup/consul_kv.py',
|
||||
'plugins/lookup/credstash.py',
|
||||
'plugins/lookup/cyberarkpassword.py',
|
||||
'plugins/lookup/flattened.py',
|
||||
'plugins/lookup/keyring.py',
|
||||
'plugins/lookup/lastpass.py',
|
||||
'plugins/lookup/passwordstore.py',
|
||||
'plugins/lookup/shelvefile.py',
|
||||
'plugins/filter/json_query.py',
|
||||
'plugins/filter/random_mac.py',
|
||||
]
|
||||
|
||||
FILENAME = '.github/BOTMETA.yml'
|
||||
|
||||
LIST_ENTRIES = frozenset(('supershipit', 'maintainers', 'labels', 'keywords', 'notify', 'ignore'))
|
||||
|
||||
AUTHOR_REGEX = re.compile(r'^\w.*\(@([\w-]+)\)(?![\w.])')
|
||||
|
||||
|
||||
def read_authors(filename):
|
||||
data = {}
|
||||
try:
|
||||
with open(filename, 'rb') as b_module_data:
|
||||
M = ast.parse(b_module_data.read())
|
||||
|
||||
for child in M.body:
|
||||
if isinstance(child, ast.Assign):
|
||||
for t in child.targets:
|
||||
try:
|
||||
theid = t.id
|
||||
except AttributeError:
|
||||
# skip errors can happen when trying to use the normal code
|
||||
continue
|
||||
|
||||
if theid == 'DOCUMENTATION':
|
||||
if isinstance(child.value, ast.Dict):
|
||||
data = ast.literal_eval(child.value)
|
||||
else:
|
||||
data = yaml.safe_load(child.value.s)
|
||||
|
||||
except Exception as e:
|
||||
print('%s:%d:%d: Cannot load DOCUMENTATION: %s' % (filename, 0, 0, e))
|
||||
return []
|
||||
|
||||
author = data.get('author') or []
|
||||
if isinstance(author, str):
|
||||
author = [author]
|
||||
return author
|
||||
|
||||
|
||||
def extract_author_name(author):
|
||||
m = AUTHOR_REGEX.match(author)
|
||||
if m:
|
||||
return m.group(1)
|
||||
if author == 'Ansible Core Team':
|
||||
return '$team_ansible_core'
|
||||
return None
|
||||
|
||||
|
||||
def validate(filename, filedata):
|
||||
if not filename.startswith('plugins/'):
|
||||
return
|
||||
if filename.startswith(('plugins/doc_fragments/', 'plugins/module_utils/')):
|
||||
return
|
||||
# Compile lis tof all active and inactive maintainers
|
||||
all_maintainers = filedata['maintainers'] + filedata['ignore']
|
||||
if not filename.startswith('plugins/filter/'):
|
||||
maintainers = read_authors(filename)
|
||||
for maintainer in maintainers:
|
||||
maintainer = extract_author_name(maintainer)
|
||||
if maintainer is not None and maintainer not in all_maintainers:
|
||||
msg = 'Author %s not mentioned as active or inactive maintainer for %s (mentioned are: %s)' % (
|
||||
maintainer, filename, ', '.join(all_maintainers))
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, msg))
|
||||
should_have_no_maintainer = filename in IGNORE_NO_MAINTAINERS
|
||||
if not all_maintainers and not should_have_no_maintainer:
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, 'No (active or inactive) maintainer mentioned for %s' % filename))
|
||||
if all_maintainers and should_have_no_maintainer:
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, 'Please remove %s from the ignore list of %s' % (filename, sys.argv[0])))
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
try:
|
||||
with open(FILENAME, 'rb') as f:
|
||||
botmeta = yaml.safe_load(f)
|
||||
except yaml.error.MarkedYAMLError as ex:
|
||||
print('%s:%d:%d: YAML load failed: %s' % (FILENAME, ex.context_mark.line +
|
||||
1, ex.context_mark.column + 1, re.sub(r'\s+', ' ', str(ex))))
|
||||
return
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
print('%s:%d:%d: YAML load failed: %s' %
|
||||
(FILENAME, 0, 0, re.sub(r'\s+', ' ', str(ex))))
|
||||
return
|
||||
|
||||
# Validate schema
|
||||
|
||||
MacroSchema = Schema({
|
||||
(str): Any(str, None),
|
||||
}, extra=PREVENT_EXTRA)
|
||||
|
||||
FilesSchema = Schema({
|
||||
(str): {
|
||||
('supershipit'): str,
|
||||
('support'): Any('community'),
|
||||
('maintainers'): str,
|
||||
('labels'): str,
|
||||
('keywords'): str,
|
||||
('notify'): str,
|
||||
('ignore'): str,
|
||||
},
|
||||
}, extra=PREVENT_EXTRA)
|
||||
|
||||
schema = Schema({
|
||||
('notifications'): bool,
|
||||
('automerge'): bool,
|
||||
('macros'): MacroSchema,
|
||||
('files'): FilesSchema,
|
||||
}, extra=PREVENT_EXTRA)
|
||||
|
||||
try:
|
||||
schema(botmeta)
|
||||
except MultipleInvalid as ex:
|
||||
for error in ex.errors:
|
||||
# No way to get line/column numbers
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, humanize_error(botmeta, error)))
|
||||
return
|
||||
|
||||
# Preprocess (substitute macros, convert to lists)
|
||||
macros = botmeta.get('macros') or {}
|
||||
macro_re = re.compile(r'\$([a-zA-Z_]+)')
|
||||
|
||||
def convert_macros(text, macros):
|
||||
def f(m):
|
||||
macro = m.group(1)
|
||||
replacement = (macros[macro] or '')
|
||||
if macro == 'team_ansible_core':
|
||||
return '$team_ansible_core %s' % replacement
|
||||
return replacement
|
||||
|
||||
return macro_re.sub(f, text)
|
||||
|
||||
files = {}
|
||||
try:
|
||||
for file, filedata in (botmeta.get('files') or {}).items():
|
||||
file = convert_macros(file, macros)
|
||||
filedata = dict((k, convert_macros(v, macros)) for k, v in filedata.items())
|
||||
files[file] = filedata
|
||||
for k, v in filedata.items():
|
||||
if k in LIST_ENTRIES:
|
||||
filedata[k] = v.split()
|
||||
except KeyError as e:
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, 'Found unknown macro %s' % e))
|
||||
return
|
||||
|
||||
# Scan all files
|
||||
unmatched = set(files)
|
||||
for dirs in ('docs/docsite/rst', 'plugins', 'tests', 'changelogs'):
|
||||
for dirpath, dirnames, filenames in os.walk(dirs):
|
||||
for file in sorted(filenames):
|
||||
if file.endswith('.pyc'):
|
||||
continue
|
||||
filename = os.path.join(dirpath, file)
|
||||
if os.path.islink(filename):
|
||||
continue
|
||||
if os.path.isfile(filename):
|
||||
matching_files = []
|
||||
for file, filedata in files.items():
|
||||
if filename.startswith(file):
|
||||
matching_files.append((file, filedata))
|
||||
if file in unmatched:
|
||||
unmatched.remove(file)
|
||||
if not matching_files:
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, 'Did not find any entry for %s' % filename))
|
||||
|
||||
matching_files.sort(key=lambda kv: kv[0])
|
||||
filedata = dict()
|
||||
for k in LIST_ENTRIES:
|
||||
filedata[k] = []
|
||||
for dummy, data in matching_files:
|
||||
for k, v in data.items():
|
||||
if k in LIST_ENTRIES:
|
||||
v = filedata[k] + v
|
||||
filedata[k] = v
|
||||
validate(filename, filedata)
|
||||
|
||||
for file in unmatched:
|
||||
print('%s:%d:%d: %s' % (FILENAME, 0, 0, 'Entry %s was not used' % file))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"include_symlinks": false,
|
||||
"prefixes": [
|
||||
"docs/docsite/",
|
||||
"plugins/",
|
||||
"roles/"
|
||||
],
|
||||
"output": "path-line-column-message",
|
||||
"requirements": [
|
||||
"ansible-core",
|
||||
"antsibull-docs"
|
||||
]
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Check extra collection docs with antsibull-docs."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
env = os.environ.copy()
|
||||
suffix = ':{env}'.format(env=env["ANSIBLE_COLLECTIONS_PATH"]) if 'ANSIBLE_COLLECTIONS_PATH' in env else ''
|
||||
env['ANSIBLE_COLLECTIONS_PATH'] = '{root}{suffix}'.format(root=os.path.dirname(os.path.dirname(os.path.dirname(os.getcwd()))), suffix=suffix)
|
||||
p = subprocess.run(
|
||||
['antsibull-docs', 'lint-collection-docs', '--plugin-docs', '--skip-rstcheck', '.'],
|
||||
env=env,
|
||||
check=False,
|
||||
)
|
||||
if p.returncode not in (0, 3):
|
||||
print('{0}:0:0: unexpected return code {1}'.format(sys.argv[0], p.returncode))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"include_symlinks": false,
|
||||
"output": "path-message"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
110
collections/ansible_collections/community/general/tests/sanity/extra/licenses.py
Executable file
110
collections/ansible_collections/community/general/tests/sanity/extra/licenses.py
Executable file
@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2022, Felix Fontein <felix@fontein.de>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Prevent files without a correct license identifier from being added to the source tree."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
|
||||
|
||||
def format_license_list(licenses):
|
||||
if not licenses:
|
||||
return '(empty)'
|
||||
return ', '.join(['"%s"' % license for license in licenses])
|
||||
|
||||
|
||||
def find_licenses(filename, relax=False):
|
||||
spdx_license_identifiers = []
|
||||
other_license_identifiers = []
|
||||
has_copyright = False
|
||||
try:
|
||||
with open(filename, 'r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
line = line.rstrip()
|
||||
if 'Copyright ' in line:
|
||||
has_copyright = True
|
||||
if 'Copyright: ' in line:
|
||||
print('%s: found copyright line with "Copyright:". Please remove the colon.' % (filename, ))
|
||||
if 'SPDX-FileCopyrightText: ' in line:
|
||||
has_copyright = True
|
||||
idx = line.find('SPDX-License-Identifier: ')
|
||||
if idx >= 0:
|
||||
lic_id = line[idx + len('SPDX-License-Identifier: '):]
|
||||
spdx_license_identifiers.extend(lic_id.split(' OR '))
|
||||
if 'GNU General Public License' in line:
|
||||
if 'v3.0+' in line:
|
||||
other_license_identifiers.append('GPL-3.0-or-later')
|
||||
if 'version 3 or later' in line:
|
||||
other_license_identifiers.append('GPL-3.0-or-later')
|
||||
if 'Simplified BSD License' in line:
|
||||
other_license_identifiers.append('BSD-2-Clause')
|
||||
if 'Apache License 2.0' in line:
|
||||
other_license_identifiers.append('Apache-2.0')
|
||||
if 'PSF License' in line or 'Python-2.0' in line:
|
||||
other_license_identifiers.append('PSF-2.0')
|
||||
if 'MIT License' in line:
|
||||
other_license_identifiers.append('MIT')
|
||||
except Exception as exc:
|
||||
print('%s: error while processing file: %s' % (filename, exc))
|
||||
if len(set(spdx_license_identifiers)) < len(spdx_license_identifiers):
|
||||
print('%s: found identical SPDX-License-Identifier values' % (filename, ))
|
||||
if other_license_identifiers and set(other_license_identifiers) != set(spdx_license_identifiers):
|
||||
print('%s: SPDX-License-Identifier yielded the license list %s, while manual guessing yielded the license list %s' % (
|
||||
filename, format_license_list(spdx_license_identifiers), format_license_list(other_license_identifiers)))
|
||||
if not has_copyright and not relax:
|
||||
print('%s: found no copyright notice' % (filename, ))
|
||||
return sorted(spdx_license_identifiers)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
||||
|
||||
# The following paths are allowed to have no license identifier
|
||||
no_comments_allowed = [
|
||||
'changelogs/fragments/*.yml',
|
||||
'changelogs/fragments/*.yaml',
|
||||
]
|
||||
|
||||
# These files are completely ignored
|
||||
ignore_paths = [
|
||||
'.ansible-test-timeout.json',
|
||||
'.reuse/dep5',
|
||||
'LICENSES/*.txt',
|
||||
'COPYING',
|
||||
]
|
||||
|
||||
no_comments_allowed = [fn for pattern in no_comments_allowed for fn in glob.glob(pattern)]
|
||||
ignore_paths = [fn for pattern in ignore_paths for fn in glob.glob(pattern)]
|
||||
|
||||
valid_licenses = [license_file[len('LICENSES/'):-len('.txt')] for license_file in glob.glob('LICENSES/*.txt')]
|
||||
|
||||
for path in paths:
|
||||
if path.startswith('./'):
|
||||
path = path[2:]
|
||||
if path in ignore_paths or path.startswith('tests/output/'):
|
||||
continue
|
||||
if os.stat(path).st_size == 0:
|
||||
continue
|
||||
if not path.endswith('.license') and os.path.exists(path + '.license'):
|
||||
path = path + '.license'
|
||||
valid_licenses_for_path = valid_licenses
|
||||
if path.startswith('plugins/') and not path.startswith(('plugins/modules/', 'plugins/module_utils/', 'plugins/doc_fragments/')):
|
||||
valid_licenses_for_path = [license for license in valid_licenses if license == 'GPL-3.0-or-later']
|
||||
licenses = find_licenses(path, relax=path in no_comments_allowed)
|
||||
if not licenses:
|
||||
if path not in no_comments_allowed:
|
||||
print('%s: must have at least one license' % (path, ))
|
||||
else:
|
||||
for license in licenses:
|
||||
if license not in valid_licenses_for_path:
|
||||
print('%s: found not allowed license "%s", must be one of %s' % (
|
||||
path, license, format_license_list(valid_licenses_for_path)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: 2022, Felix Fontein <felix@fontein.de>
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"include_symlinks": true,
|
||||
"prefixes": [
|
||||
"plugins/"
|
||||
],
|
||||
"output": "path-message"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Prevent unwanted files from being added to the source tree."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entry point."""
|
||||
paths = sys.argv[1:] or sys.stdin.read().splitlines()
|
||||
|
||||
allowed_extensions = (
|
||||
'.cs',
|
||||
'.ps1',
|
||||
'.psm1',
|
||||
'.py',
|
||||
)
|
||||
|
||||
skip_paths = set([
|
||||
])
|
||||
|
||||
skip_directories = (
|
||||
)
|
||||
|
||||
yaml_directories = (
|
||||
'plugins/test/',
|
||||
'plugins/filter/',
|
||||
)
|
||||
|
||||
for path in paths:
|
||||
if path in skip_paths:
|
||||
continue
|
||||
|
||||
if any(path.startswith(skip_directory) for skip_directory in skip_directories):
|
||||
continue
|
||||
|
||||
if os.path.islink(path):
|
||||
print('%s: is a symbolic link' % (path, ))
|
||||
elif not os.path.isfile(path):
|
||||
print('%s: is not a regular file' % (path, ))
|
||||
|
||||
ext = os.path.splitext(path)[1]
|
||||
|
||||
if ext in ('.yml', ) and any(path.startswith(yaml_directory) for yaml_directory in yaml_directories):
|
||||
continue
|
||||
|
||||
if ext not in allowed_extensions:
|
||||
print('%s: extension must be one of: %s' % (path, ', '.join(allowed_extensions)))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
@ -0,0 +1,14 @@
|
||||
.azure-pipelines/scripts/publish-codecov.py replace-urlopen
|
||||
plugins/callback/timestamp.py validate-modules:invalid-documentation
|
||||
plugins/callback/yaml.py validate-modules:invalid-documentation
|
||||
plugins/lookup/etcd.py validate-modules:invalid-documentation
|
||||
plugins/lookup/etcd3.py validate-modules:invalid-documentation
|
||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/read_csv.py validate-modules:invalid-documentation
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,16 @@
|
||||
.azure-pipelines/scripts/publish-codecov.py replace-urlopen
|
||||
plugins/callback/timestamp.py validate-modules:invalid-documentation
|
||||
plugins/callback/yaml.py validate-modules:invalid-documentation
|
||||
plugins/lookup/etcd.py validate-modules:invalid-documentation
|
||||
plugins/lookup/etcd3.py validate-modules:invalid-documentation
|
||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/read_csv.py validate-modules:invalid-documentation
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,11 @@
|
||||
.azure-pipelines/scripts/publish-codecov.py replace-urlopen
|
||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,12 @@
|
||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/udm_user.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,15 @@
|
||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/udm_user.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/module_utils/univention_umc.py pylint:use-yield-from # suggested construct does not work with Python 2
|
||||
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
|
||||
tests/unit/plugins/modules/helper.py pylint:use-yield-from # suggested construct does not work with Python 2
|
||||
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
@ -0,0 +1,15 @@
|
||||
plugins/modules/consul_session.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/homectl.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/homectl.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/iptables_state.py validate-modules:undocumented-parameter # params _back and _timeout used by action plugin
|
||||
plugins/modules/lxc_container.py validate-modules:use-run-command-not-popen
|
||||
plugins/modules/osx_defaults.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/parted.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/rhevm.py validate-modules:parameter-state-invalid-choice
|
||||
plugins/modules/udm_user.py import-3.11 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/udm_user.py import-3.12 # Uses deprecated stdlib library 'crypt'
|
||||
plugins/modules/xfconf.py validate-modules:return-syntax-error
|
||||
plugins/module_utils/univention_umc.py pylint:use-yield-from # suggested construct does not work with Python 2
|
||||
tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
|
||||
tests/unit/plugins/modules/helper.py pylint:use-yield-from # suggested construct does not work with Python 2
|
||||
tests/unit/plugins/modules/test_gio_mime.yaml no-smart-quotes
|
@ -0,0 +1,3 @@
|
||||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: Ansible Project
|
Reference in New Issue
Block a user