mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
d77f3ef36b
commit
f61c19a6f6
1 changed files with 20 additions and 0 deletions
|
@ -72,6 +72,15 @@ def check(ctx, files, check_proper_formatting=False):
|
|||
path.relative_to(CODE_DIR),
|
||||
error,
|
||||
)
|
||||
error = _check_valid_versionchanged(docstring)
|
||||
if error:
|
||||
errors += 1
|
||||
exitcode = 1
|
||||
utils.error(
|
||||
"The module '{}' does not provide a proper `versionchanged` version: {!r} is not valid.",
|
||||
path.relative_to(CODE_DIR),
|
||||
error,
|
||||
)
|
||||
|
||||
if not str(path).startswith(SALT_INTERNAL_LOADERS_PATHS):
|
||||
# No further docstrings checks are needed
|
||||
|
@ -150,6 +159,17 @@ def _check_valid_versionadded(docstring):
|
|||
return False
|
||||
|
||||
|
||||
def _check_valid_versionchanged(docstring):
|
||||
versionadded_regex = re.compile("versionchanged::(?P<version>.*)")
|
||||
for match in versionadded_regex.finditer(docstring):
|
||||
version = match.group("version")
|
||||
try:
|
||||
parsed = SaltStackVersion.parse(version.strip())
|
||||
except ValueError:
|
||||
return version.strip()
|
||||
return False
|
||||
|
||||
|
||||
def _check_cli_example_present(docstring):
|
||||
cli_example_regex = re.compile(r"CLI Example(?:s)?:")
|
||||
return cli_example_regex.search(docstring) is not None
|
||||
|
|
Loading…
Add table
Reference in a new issue