OptimumCredo.Check.Readability.EventNameSnakeCase (OptimumCredo v0.5.0)
View SourceBasics
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
Event names use snake_case, ideally <verb>_<noun>. Dashes and uppercase letters
are reported in handle_event/3 heads, push_event/3 calls, and phx-* string
attributes in ~H templates. Dynamic names are not inspected. Opt-in, low priority.
Bad
def handle_event("save-draft", _params, socket), do: {:noreply, socket}Good
def handle_event("save_draft", _params, socket), do: {:noreply, socket}Check-Specific Parameters
Use the following parameters to configure this check:
:allowed_events
Event names accepted as written.
This parameter defaults to [].
:check_heex
Also inspect phx-* attributes in ~H sigils (and raw .heex sources passed directly).
This parameter defaults to true.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.