From 395a2b3c1fad8f97e6b3705702c611e16906b974 Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sun, 1 Dec 2024 16:50:48 +0000 Subject: [PATCH] Normalize version field for rules - Renames version_added to version_changed attribute - Display warning if field is not defined or empty - Add values for all rules that had empty values' --- src/ansiblelint/_internal/rules.py | 19 ++++++++++++++----- src/ansiblelint/generate_docs.py | 4 ++-- src/ansiblelint/rules/args.py | 2 +- src/ansiblelint/rules/avoid_implicit.py | 2 +- .../rules/command_instead_of_module.py | 2 +- .../rules/command_instead_of_shell.py | 2 +- src/ansiblelint/rules/complexity.py | 2 +- src/ansiblelint/rules/deprecated_bare_vars.py | 2 +- .../rules/deprecated_local_action.py | 2 +- src/ansiblelint/rules/deprecated_module.py | 2 +- src/ansiblelint/rules/empty_string_compare.py | 2 +- src/ansiblelint/rules/fqcn.py | 2 +- src/ansiblelint/rules/galaxy.py | 2 +- .../rules/galaxy_version_incorrect.py | 2 +- src/ansiblelint/rules/ignore_errors.py | 2 +- src/ansiblelint/rules/inline_env_var.py | 2 +- src/ansiblelint/rules/jinja.py | 2 +- src/ansiblelint/rules/key_order.py | 2 +- src/ansiblelint/rules/latest.py | 2 +- src/ansiblelint/rules/literal_compare.py | 2 +- src/ansiblelint/rules/loop_var_prefix.py | 1 + src/ansiblelint/rules/meta_incorrect.py | 2 +- src/ansiblelint/rules/meta_no_tags.py | 2 +- src/ansiblelint/rules/meta_runtime.py | 2 +- src/ansiblelint/rules/meta_video_links.py | 2 +- src/ansiblelint/rules/name.py | 2 +- src/ansiblelint/rules/no_changed_when.py | 2 +- src/ansiblelint/rules/no_free_form.py | 2 +- src/ansiblelint/rules/no_handler.py | 2 +- src/ansiblelint/rules/no_jinja_when.py | 2 +- src/ansiblelint/rules/no_log_password.py | 2 +- src/ansiblelint/rules/no_prompting.py | 2 +- src/ansiblelint/rules/no_relative_paths.py | 2 +- src/ansiblelint/rules/no_same_owner.py | 1 + src/ansiblelint/rules/no_tabs.py | 2 +- src/ansiblelint/rules/only_builtins.py | 1 + src/ansiblelint/rules/package_latest.py | 2 +- src/ansiblelint/rules/partial_become.py | 2 +- src/ansiblelint/rules/playbook_extension.py | 2 +- .../rules/risky_file_permissions.py | 2 +- src/ansiblelint/rules/risky_octal.py | 2 +- src/ansiblelint/rules/risky_shell_pipe.py | 2 +- src/ansiblelint/rules/role_name.py | 2 +- src/ansiblelint/rules/run_once.py | 1 + src/ansiblelint/rules/sanity.py | 2 +- src/ansiblelint/rules/schema.py | 2 +- src/ansiblelint/rules/syntax_check.py | 2 +- src/ansiblelint/rules/var_naming.py | 2 +- src/ansiblelint/rules/yaml.md | 2 +- src/ansiblelint/rules/yaml_rule.py | 2 +- 50 files changed, 64 insertions(+), 51 deletions(-) diff --git a/src/ansiblelint/_internal/rules.py b/src/ansiblelint/_internal/rules.py index 8506a8173e..c9ac133119 100644 --- a/src/ansiblelint/_internal/rules.py +++ b/src/ansiblelint/_internal/rules.py @@ -7,6 +7,8 @@ from pathlib import Path from typing import TYPE_CHECKING, Any +from packaging.version import InvalidVersion, Version + from ansiblelint.constants import RULE_DOC_URL if TYPE_CHECKING: @@ -41,7 +43,7 @@ class BaseRule: id: str = "" tags: list[str] = [] description: str = "" - version_added: str = "" + version_changed: str = "" severity: str = "" link: str = "" has_dynamic_tags: bool = False @@ -59,6 +61,13 @@ class BaseRule: # Allow rules to provide a custom short description instead of using __doc__ _shortdesc: str = "" + def __init__(self) -> None: + try: + Version(self.version_changed) + except InvalidVersion: + msg = f"Rule {self.__class__.__name__} has an invalid version_changed field '{self.version_changed}', is should be a 'X.Y.Z' format value." + _logger.warning(msg) + @property def help(self) -> str: """Return a help markdown string for the rule.""" @@ -195,7 +204,7 @@ class RuntimeErrorRule(BaseRule): _shortdesc = "Unexpected internal error" severity = "VERY_HIGH" tags = ["core"] - version_added = "v5.0.0" + version_changed = "5.0.0" _order = 0 unloadable = True @@ -207,7 +216,7 @@ class AnsibleParserErrorRule(BaseRule): description = "Ansible parser fails; this usually indicates an invalid file." severity = "VERY_HIGH" tags = ["core"] - version_added = "v5.0.0" + version_changed = "5.0.0" _order = 0 unloadable = True @@ -219,7 +228,7 @@ class LoadingFailureRule(BaseRule): description = "Linter failed to process a file, possible invalid file." severity = "VERY_HIGH" tags = ["core", "unskippable"] - version_added = "v4.3.0" + version_changed = "4.3.0" _help = LOAD_FAILURE_MD _order = 0 _ids = { @@ -235,6 +244,6 @@ class WarningRule(BaseRule): severity = "LOW" # should remain experimental as that would keep it warning only tags = ["core", "experimental"] - version_added = "v6.8.0" + version_changed = "6.8.0" _order = 0 unloadable = True diff --git a/src/ansiblelint/generate_docs.py b/src/ansiblelint/generate_docs.py index 6e319fb846..a6f8a1d39d 100644 --- a/src/ansiblelint/generate_docs.py +++ b/src/ansiblelint/generate_docs.py @@ -81,8 +81,8 @@ def rules_as_rich(rules: RulesCollection) -> Iterable[Table]: if rule.link: description += f" [(more)]({rule.link})" table.add_row("description", Markdown(description)) - if rule.version_added: - table.add_row("version_added", rule.version_added) + if rule.version_changed: + table.add_row("version_changed", rule.version_changed) if rule.tags: table.add_row("tags", ", ".join(rule.tags)) if rule.severity: diff --git a/src/ansiblelint/rules/args.py b/src/ansiblelint/rules/args.py index f0d0175100..9a0d870b9a 100644 --- a/src/ansiblelint/rules/args.py +++ b/src/ansiblelint/rules/args.py @@ -88,7 +88,7 @@ class ArgsRule(AnsibleLintRule): severity = "HIGH" description = "Check whether tasks are using correct module options." tags = ["syntax", "experimental"] - version_added = "v6.10.0" + version_changed = "6.10.0" module_aliases: dict[str, str] = {"block/always/rescue": "block/always/rescue"} _ids = { "args[module]": description, diff --git a/src/ansiblelint/rules/avoid_implicit.py b/src/ansiblelint/rules/avoid_implicit.py index 6aed61a158..050385ec5e 100644 --- a/src/ansiblelint/rules/avoid_implicit.py +++ b/src/ansiblelint/rules/avoid_implicit.py @@ -24,7 +24,7 @@ class AvoidImplicitRule(AnsibleLintRule): ) severity = "MEDIUM" tags = ["unpredictability"] - version_added = "v6.8.0" + version_changed = "6.8.0" def matchtask( self, diff --git a/src/ansiblelint/rules/command_instead_of_module.py b/src/ansiblelint/rules/command_instead_of_module.py index 3765c6fc10..9d17827fb2 100644 --- a/src/ansiblelint/rules/command_instead_of_module.py +++ b/src/ansiblelint/rules/command_instead_of_module.py @@ -42,7 +42,7 @@ class CommandsInsteadOfModulesRule(AnsibleLintRule): ) severity = "HIGH" tags = ["command-shell", "idiom"] - version_added = "historic" + version_changed = "24.10.0" _commands = ["command", "shell"] _modules = { diff --git a/src/ansiblelint/rules/command_instead_of_shell.py b/src/ansiblelint/rules/command_instead_of_shell.py index 03e9ef9b74..67db8492b4 100644 --- a/src/ansiblelint/rules/command_instead_of_shell.py +++ b/src/ansiblelint/rules/command_instead_of_shell.py @@ -46,7 +46,7 @@ class UseCommandInsteadOfShellRule(AnsibleLintRule, TransformMixin): ) severity = "HIGH" tags = ["command-shell", "idiom"] - version_added = "historic" + version_changed = "6.18.0" def matchtask( self, diff --git a/src/ansiblelint/rules/complexity.py b/src/ansiblelint/rules/complexity.py index 04d92d081e..4763865365 100644 --- a/src/ansiblelint/rules/complexity.py +++ b/src/ansiblelint/rules/complexity.py @@ -23,7 +23,7 @@ class ComplexityRule(AnsibleLintRule): description = "There should be limited tasks executed inside any file" severity = "MEDIUM" tags = ["experimental", "idiom"] - version_added = "v6.18.0 (last update)" + version_changed = "6.18.0" _re_templated_inside = re.compile(r".*\{\{.*\}\}.*\w.*$") def matchplay(self, file: Lintable, data: dict[str, Any]) -> list[MatchError]: diff --git a/src/ansiblelint/rules/deprecated_bare_vars.py b/src/ansiblelint/rules/deprecated_bare_vars.py index 86bf6d1660..e09adc7053 100644 --- a/src/ansiblelint/rules/deprecated_bare_vars.py +++ b/src/ansiblelint/rules/deprecated_bare_vars.py @@ -45,7 +45,7 @@ class UsingBareVariablesIsDeprecatedRule(AnsibleLintRule): ) severity = "VERY_HIGH" tags = ["deprecations"] - version_added = "historic" + version_changed = "6.19.0" def matchtask( self, diff --git a/src/ansiblelint/rules/deprecated_local_action.py b/src/ansiblelint/rules/deprecated_local_action.py index ea6c637aaf..717b3ba124 100644 --- a/src/ansiblelint/rules/deprecated_local_action.py +++ b/src/ansiblelint/rules/deprecated_local_action.py @@ -35,7 +35,7 @@ class TaskNoLocalActionRule(AnsibleLintRule, TransformMixin): needs_raw_task = True severity = "MEDIUM" tags = ["deprecations"] - version_added = "v4.0.0" + version_changed = "4.0.0" def matchtask( self, diff --git a/src/ansiblelint/rules/deprecated_module.py b/src/ansiblelint/rules/deprecated_module.py index 72e328fc80..82d65ba11f 100644 --- a/src/ansiblelint/rules/deprecated_module.py +++ b/src/ansiblelint/rules/deprecated_module.py @@ -23,7 +23,7 @@ class DeprecatedModuleRule(AnsibleLintRule): link = "https://docs.ansible.com/ansible/latest/collections/index_module.html" severity = "HIGH" tags = ["deprecations"] - version_added = "v4.0.0" + version_changed = "4.0.0" _modules = [ "accelerate", diff --git a/src/ansiblelint/rules/empty_string_compare.py b/src/ansiblelint/rules/empty_string_compare.py index eaeadd9141..58e76a3f22 100644 --- a/src/ansiblelint/rules/empty_string_compare.py +++ b/src/ansiblelint/rules/empty_string_compare.py @@ -27,7 +27,7 @@ class ComparisonToEmptyStringRule(AnsibleLintRule): ) severity = "HIGH" tags = ["idiom", "opt-in"] - version_added = "v4.0.0" + version_changed = "4.0.0" empty_string_compare = re.compile(r"[=!]= ?(\"{2}|'{2})") diff --git a/src/ansiblelint/rules/fqcn.py b/src/ansiblelint/rules/fqcn.py index 0bfb2d7cb0..53f0990073 100644 --- a/src/ansiblelint/rules/fqcn.py +++ b/src/ansiblelint/rules/fqcn.py @@ -103,7 +103,7 @@ class FQCNBuiltinsRule(AnsibleLintRule, TransformMixin): "Check whether actions are using using full qualified collection names." ) tags = ["formatting"] - version_added = "v6.8.0" + version_changed = "6.8.0" module_aliases: dict[str, str] = {"block/always/rescue": "block/always/rescue"} _ids = { "fqcn[action-core]": "Use FQCN for builtin module actions", diff --git a/src/ansiblelint/rules/galaxy.py b/src/ansiblelint/rules/galaxy.py index fd4483c7bc..9491d788ef 100644 --- a/src/ansiblelint/rules/galaxy.py +++ b/src/ansiblelint/rules/galaxy.py @@ -20,7 +20,7 @@ class GalaxyRule(AnsibleLintRule): description = "Confirm that collection's units are valid." severity = "MEDIUM" tags = ["metadata"] - version_added = "v6.11.0 (last update)" + version_changed = "6.11.0" _ids = { "galaxy[tags]": "galaxy.yaml must have one of the required tags", "galaxy[no-changelog]": "No changelog found. Please add a changelog file. Refer to the galaxy.md file for more info.", diff --git a/src/ansiblelint/rules/galaxy_version_incorrect.py b/src/ansiblelint/rules/galaxy_version_incorrect.py index 165e5274cc..6378503e0c 100644 --- a/src/ansiblelint/rules/galaxy_version_incorrect.py +++ b/src/ansiblelint/rules/galaxy_version_incorrect.py @@ -20,7 +20,7 @@ class GalaxyVersionIncorrectRule(AnsibleLintRule): description = "Confirm via galaxy.yml file if collection version is greater than or equal to 1.0.0." severity = "MEDIUM" tags = ["opt-in", "metadata"] - version_added = "v24.7.0" + version_changed = "24.7.0" def matchplay(self, file: Lintable, data: dict[str, Any]) -> list[MatchError]: """Return matches found for a specific play (entry in playbook).""" diff --git a/src/ansiblelint/rules/ignore_errors.py b/src/ansiblelint/rules/ignore_errors.py index 979a3475de..0014c2ec6c 100644 --- a/src/ansiblelint/rules/ignore_errors.py +++ b/src/ansiblelint/rules/ignore_errors.py @@ -24,7 +24,7 @@ class IgnoreErrorsRule(AnsibleLintRule): ) severity = "LOW" tags = ["unpredictability"] - version_added = "v5.0.7" + version_changed = "5.0.7" def matchtask( self, diff --git a/src/ansiblelint/rules/inline_env_var.py b/src/ansiblelint/rules/inline_env_var.py index de2a4c1a30..ff15b24ce3 100644 --- a/src/ansiblelint/rules/inline_env_var.py +++ b/src/ansiblelint/rules/inline_env_var.py @@ -41,7 +41,7 @@ class EnvVarsInCommandRule(AnsibleLintRule): ) severity = "VERY_HIGH" tags = ["command-shell", "idiom"] - version_added = "historic" + version_changed = "5.0.11" expected_args = [ "chdir", diff --git a/src/ansiblelint/rules/jinja.py b/src/ansiblelint/rules/jinja.py index be09a32cd9..950c461445 100644 --- a/src/ansiblelint/rules/jinja.py +++ b/src/ansiblelint/rules/jinja.py @@ -98,7 +98,7 @@ class JinjaRule(AnsibleLintRule, TransformMixin): id = "jinja" severity = "LOW" tags = ["formatting"] - version_added = "v6.5.0" + version_changed = "6.5.0" _ansible_error_re = re.compile( ( r"^(?P.*): (?P.*)\. String: (?P.*)$" diff --git a/src/ansiblelint/rules/key_order.py b/src/ansiblelint/rules/key_order.py index a16fa1154a..488f9f9bd7 100644 --- a/src/ansiblelint/rules/key_order.py +++ b/src/ansiblelint/rules/key_order.py @@ -71,7 +71,7 @@ class KeyOrderRule(AnsibleLintRule, TransformMixin): id = "key-order" severity = "LOW" tags = ["formatting"] - version_added = "v6.6.2" + version_changed = "6.6.2" needs_raw_task = True _ids = { "key-order[task]": "You can improve the task key order", diff --git a/src/ansiblelint/rules/latest.py b/src/ansiblelint/rules/latest.py index ef57b94351..506fc8b918 100644 --- a/src/ansiblelint/rules/latest.py +++ b/src/ansiblelint/rules/latest.py @@ -22,7 +22,7 @@ class LatestRule(AnsibleLintRule): ) severity = "MEDIUM" tags = ["idempotency"] - version_added = "v6.5.2" + version_changed = "6.5.2" _ids = { "latest[git]": "Use a commit hash or tag instead of 'latest' for git", "latest[hg]": "Use a commit hash or tag instead of 'latest' for hg", diff --git a/src/ansiblelint/rules/literal_compare.py b/src/ansiblelint/rules/literal_compare.py index d4dd521207..f0a3a072f7 100644 --- a/src/ansiblelint/rules/literal_compare.py +++ b/src/ansiblelint/rules/literal_compare.py @@ -27,7 +27,7 @@ class ComparisonToLiteralBoolRule(AnsibleLintRule): ) severity = "HIGH" tags = ["idiom"] - version_added = "v4.0.0" + version_changed = "4.0.0" literal_bool_compare = re.compile(r"[=!]= ?(True|true|False|false)") diff --git a/src/ansiblelint/rules/loop_var_prefix.py b/src/ansiblelint/rules/loop_var_prefix.py index e86782ba64..2fbe3c2359 100644 --- a/src/ansiblelint/rules/loop_var_prefix.py +++ b/src/ansiblelint/rules/loop_var_prefix.py @@ -35,6 +35,7 @@ class RoleLoopVarPrefix(AnsibleLintRule): "loop-var-prefix[wrong]": "Loop variable name does not match regex.", "loop-var-prefix[missing]": "Replace unsafe implicit `item` loop variable.", } + version_changed = "6.7.0" def matchtask( self, diff --git a/src/ansiblelint/rules/meta_incorrect.py b/src/ansiblelint/rules/meta_incorrect.py index ed8d8d9a8e..aa0fb37f35 100644 --- a/src/ansiblelint/rules/meta_incorrect.py +++ b/src/ansiblelint/rules/meta_incorrect.py @@ -31,7 +31,7 @@ class MetaChangeFromDefaultRule(AnsibleLintRule): ) severity = "HIGH" tags = ["metadata"] - version_added = "v4.0.0" + version_changed = "4.0.0" def matchyaml(self, file: Lintable) -> list[MatchError]: if file.kind != "meta" or not file.data: diff --git a/src/ansiblelint/rules/meta_no_tags.py b/src/ansiblelint/rules/meta_no_tags.py index 3ec70ec7e1..d25c0ffe4f 100644 --- a/src/ansiblelint/rules/meta_no_tags.py +++ b/src/ansiblelint/rules/meta_no_tags.py @@ -30,7 +30,7 @@ class MetaTagValidRule(AnsibleLintRule): ) severity = "HIGH" tags = ["metadata"] - version_added = "v4.0.0" + version_changed = "4.0.0" TAG_REGEXP = re.compile(r"^[a-z0-9]+$") diff --git a/src/ansiblelint/rules/meta_runtime.py b/src/ansiblelint/rules/meta_runtime.py index 3df28268f1..0aaa799c38 100644 --- a/src/ansiblelint/rules/meta_runtime.py +++ b/src/ansiblelint/rules/meta_runtime.py @@ -28,7 +28,7 @@ class CheckRequiresAnsibleVersion(AnsibleLintRule): ) severity = "VERY_HIGH" tags = ["metadata"] - version_added = "v6.11.0 (last update)" + version_changed = "6.11.0" _ids = { "meta-runtime[unsupported-version]": "'requires_ansible' key must refer to a currently supported version", diff --git a/src/ansiblelint/rules/meta_video_links.py b/src/ansiblelint/rules/meta_video_links.py index fa19cc6849..a25d568673 100644 --- a/src/ansiblelint/rules/meta_video_links.py +++ b/src/ansiblelint/rules/meta_video_links.py @@ -28,7 +28,7 @@ class MetaVideoLinksRule(AnsibleLintRule): ) severity = "LOW" tags = ["metadata"] - version_added = "v4.0.0" + version_changed = "4.0.0" VIDEO_REGEXP = { "google": re.compile(r"https://drive\.google\.com.*file/d/([0-9A-Za-z-_]+)/.*"), diff --git a/src/ansiblelint/rules/name.py b/src/ansiblelint/rules/name.py index e34e98c4e5..7f7e7da528 100644 --- a/src/ansiblelint/rules/name.py +++ b/src/ansiblelint/rules/name.py @@ -31,7 +31,7 @@ class NameRule(AnsibleLintRule, TransformMixin): ) severity = "MEDIUM" tags = ["idiom"] - version_added = "v6.9.1 (last update)" + version_changed = "6.9.1" _re_templated_inside = re.compile(r".*\{\{.*\}\}.*\w.*$") _ids = { "name[play]": "All plays should be named.", diff --git a/src/ansiblelint/rules/no_changed_when.py b/src/ansiblelint/rules/no_changed_when.py index e71934d7eb..d27ec67ab3 100644 --- a/src/ansiblelint/rules/no_changed_when.py +++ b/src/ansiblelint/rules/no_changed_when.py @@ -39,7 +39,7 @@ class CommandHasChangesCheckRule(AnsibleLintRule): id = "no-changed-when" severity = "HIGH" tags = ["command-shell", "idempotency"] - version_added = "historic" + version_changed = "6.14.5" _commands = [ "ansible.builtin.command", diff --git a/src/ansiblelint/rules/no_free_form.py b/src/ansiblelint/rules/no_free_form.py index 14552fa545..e9b43cc2fb 100644 --- a/src/ansiblelint/rules/no_free_form.py +++ b/src/ansiblelint/rules/no_free_form.py @@ -31,7 +31,7 @@ class NoFreeFormRule(AnsibleLintRule, TransformMixin): description = "Avoid free-form inside files as it can produce subtle bugs." severity = "MEDIUM" tags = ["syntax", "risk"] - version_added = "v6.8.0" + version_changed = "6.8.0" needs_raw_task = True cmd_shell_re = re.compile( r"(chdir|creates|executable|removes|stdin|stdin_add_newline|warn)=", diff --git a/src/ansiblelint/rules/no_handler.py b/src/ansiblelint/rules/no_handler.py index 545e2ea19d..0c01b96234 100644 --- a/src/ansiblelint/rules/no_handler.py +++ b/src/ansiblelint/rules/no_handler.py @@ -63,7 +63,7 @@ class UseHandlerRatherThanWhenChangedRule(AnsibleLintRule): link = "https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html#handlers" severity = "MEDIUM" tags = ["idiom"] - version_added = "historic" + version_changed = "24.10.0" def matchtask( self, diff --git a/src/ansiblelint/rules/no_jinja_when.py b/src/ansiblelint/rules/no_jinja_when.py index 1e1aef0881..8b2e74375a 100644 --- a/src/ansiblelint/rules/no_jinja_when.py +++ b/src/ansiblelint/rules/no_jinja_when.py @@ -26,7 +26,7 @@ class NoFormattingInWhenRule(AnsibleLintRule, TransformMixin): ) severity = "HIGH" tags = ["deprecations"] - version_added = "historic" + version_changed = "6.20.0" @staticmethod def _is_valid(when: str) -> bool: diff --git a/src/ansiblelint/rules/no_log_password.py b/src/ansiblelint/rules/no_log_password.py index fcd41a13cf..f649a0992b 100644 --- a/src/ansiblelint/rules/no_log_password.py +++ b/src/ansiblelint/rules/no_log_password.py @@ -44,7 +44,7 @@ class NoLogPasswordsRule(AnsibleLintRule, TransformMixin): ) severity = "LOW" tags = ["opt-in", "security", "experimental"] - version_added = "v5.0.9" + version_changed = "5.0.9" def matchtask( self, diff --git a/src/ansiblelint/rules/no_prompting.py b/src/ansiblelint/rules/no_prompting.py index c5d11d838c..b72d698e0d 100644 --- a/src/ansiblelint/rules/no_prompting.py +++ b/src/ansiblelint/rules/no_prompting.py @@ -25,7 +25,7 @@ class NoPromptingRule(AnsibleLintRule): ) tags = ["opt-in"] severity = "VERY_LOW" - version_added = "v6.0.3" + version_changed = "6.0.3" def matchplay(self, file: Lintable, data: dict[str, Any]) -> list[MatchError]: """Return matches found for a specific playbook.""" diff --git a/src/ansiblelint/rules/no_relative_paths.py b/src/ansiblelint/rules/no_relative_paths.py index 21747ce8c5..d734037784 100644 --- a/src/ansiblelint/rules/no_relative_paths.py +++ b/src/ansiblelint/rules/no_relative_paths.py @@ -22,7 +22,7 @@ class RoleRelativePath(AnsibleLintRule): description = "The ``copy`` and ``template`` modules should not use relative path for ``src``." severity = "HIGH" tags = ["idiom"] - version_added = "v4.0.0" + version_changed = "4.0.0" _module_to_path_folder = { "copy": "files", diff --git a/src/ansiblelint/rules/no_same_owner.py b/src/ansiblelint/rules/no_same_owner.py index 9ec6840f96..6c02dcd9ba 100644 --- a/src/ansiblelint/rules/no_same_owner.py +++ b/src/ansiblelint/rules/no_same_owner.py @@ -26,6 +26,7 @@ class NoSameOwnerRule(AnsibleLintRule): """ severity = "LOW" tags = ["opt-in"] + version_changed = "6.4.0" def matchtask( self, diff --git a/src/ansiblelint/rules/no_tabs.py b/src/ansiblelint/rules/no_tabs.py index 859c9d4e78..d6ad3e77db 100644 --- a/src/ansiblelint/rules/no_tabs.py +++ b/src/ansiblelint/rules/no_tabs.py @@ -23,7 +23,7 @@ class NoTabsRule(AnsibleLintRule): description = "Tabs can cause unexpected display issues, use spaces" severity = "LOW" tags = ["formatting"] - version_added = "v4.0.0" + version_changed = "4.0.0" allow_list = [ ("lineinfile", "insertafter"), ("lineinfile", "insertbefore"), diff --git a/src/ansiblelint/rules/only_builtins.py b/src/ansiblelint/rules/only_builtins.py index 3757af8a16..d31e41bd47 100644 --- a/src/ansiblelint/rules/only_builtins.py +++ b/src/ansiblelint/rules/only_builtins.py @@ -22,6 +22,7 @@ class OnlyBuiltinsRule(AnsibleLintRule): severity = "MEDIUM" description = "Check whether the playbook uses anything but ``ansible.builtin``" tags = ["opt-in", "experimental"] + version_changed = "6.14.0" def matchtask( self, diff --git a/src/ansiblelint/rules/package_latest.py b/src/ansiblelint/rules/package_latest.py index 9c8ce3cd4e..4db70fa231 100644 --- a/src/ansiblelint/rules/package_latest.py +++ b/src/ansiblelint/rules/package_latest.py @@ -40,7 +40,7 @@ class PackageIsNotLatestRule(AnsibleLintRule): ) severity = "VERY_LOW" tags = ["idempotency"] - version_added = "historic" + version_changed = "6.20.0" _package_managers = [ "apk", diff --git a/src/ansiblelint/rules/partial_become.py b/src/ansiblelint/rules/partial_become.py index 3c05d4d198..3ef1d3d1f7 100644 --- a/src/ansiblelint/rules/partial_become.py +++ b/src/ansiblelint/rules/partial_become.py @@ -44,7 +44,7 @@ class BecomeUserWithoutBecomeRule(AnsibleLintRule, TransformMixin): description = "``become_user`` should have a corresponding ``become`` at the play or task level." severity = "VERY_HIGH" tags = ["unpredictability"] - version_added = "historic" + version_changed = "6.20.0" def matchplay( self, diff --git a/src/ansiblelint/rules/playbook_extension.py b/src/ansiblelint/rules/playbook_extension.py index a08c98475c..20a4dae9ba 100644 --- a/src/ansiblelint/rules/playbook_extension.py +++ b/src/ansiblelint/rules/playbook_extension.py @@ -23,7 +23,7 @@ class PlaybookExtensionRule(AnsibleLintRule): severity = "MEDIUM" tags = ["formatting"] done: list[str] = [] - version_added = "v4.0.0" + version_changed = "4.0.0" def matchyaml(self, file: Lintable) -> list[MatchError]: result: list[MatchError] = [] diff --git a/src/ansiblelint/rules/risky_file_permissions.py b/src/ansiblelint/rules/risky_file_permissions.py index 60317df278..078986ff45 100644 --- a/src/ansiblelint/rules/risky_file_permissions.py +++ b/src/ansiblelint/rules/risky_file_permissions.py @@ -82,7 +82,7 @@ class MissingFilePermissionsRule(AnsibleLintRule): link = "https://github.com/ansible/ansible/issues/71200" severity = "VERY_HIGH" tags = ["unpredictability"] - version_added = "v4.3.0" + version_changed = "4.3.0" _modules = _MODULES _modules_with_create = _MODULES_WITH_CREATE diff --git a/src/ansiblelint/rules/risky_octal.py b/src/ansiblelint/rules/risky_octal.py index e3dad389b4..5bae3a79d3 100644 --- a/src/ansiblelint/rules/risky_octal.py +++ b/src/ansiblelint/rules/risky_octal.py @@ -44,7 +44,7 @@ class OctalPermissionsRule(AnsibleLintRule): link = "https://docs.ansible.com/ansible/latest/collections/ansible/builtin/file_module.html" severity = "VERY_HIGH" tags = ["formatting"] - version_added = "historic" + version_changed = "6.9.1" _modules = [ "assemble", diff --git a/src/ansiblelint/rules/risky_shell_pipe.py b/src/ansiblelint/rules/risky_shell_pipe.py index a2acd51d44..e1f4ce9deb 100644 --- a/src/ansiblelint/rules/risky_shell_pipe.py +++ b/src/ansiblelint/rules/risky_shell_pipe.py @@ -28,7 +28,7 @@ class ShellWithoutPipefail(AnsibleLintRule): ) severity = "MEDIUM" tags = ["command-shell"] - version_added = "v4.1.0" + version_changed = "4.1.0" _pipefail_re = re.compile(r"^\s*set.*[+-][A-Za-z]*o\s*pipefail", re.MULTILINE) _pipe_re = re.compile(r"(?