module

Krikri::Lint::Profile

Mirrors upstream's data/profiles.yml: profiles extend each other in order min -> basic -> moderate -> safety -> shared -> production, each rule first runs in the profile where it is listed under rules: (a skip_list: placement means it is still off there).

Constants

NAMES = ["min", "basic", "moderate", "safety", "shared", "official", "production"] of ::String
PROFILE_GROUP_SIZES = [4, 19, 4, 6, 15, 7]

How many entries of RULE_ORDER each summary profile contributes, in the same order as SUMMARY_PROFILES.

RULE_ORDER = ["internal-error", "load-failure", "parser-error", "syntax-check", "command-instead-of-module", "command-instead-of-shell", "deprecated-bare-vars", "deprecated-local-action", "deprecated-module", "inline-env-var", "key-order", "literal-compare", "jinja", "no-free-form", "no-jinja-when", "no-tabs", "partial-become", "playbook-extension", "role-name", "schema", "name", "var-naming", "yaml", "name[template]", "name[imperative]", "name[casing]", "spell-var-name", "avoid-implicit", "latest", "package-latest", "risky-file-permissions", "risky-octal", "risky-shell-pipe", "galaxy", "ignore-errors", "layout", "meta-incorrect", "meta-no-tags", "meta-video-links", "meta-version", "meta-runtime", "no-changed-when", "no-changelog", "no-handler", "no-relative-paths", "max-block-depth", "max-tasks", "unsafe-loop", "avoid-dot-notation", "sanity", "fqcn", "import-task-no-when", "meta-no-dependencies", "single-entry-point", "use-loop"] of ::String

Upstream builds rule_order by walking data/profiles.yml in file order and recording each profile's own rules list, so a rule's index is its position in that flattened concatenation. The summary table sorts its rows by this index, so it has to mirror the upstream file exactly: yaml at 22, package-latest at 29, no-changed-when at 41.

RULE_PROFILES = {"syntax-check" => "min", "name[missing]" => "basic", "name[casing]" => "moderate", "name[template]" => "moderate", "name[play]" => "basic", "command-instead-of-shell" => "basic", "command-instead-of-module" => "basic", "no-changed-when" => "shared", "risky-file-permissions" => "safety", "risky-octal" => "safety", "fqcn[action-core]" => "production", "yaml[line-length]" => "basic", "yaml[trailing-spaces]" => "basic", "yaml[truthy]" => "basic", "yaml[comments]" => "basic", "yaml[empty-lines]" => "basic", "yaml[hyphens]" => "basic", "yaml[indentation]" => "basic", "yaml[key-duplicates]" => "basic", "yaml[new-line-at-end-of-file]" => "basic", "yaml[octal-values]" => "basic", "yaml[commas]" => "basic", "yaml[colons]" => "basic", "partial-become" => "basic", "no-free-form" => "basic", "schema[meta]" => "basic"}

rule id -> lowest profile whose rules: list contains it.

SELECTABLE = SUMMARY_PROFILES

Upstream's --profile choices are every profile in data/profiles.yml, "basic" included (cli.py passes PROFILES.keys() straight to argparse).

SUMMARY_PROFILES = ["min", "basic", "moderate", "safety", "shared", "production"] of ::String

Upstream's PROFILES keys (data/profiles.yml), in order. NAMES also carries "official", a legacy alias that has no profile of its own upstream, so it must stay out of the summary's profile walk and star rating.

Class methods

includes?(profile : String, rule_id : String) : Bool
Source
list
Source
of(rule_id : String) : String | Nil

The profile that first lists this rule id - or, for a bracketed sub-tag whose family is listed, the family. Mirrors the lookup upstream's report_summary does against rule_order.

Source
order(rule_id : String) : Int32

Index of a rule - or of a bracketed tag's family - in RULE_ORDER. Unknown rules sort last, like upstream's idx fallback.

Source
valid?(profile : String) : Bool
Source