Skip to main content

CHANGELOG.md

# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2026-05-22

Initial release.

### Added

**Checks – Design**

- `LexCredo.Check.Design.NoNestedModules` — flags module definitions nested
  inside another module; skips test files by default
  (`exclude_test_files: true`).

**Checks – Readability**

- `LexCredo.Check.Readability.DocExamplesSection` — flags public functions
  whose `@doc` string contains code blocks but no `## Examples` heading.

**Checks – Refactor**

- `LexCredo.Check.Refactor.NoEnumWrapperFunctions` — flags single-function
  bodies that do nothing but delegate to `Enum`/`Stream` (`map`, `flat_map`,
  `each`, `map_reduce`, `flat_map_reduce`, `scan`).

**Checks – Warning**

- `LexCredo.Check.Warning.NoComplexWithElse` — flags `with` expressions whose
  `else` block exceeds `max_else_clauses` (default: `1`).
- `LexCredo.Check.Warning.NoEnumAllAssert` — flags `assert Enum.all?/2` in
  test files; suggests per-element assertions for clearer failure messages.
- `LexCredo.Check.Warning.NoPipeIntoCase` — flags `|> case do` patterns;
  suggests binding the intermediate value to a named variable first.
- `LexCredo.Check.Warning.NoProcessSleepInTests` — flags `Process.sleep/1`
  and `Process.alive?/1` in test files; suggests `Process.monitor/1` +
  `assert_receive` for deterministic synchronisation.
- `LexCredo.Check.Warning.NoTaggedWithClauses` — flags the
  `{:tag, {:ok, _}} <- {:tag, expr}` workaround used to identify which `with`
  clause failed in the `else` block.
- `LexCredo.Check.Warning.PreferBooleanOperators` — flags `&&`, `||`, and `!`
  when at least one operand is a boolean-typed expression; suggests `and`,
  `or`, and `not`. Does not flag truthy/falsy short-circuit patterns such as
  `user && user.name`.
- `LexCredo.Check.Warning.UsePositiveTypeGuards` — flags negated type guards
  in function heads (`not is_nil(x)`, `x != nil`, etc.); suggests a specific
  positive guard that accurately constrains the clause.
- `LexCredo.Check.Warning.UseStartSupervised` — flags direct `start_link`/
  `start` calls to `GenServer`, `Agent`, `Task`, `Supervisor`, and
  `DynamicSupervisor` in test files; suggests `start_supervised!/1`.

**General**

- `exclude_test_files` boolean parameter on all checks — set to `true` to
  skip files under `test/`; defaults to `true` for `NoNestedModules`, `false`
  for all others.
- GitHub Actions CI workflow: format check → compile (warnings-as-errors) →
  `credo --strict` → ExCoveralls; reads Elixir/OTP versions from
  `.tool-versions`.
- ExCoveralls configured with an 80 % minimum line-coverage threshold.
- ExDoc configured with `main: "readme"`, check modules grouped by category,
  and README / CHANGELOG / LICENSE included as extras.
- MIT license.

### Fixed

- `PreferBooleanOperators`: `boolean_like?/1` is now recursive for `&&`/`||`
  — they are only considered boolean-like when their own operands are
  boolean-like. This eliminates false positives on truthy/falsy short-circuit
  idioms such as `(user && user.name) || "default"`.
- `UsePositiveTypeGuards`: extended pattern matching to cover `not is_*(x)`
  for all standard type-guard functions, not just `is_nil`.