Mix v1.5.1 mix xref View Source
Performs cross reference checks between modules.
Xref modes
The xref
task expects a mode as first argument:
mix xref MODE
All available modes are discussed below.
warnings
Prints warnings for violated cross reference checks:
mix xref warnings
This is the mode used by Mix during compilation.
unreachable
Prints all unreachable “file:line: module.function/arity” entries:
mix xref unreachable
The “file:line” represents the file and line a call to an unknown “module.function/arity” is made.
callers CALLEE
Prints all callers of the given CALLEE
, which can be one of: Module
,
Module.function
, or Module.function/arity
. Examples:
mix xref callers MyMod
mix xref callers MyMod.fun
mix xref callers MyMod.fun/3
graph
Prints a file dependency graph where an edge from A
to B
indicates
that A
depends on B
.
mix xref graph --format dot
The following options are accepted:
--exclude
- paths to exclude--source
- displays all files that the given source file references (directly or indirectly)--sink
- displays all files that reference the given file (directly or indirectly)--format
- can be set to one of:pretty
- uses Unicode codepoints for formatting the graph. This is the default except on Windowsplain
- does not use Unicode codepoints for formatting the graph. This is the default on Windowsdot
- produces a DOT graph description inxref_graph.dot
in the current directory. Warning: this will override any previously generated file
The --source
and --sink
options are particularly useful when trying to understand how
the modules in a particular file interact with the whole system.
Shared options
Those options are shared across all modes:
--no-compile
- does not compile even if files require compilation--no-deps-check
- does not check dependencies--no-archives-check
- does not check archives--no-elixir-version-check
- does not check the Elixir version from mix.exs
Configuration
All configuration for Xref should be placed under the key :xref
.
:exclude
- a list of modules and{module, function, arity}
tuples to ignore when checking cross references. For example:[MissingModule, {MissingModule2, :missing_func, 2}]
Link to this section Summary
Link to this section Functions
Runs this task.