# `Tack.Credo.Check.CorePurity`
[🔗](https://github.com/giggleton/pica/blob/v0.1.0/dev/tack/credo/check/core_purity.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `high` and works with any version of Elixir.

## Explanation

The pure core takes values as arguments: no clock read, no config read, no process, no IO.

CLAUDE.md, Approach & architecture: the pure domain rules are a `boundary` declaration with
`type: :strict`, so a core module reaching a context, a read model or any external library
fails the build. This check is the part of the core's contract the compiler cannot hold. What
Boundary cannot see is the standard library: `DateTime.utc_now/0`, `Application.get_env/3`,
`spawn/1` and `File.read/1` are `:elixir`/`:kernel`, and a core module calling one compiles
in silence.

Four categories, each with the shape that replaces it:

  * **Clock reads** — take the instant as an argument. A small `Clock` module at the boundary
    reads the wall clock and hands the value to a pure core fold.
  * **Config reads** — take the value as an argument. Where a question genuinely needs both
    config and a pure fold, it gets its own small module above the core.
  * **Unseeded randomness** — every source of randomness derives from an injected integer
    seed, through the state-passing `:rand` API (`:rand.seed_s/2` with `:rand.uniform_s/1`)
    or `:erlang.phash2/1,2`. The process-dictionary API (`:rand.uniform/0`, `Enum.random/1`)
    is not reproducible, and every run must replay.
  * **Processes and IO** — the core is values in, values out.

Scope this check to the core in `.credo.exs` with a `files:` filter; it says nothing about
the rest of the tree, where all four categories are ordinary.

## Check-Specific Parameters

*There are no specific parameters for this check.*

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
