Rbtz.CredoChecks (rbtz_credo_checks v0.7.1)

Copy Markdown View Source

Helpers for wiring the Tiny Robots Credo checks into your .credo.exs.

all/0 returns every check in this library as a {check_module, opts} tuple, ready to append to the enabled: list in your .credo.exs:

checks: %{
  enabled:
    [
      # ...your Credo built-in checks...
    ] ++ Rbtz.CredoChecks.all()
}

The list is generated by discovering every check module in the library, so it stays in sync automatically as checks are added — there's nothing to hand-maintain.

Customising and disabling checks

Use all_replacing/1 to override a check's options. Each replacement is matched by module name and swaps in the given options:

Rbtz.CredoChecks.all_replacing([
  {Rbtz.CredoChecks.Readability.SnakeCaseVariableNumbering,
   exclude: ["utf8", "ipv4", "ipv6"]}
])

Pass false as the options to disable a check. Credo treats {check, false} as disabled, so the check stays in the list but is turned off:

Rbtz.CredoChecks.all_replacing([
  {Rbtz.CredoChecks.Design.PreferLogsterInLib, false}
])

A replacement naming a module that isn't one of this library's checks raises an ArgumentError, so typos and stale config surface immediately.

Summary

Functions

Returns all Tiny Robots Credo checks as {check_module, []} tuples.

Returns all Tiny Robots Credo checks, replacing the options of the ones named in replacements.

Functions

all()

@spec all() :: [{module(), []}]

Returns all Tiny Robots Credo checks as {check_module, []} tuples.

See all_replacing/1 to customise or disable individual checks.

all_replacing(replacements)

@spec all_replacing([{module(), keyword() | false}]) :: [
  {module(), keyword() | false}
]

Returns all Tiny Robots Credo checks, replacing the options of the ones named in replacements.

replacements is a list of {check_module, opts} tuples. For each, the matching check's default options are replaced with opts — a keyword list, or false to disable the check. Replacing a module that isn't part of this library raises ArgumentError.