class

AmebaConfig::Catalog

Inherits Reference < Object

The collection of ameba rules discovered by running the installed ameba binary. The catalog is lazily populated: rule details (settings, detailed description) are fetched on demand via ameba -d <rule> and memoised in each Rule instance.

Constants

RULE_LINE_RE = /\A\s+(✓|x)\s+\[([CWE])\]\s+(\S+)\s+(.+?)\s*\z/

Matches a single line in the ameba -r rule listing, e.g.: " ✓ [W] Style/VerboseBlock Identifies..."

Constructors

from_rules(rules : Array(Rule)) : Catalog

Constructor for tests: bypass ameba CLI and inject a pre-built rule set. Every rule passed in is considered already-hydrated, so detail lookups are no-ops.

Source
new(ameba_bin : String | Nil = nil, lazy : Bool = true)
Source

Class methods

ameba_available?

True when the ameba binary is reachable on $PATH. Used by specs to skip integration tests when the tool isn't installed.

Source
default_ameba_bin

Resolve the ameba binary by searching $PATH. Raises with a clear message if it isn't installed — we don't fall back to any hardcoded location, since that just produced confusing errors when ameba got moved between homebrew prefixes.

Source

Instance methods

[](name : String) : Rule
Source
[]?(name : String) : Rule | Nil
Source
canonical_name(name : String) : String | Nil

Resolve a case-insensitive rule name to its canonical form. Returns nil when no rule matches. Exact-case matches are honoured first so the happy path stays O(1).

Source
canonical_name!(name : String) : String

Resolve a case-insensitive rule name, raising CLIError when unknown. The error message uses the user's spelling so they recognise their input.

Source
each
Source
hydrate(rule : Rule) : Nil

Hydrate one rule with details from ameba -d <name> if not already done.

Source
hydrate_all

Force-load detailed descriptions and defaults for every rule. Useful for create/update which iterate over the full catalog.

Source
includes?(name : String) : Bool
Source
names
Source
rules
Source