2020-09-16 09:44:57 +00:00
|
|
|
"""Checks related to ansible specific best practices."""
|
|
|
|
|
|
|
|
from ansiblelater.command.candidates import Error
|
|
|
|
from ansiblelater.command.candidates import Result
|
|
|
|
from ansiblelater.utils.rulehelper import get_normalized_tasks
|
|
|
|
|
|
|
|
|
|
|
|
def check_deprecated(candidate, settings):
|
|
|
|
tasks, errors = get_normalized_tasks(candidate, settings, full=True)
|
|
|
|
description = "'{old}' is deprecated and should not be used anymore. Use '{new}' instead."
|
|
|
|
|
|
|
|
if not errors:
|
|
|
|
for task in tasks:
|
2020-09-16 13:06:06 +00:00
|
|
|
if "skip_ansible_lint" in (task.get("tags") or []):
|
2020-09-16 09:44:57 +00:00
|
|
|
errors.append(
|
|
|
|
Error(
|
|
|
|
task["__line__"],
|
|
|
|
description.format(old="skip_ansible_lint", new="skip_ansible_later")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
return Result(candidate.path, errors)
|