LexCredo provides custom Credo checks for Elixir projects, targeting anti-patterns that are commonly introduced by both AI coding agents and human developers.
The checks are drawn primarily from:
Available Checks
Design
LexCredo.Check.Design.NoNestedModules— flagsdefmodulenested inside anotherdefmodule. Each module should live in its own file.
Readability
LexCredo.Check.Readability.DocExamplesSection(controversial) — flags@docstrings on public functions that are missing a## Examplessection.
Refactor
LexCredo.Check.Refactor.NoEnumWrapperFunctions(controversial) — flags named functions whose entire body is a singleEnum.*orStream.*transformation call.
Warning
LexCredo.Check.Warning.NoComplexWithElse— flagswithexpressions whoseelseblock exceedsmax_else_clauses(default:1).LexCredo.Check.Warning.NoEnumAllAssert(test files only) — flagsassert Enum.all?/2in tests; prefer aforloop with individual assertions that report the failing element.LexCredo.Check.Warning.NoPipeIntoCase(controversial) — flags|> case dopatterns; bind the value to a variable first.LexCredo.Check.Warning.NoProcessSleepInTests(test files only) — flagsProcess.sleep/1andProcess.alive?/1in tests; useProcess.monitor/1andassert_receiveinstead.LexCredo.Check.Warning.NoTaggedWithClauses— flags tagged-tuple workarounds inwithclauses (e.g.{:tag, {:ok, _}} <- {:tag, expr}).LexCredo.Check.Warning.PreferBooleanOperators(controversial) — flags&&,||,!when at least one operand is clearly boolean-returning; preferand,or,not.LexCredo.Check.Warning.UsePositiveTypeGuards— flags negated type guards in function heads (e.g.when not is_nil(x),when x != nil); use a precise positive guard instead.LexCredo.Check.Warning.UseStartSupervised(test files only) — flags directGenServer.start_link/2and similar calls in tests; usestart_supervised!/1for automatic cleanup.
Controversial checks
Checks marked (controversial) reflect opinions that are actively debated in the Elixir community. They are enabled by default because they catch real problems for AI-generated code, but your team may reasonably disagree. Review and disable as needed.
Summary
Functions
@spec version() :: String.t()
Returns the current version of LexCredo.
Examples
iex> LexCredo.version()
"0.1.0"