# `VirtualTimeGenServer.Doctor`
[🔗](https://github.com/d-led/gen_server_virtual_time/blob/v1.1.0/packages/gen_server_virtual_time/lib/virtual_time_gen_server/doctor.ex#L1)

Turns a project's module references into the dependency lines it is missing.

The library is published as a family of packages that share one version, and a
module keeps its name when it moves to another package. So the fix for a
missing module is a line in `mix.exs`, not a change to the code — and this
module works out which line.

`mix virtual_time.doctor` drives it; the parts are pure so they can be
specified directly.

# `finding`

```elixir
@type finding() ::
  %{
    kind: :missing_package,
    module: String.t(),
    function: String.t() | nil,
    file: Path.t(),
    line: pos_integer(),
    package: VirtualTimeGenServer.Packages.package(),
    dependency: String.t()
  }
  | %{
      kind: :removed_api,
      module: String.t(),
      function: String.t() | nil,
      file: Path.t(),
      line: pos_integer(),
      replacement: String.t()
    }
```

A reference the project has to act on: either a module that lives in a package
the project does not have, or a call that was removed and has a replacement.

# `diagnose`

```elixir
@spec diagnose(
  [VirtualTimeGenServer.ModuleReferences.module_reference()],
  (String.t() -&gt; boolean())
) ::
  [finding()]
```

Reports what a project has to change, given its references and a way to ask
whether a module is available in the current build.

A module that is available is not a finding: the doctor only speaks about
problems. Availability — not the declared dependencies — is what it checks, so
a package that arrives indirectly is not reported either.

# `format`

```elixir
@spec format([finding()]) :: String.t()
```

The report as a project maintainer reads it.

# `missing_dependencies`

```elixir
@spec missing_dependencies([finding()]) :: [String.t()]
```

The dependencies a project has to add, one per package, in report order.

---

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