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.
Summary
Types
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.
Functions
Reports what a project has to change, given its references and a way to ask whether a module is available in the current build.
The report as a project maintainer reads it.
The dependencies a project has to add, one per package, in report order.
Types
@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.
Functions
@spec diagnose( [VirtualTimeGenServer.ModuleReferences.module_reference()], (String.t() -> 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.
The report as a project maintainer reads it.
The dependencies a project has to add, one per package, in report order.