Bylaw.Credo.Plugin.DisableForNextDefinition (bylaw_credo v0.4.0)

Copy Markdown View Source

Suppresses Credo issues throughout the next function clause.

Credo's next-line suppression cannot cover an issue reported several lines into a function, and manual line ranges become stale as the function changes. This plugin resolves the next def or defp clause's AST range so checks can keep reporting the precise offending line.

Enable it in .credo.exs:

plugins: [
  {Bylaw.Credo.Plugin.DisableForNextDefinition, []}
]

Then name the check before the definition:

# credo:disable-for-next-definition Bylaw.Credo.Check.Elixir.NoRaise
def run do
  raise "failure"
end

Omitting the check name suppresses all checks in that definition. Each clause of a multi-clause function is treated separately.