Reach.MacroFact (Reach v2.7.0)

Copy Markdown View Source

Source-level facts for macro and DSL declarations.

Summary

Functions

Collects source-level macro/DSL declaration facts from quoted Elixir AST.

Reads and collects macro/DSL facts from a source file.

Collects macro/DSL facts from all source files in a project.

Parses and collects macro/DSL facts from an Elixir source string.

Types

location()

@type location() :: %{
  optional(:file) => String.t(),
  optional(:line) => non_neg_integer(),
  optional(:column) => non_neg_integer() | nil
}

t()

@type t() :: %Reach.MacroFact{
  arity: non_neg_integer() | nil,
  call_module: module() | nil,
  confidence: atom() | nil,
  data: map(),
  framework: atom() | nil,
  generated?: boolean(),
  kind: atom(),
  name: atom() | nil,
  nesting: [atom()],
  owner_module: module() | nil,
  source: location() | nil,
  target: term()
}

Functions

at_source(facts, map)

by_framework(facts, framework)

by_kind(facts, kind)

by_owner(facts, owner_module)

collect_ast(ast, opts \\ [])

@spec collect_ast(
  Macro.t(),
  keyword()
) :: [t()]

Collects source-level macro/DSL declaration facts from quoted Elixir AST.

collect_file(path, opts \\ [])

@spec collect_file(
  Path.t(),
  keyword()
) :: {:ok, [t()]} | {:error, term()}

Reads and collects macro/DSL facts from a source file.

collect_project(project, opts \\ [])

@spec collect_project(
  map(),
  keyword()
) :: [t()]

Collects macro/DSL facts from all source files in a project.

collect_source(source, opts \\ [])

@spec collect_source(
  String.t(),
  keyword()
) :: {:ok, [t()]} | {:error, term()}

Parses and collects macro/DSL facts from an Elixir source string.

explained_callbacks(facts, owner_module)

family()

kinds()