From 912b351a7d1f19c25183d0b34b979efee17562ee Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Sun, 28 Jan 2024 22:25:00 +0100 Subject: [PATCH] cleanup --- ansiblelater/rules/CheckFQCNBuiltin.py | 3 +-- ansiblelater/settings.py | 2 +- ansiblelater/utils/yamlhelper.py | 1 + docs/content/configuration/defaults.md | 2 +- docs/content/included_rules/_index.md | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ansiblelater/rules/CheckFQCNBuiltin.py b/ansiblelater/rules/CheckFQCNBuiltin.py index b7b06fe..b31f8fd 100644 --- a/ansiblelater/rules/CheckFQCNBuiltin.py +++ b/ansiblelater/rules/CheckFQCNBuiltin.py @@ -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) diff --git a/ansiblelater/settings.py b/ansiblelater/settings.py index 23a50bc..f45e087 100644 --- a/ansiblelater/settings.py +++ b/ansiblelater/settings.py @@ -123,8 +123,8 @@ class Settings: "include_filter": [], "exclude_filter": [], "warning_filter": [ + "ANS128", "ANS999", - "ANS998", ], "ignore_dotfiles": True, "exclude_files": [], diff --git a/ansiblelater/utils/yamlhelper.py b/ansiblelater/utils/yamlhelper.py index a1cfbf7..10a4b47 100644 --- a/ansiblelater/utils/yamlhelper.py +++ b/ansiblelater/utils/yamlhelper.py @@ -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: diff --git a/docs/content/configuration/defaults.md b/docs/content/configuration/defaults.md index 180209f..08dad66 100644 --- a/docs/content/configuration/defaults.md +++ b/docs/content/configuration/defaults.md @@ -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`. diff --git a/docs/content/included_rules/_index.md b/docs/content/included_rules/_index.md index 98136ee..7dfe3d0 100644 --- a/docs/content/included_rules/_index.md +++ b/docs/content/included_rules/_index.md @@ -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. | |