AshCredo.Check.Warning.MissingChangeWrapper (ash_credo v0.5.2)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

Builtin change functions like manage_relationship, set_attribute, and relate_actor must be wrapped in change when used inside an action body.

Without the wrapper, the function call returns a change reference tuple that is silently discarded — the change never runs and no error is raised.

# Bad — compiles but silently does nothing
create :some_action do
  argument :thing, :map
  manage_relationship(:thing, :thing, type: :create)
end

# Good — wrapped in change
create :some_action do
  argument :thing, :map
  change manage_relationship(:thing, :thing, type: :create)
end

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.