Ancora.Derive.ModuleLocator (ancora v1.0.0)

Copy Markdown View Source

Locates literal modules in project source on both sides of a diff.

The scan recognizes defmodule and defprotocol, including lexically nested modules. Modules built through Module.create/3 or a non-literal module name are invisible by design.

Summary

Functions

Builds the per-side module-to-source maps for a project and change set.

Returns all literal module names found on side.

Returns the path defining module on side, or :error.

Types

module_name()

@type module_name() :: String.t()

side()

@type side() :: :head | :base

t()

@type t() :: %Ancora.Derive.ModuleLocator{
  base: %{required(module_name()) => String.t()},
  head: %{required(module_name()) => String.t()}
}

Functions

build(project, change_set)

@spec build(Ancora.ProjectInfo.t(), Ancora.Derive.ChangeSet.t()) ::
  {:ok, t()} | {:error, term()}

Builds the per-side module-to-source maps for a project and change set.

modules(locator, side)

@spec modules(t(), side()) :: MapSet.t(String.t())

Returns all literal module names found on side.

path_for(locator, side, module)

@spec path_for(t(), side(), module() | String.t()) :: {:ok, String.t()} | :error

Returns the path defining module on side, or :error.