Files
music_library/.credo.exs
T
Claudio Ortolina d30e6d2d8f Add Credo refactor checks and fix double Enum.map
Add 9 enabled + 1 disabled Credo checks from ex_slop README.
Fix MapMap finding in ListeningStats.update/1 (single pass).
Disable AppendSingleItem (10 pre-existing violations).
2026-05-14 10:47:13 +01:00

52 lines
1.8 KiB
Elixir

%{
configs: [
%{
name: "default",
plugins: [{ExSlop, []}],
checks: %{
extra: [
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
{Credo.Check.Refactor.DoubleBooleanNegation, []},
{Credo.Check.Refactor.CondStatements, []},
{Credo.Check.Refactor.MapMap, []},
{Credo.Check.Refactor.FilterFilter, []},
{Credo.Check.Refactor.RejectReject, []},
{Credo.Check.Refactor.FilterCount, []},
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
{Credo.Check.Refactor.UnlessWithElse, []},
{Credo.Check.Refactor.Nesting, max_nesting: 3},
{Credo.Check.Readability.ModuleDoc,
ignore_names: [
# Credo defaults
~r/(\.\w+Controller|\.Endpoint|\.\w+Live(\.\w+)?|\.Repo|\.Router|\.\w+Socket|\.\w+View|\.\w+HTML|\.\w+JSON|\.Telemetry|\.Layouts|\.Mailer)$/,
# Custom: external API internals follow a three-module pattern
# where only the facade needs documentation
~r/\.API(\..*)?$/,
~r/\.Config$/,
# Custom: test support modules
~r/Fixtures/,
# Custom: mix tasks
~r/^Mix\.Tasks\./
],
ignore_modules_using: [
# Credo defaults
Credo.Check,
Ecto.Schema,
Phoenix.LiveView,
~r/\.Web$/,
# Custom: LiveComponents and Oban workers are self-documenting
Oban.Worker,
# Matches `use MusicLibraryWeb, :live_component` etc.
MusicLibraryWeb
]},
{Credo.Check.Refactor.CyclomaticComplexity, max_complexity: 12}
],
disabled: [
{Credo.Check.Refactor.AppendSingleItem, []}
]
}
# files etc.
}
]
}