# `Juggernaut.Plan`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/plan.ex#L1)

Resolves a run's scope to files and lines, and turns them into the run's mutants
(design notes §3, §10.1 steps 2-3).

Scopes:

  * `:full` - every `.ex` file under `paths`, less `exclude`;
  * `:files` - the named files or globs, whole (`exclude` does not apply to files
    named on purpose); a name that matches nothing is a usage error;
  * `:changed` - every `.ex` file under `paths` changed since the merge base of `base`
    (or the given ref) and `HEAD`, committed or not, plus untracked files, whole;
  * `:since` - only the function clauses whose lines changed since the merge base of
    the ref and `HEAD` (`git diff -U0`, `Juggernaut.Plan.Hunks`), plus untracked files
    whole.

A scope that needs git fails with a usage error when git cannot answer (exit 2).

# `file_plan`

```elixir
@type file_plan() :: %{path: String.t(), lines: :all | MapSet.t(pos_integer())}
```

# `inventory`

```elixir
@type inventory() :: %{
  mutants: [Juggernaut.Mutant.t()],
  files: [%{path: String.t(), compile_time: non_neg_integer()}],
  errors: [map()],
  warnings: [map()]
}
```

# `t`

```elixir
@type t() :: %{scope: Juggernaut.Run.scope(), files: [file_plan()]}
```

# `core?`

```elixir
@spec core?([String.t() | module()], String.t(), module() | nil) :: boolean()
```

Whether a mutant of `module` in `file` is core: `core` holds file globs and module
patterns (`MyApp.Core`, `"MyApp.Core.*"`).

# `inventory`

```elixir
@spec inventory(t(), Juggernaut.Config.t(), :inner | :gate | :release) ::
  {:ok, inventory()} | {:error, Juggernaut.Error.t()}
```

The mutants of `plan` under `config` in `lane`, with short ids, plus each file's
compile-time site count and the ignore errors and warnings. A file that does not
parse is a usage error. In a full scan, a raw or skip route that matched no call is a
warning.

# `resolve`

```elixir
@spec resolve(Juggernaut.Config.t(), Juggernaut.Run.scope(), keyword()) ::
  {:ok, t()} | {:error, Juggernaut.Error.t()}
```

The files and lines `scope` covers. `opts`: `:git`, the git runner (default
`Juggernaut.Plan.Git.run/2`).

---

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