Basics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
Resources with actions but no code_interface block miss out on Ash's
generated typed functions. This check inspects each resource's fully
resolved action list via Ash.Resource.Info.actions/1 and, for every
action that has neither a resource-level nor a domain-level code
interface targeting it, emits a dedicated issue naming the missing
action.
# Flagged - action `:published` has no interface anywhere
actions do
read :published
end
# Preferred - one of:
code_interface do
define :published
end
# ...or on the domain:
resources do
resource MyApp.Post do
define :published
end
endRequirements
Your project must be compiled before running mix credo. If Ash is
not available in the VM running Credo, the check is a no-op and emits
a single diagnostic.
Notes
Embedded resources are skipped by this check, since they typically do not need a code interface.
Configuration
Specific actions can be suppressed via the excluded_actions param,
which takes a flat list of "Module.action_name" strings. Each entry
is matched literally against the action's fully qualified name (the
module as returned by inspect/1, joined to the action name by a
dot). Useful for skipping actions generated by extensions such as
AshAuthentication that are not meant to be called via a code
interface.
{AshCredo.Check.Design.MissingCodeInterface,
excluded_actions: [
"MyApp.Accounts.User.sign_in_with_password",
"MyApp.Accounts.Token.expunge_expired"
]}Check-Specific Parameters
Use the following parameters to configure this check:
:excluded_actions
List of "Module.action_name" strings to skip.
This parameter defaults to [].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.