This commit is contained in:
Robert Kaussow 2024-01-28 22:25:00 +01:00
parent b3f2e601b1
commit 912b351a7d
Signed by: xoxys
GPG Key ID: 4E692A2EAECC03C0
5 changed files with 5 additions and 4 deletions

View File

@ -5,7 +5,7 @@ from ansiblelater.utils import load_plugin
class CheckFQCNBuiltin(RuleBase):
rid = "ANS128"
helptext = "use FQCN `{module_alias}` for module action `{module}`"
description = "Actions should use full qualified collection names"
description = "Module actions should use full qualified collection names"
types = ["playbook", "task", "handler", "rolevars", "hostvars", "groupvars"]
module_aliases = {
"block": "block",
@ -92,7 +92,6 @@ class CheckFQCNBuiltin(RuleBase):
for task in tasks:
module = task["action"]["__ansible_module_original__"]
print(module)
if module not in self.module_aliases:
loaded_module = load_plugin(module)

View File

@ -123,8 +123,8 @@ class Settings:
"include_filter": [],
"exclude_filter": [],
"warning_filter": [
"ANS128",
"ANS999",
"ANS998",
],
"ignore_dotfiles": True,
"exclude_files": [],

View File

@ -415,6 +415,7 @@ def normalize_task(task, filename, custom_modules=None):
# about short calls
normalized["action"] = {
"__ansible_module__": action.removeprefix("ansible.builtin."),
"__ansible_module_original__": action,
}
if "_raw_params" in arguments:

View File

@ -77,8 +77,8 @@ rules:
# List of rule ID's that should be displayed as a warning instead of an error. By default,
# no rules are marked as warnings. This list allows to degrade errors to warnings for each rule.
warning_filter:
- "ANS128"
- "ANS999"
- "ANS998"
# All dotfiles (including hidden folders) are excluded by default.
# You can disable this setting and handle dotfiles by yourself with `exclude_files`.

View File

@ -43,4 +43,5 @@ Reviews are useless without some rules to check against. `ansible-later` comes w
| CheckRelativeRolePaths | ANS125 | Don't use a relative path in a role. | |
| CheckChangedInWhen | ANS126 | Use handlers instead of `when: changed`. | |
| CheckChangedInWhen | ANS127 | Deprecated bare variables in loops must not be used. | |
| CheckFQCNBuiltin | ANS128 | Module actions should use full qualified collection names. | |
| CheckDeprecated | ANS999 | Deprecated features of `ansible-later` should not be used. | |