class

Krikri::Lint::NoFreeFormRule

Inherits Krikri::Lint::Rule < Reference < Object

Upstream parity: no-free-form (severity MEDIUM, tags syntax/risk). Flags module: "some string with k=v" - the free-form calling convention, where module arguments are crammed into a single string instead of passed as a mapping. It hides typos (a misspelled key is silently dropped by the module) and defeats argument validation, so upstream steers users to the explicit form.

Two exemptions upstream makes:

  • include/import actions, whose string is the argument list
  • command/shell free-form that carries no key= option, i.e. a plain command line with nothing to unpack

Constants

CMD_SHELL_MODULES = ["ansible.builtin.command", "ansible.builtin.shell", "ansible.windows.win_command", "ansible.windows.win_shell", "command", "shell", "win_command", "win_shell"] of ::String

Modules whose free form is a command line, where only a key= option makes it a free-form call worth flagging.

CMD_SHELL_OPTION = /(chdir|creates|executable|removes|stdin|stdin_add_newline|warn)=/

Option names that mark a command/shell free form as carrying module arguments rather than just a command line.

INCLUSION_ACTIONS = ["include", "include_tasks", "import_playbook", "import_tasks", "ansible.builtin.include", "ansible.builtin.include_tasks", "ansible.builtin.import_playbook", "ansible.builtin.import_tasks"] of ::String

Instance methods

applies_to
Source
check(file : PositionedFile, violations : Array(Violation)) : Nil
Source
marks_fixed?(violation : Violation) : Bool

Whether upstream's transform marks the given violation fixed. Transformable rules that do not mark it fixed get an "Rule specific fix not applied for" ERROR logged for the match.

Source
severity
Source
tags
Source
task_scoped?

Task-oriented: violations belong to an enclosing task, so a # noqa: anywhere in that task's body suppresses them.

Source
transformable?

Upstream's transform rewrites the free-form module call and marks the match fixed, so no "not applied" is logged.

Source