OptimumCredo.Check.Refactor.DuplicateHandleEvent (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
Identical handle_event/3 clauses in several LiveViews usually belong in an on_mount
hook (attach_hook/4) or a shared function. Compared across all files, after
alpha-renaming variables; trivial clauses are skipped. Opt-in, low priority.
Check-Specific Parameters
Use the following parameters to configure this check:
:min_nodes
Smallest clause size, in AST call nodes, that is compared.
This parameter defaults to 4.
:min_modules
How many distinct modules must contain the same clause.
This parameter defaults to 2.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.