mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-29 00:00:35 +00:00
Robert Kaussow
2df48598ec
BREAKING CHANGE: The option to define a `Standards` version has been removed. Every new rule that is added on upcoming releases is activated by default and will also create errors if triggered. The behavior of rules can be controlled by the existing `rules.exclude_filter` or `rules.warning_filter` options. BREAKING CHANGE: The option `rules.buildin` has been renamed to `rules.builtin`. BREAKING CHANGE: The option `rules.standards` has been renamed to `rules.dir`. BREAKING CHANGE: The option `rules.filter` has been renamed to `rules.include_filter`.
25 lines
773 B
Python
25 lines
773 B
Python
from ansible.parsing.yaml.objects import AnsibleMapping
|
|
|
|
from ansiblelater.rule import RuleBase
|
|
|
|
|
|
class CheckScmInSrc(RuleBase):
|
|
sid = "ANSIBLE0005"
|
|
description = "Use `scm:` key rather than `src: scm+url`"
|
|
helptext = "usage of `src: scm+url` not recommended"
|
|
types = ["rolesfile"]
|
|
|
|
def check(self, candidate, settings):
|
|
roles, errors = self.get_tasks(candidate, settings)
|
|
|
|
if not errors:
|
|
for role in roles:
|
|
if (
|
|
isinstance(role, AnsibleMapping)
|
|
and bool(role.get("src"))
|
|
and "+" in role.get("src")
|
|
):
|
|
errors.append(self.Error(role["__line__"], self.helptext))
|
|
|
|
return self.Result(candidate.path, errors)
|