# `ArchTest.Rule`
[🔗](https://github.com/yoavgeva/arch_test/blob/v0.3.1/lib/arch_test/rule.ex#L1)

Represents an architecture rule — a description and a check function that
evaluates against the dependency graph and returns a list of violations.

# `graph`

```elixir
@type graph() :: %{required(module()) =&gt; [module()]}
```

# `t`

```elixir
@type t() :: %ArchTest.Rule{
  check_fn: (graph() -&gt; [ArchTest.Violation.t()]),
  description: String.t(),
  freeze_id: String.t() | nil,
  ignore: keyword()
}
```

# `assert`

```elixir
@spec assert(
  t(),
  keyword()
) :: :ok
```

Evaluates a reusable rule and raises an ExUnit assertion on violations.

Options:
- `:graph` — pre-built graph
- `:app` — app to inspect when `:graph` is not present

# `evaluate`

```elixir
@spec evaluate(t(), graph()) :: {:ok, []} | {:violations, [ArchTest.Violation.t()]}
```

Evaluates a rule against the given dependency graph.

Returns `{:ok, []}` when no violations are found, or
`{:violations, [Violation.t()]}` otherwise.

# `freeze`

```elixir
@spec freeze(t(), String.t()) :: t()
```

Attaches a freeze baseline id to the rule.

# `ignore`

```elixir
@spec ignore(
  t(),
  keyword()
) :: t()
```

Adds ignore filters to a reusable rule.

Supported keys: `:caller`, `:callee`, and `:module`, each with a module glob
pattern or list of patterns.

# `new`

```elixir
@spec new(String.t(), (graph() -&gt; [ArchTest.Violation.t()])) :: t()
```

Creates a reusable architecture rule from a graph check function.

---

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