@@ -12,38 +12,70 @@ defmodule Mix.Tasks.Xref do
1212
1313 ## Xref modes
1414
15- The following commands and options are available:
15+ The `xref` task expects a mode as first argument:
16+
17+ mix xref MODE
18+
19+ All modes available are discussed below.
20+
21+ ### warnings
1622
17- * `warnings` - prints warnings for violated cross reference checks
23+ Prints warnings for violated cross reference checks:
24+
25+ mix xref warnings
26+
27+ This is the mode used by Mix during compilation.
1828
19- * ` unreachable` - prints all unreachable "file:line: module.function/arity" entries
29+ ### unreachable
2030
21- * `callers CALLEE` - prints all references of `CALLEE`, which can be one of: `Module`,
22- `Module.function`, or `Module.function/arity`
31+ Prints all unreachable "file:line: module.function/arity" entries:
32+
33+ mix xref unreachable
34+
35+ The "file:line" represents the file and line a call to an unknown
36+ "module.function/arity" is made.
37+
38+ ### callers CALLEE
2339
24- * `graph` - prints the file reference graph. By default, an edge from `A` to `B` indicates
25- that `A` depends on `B`
40+ Prints all callers of the given `CALLEE`, which can be one of: `Module`,
41+ `Module.function`, or `Module.function/arity`. Examples:
2642
27- * `--exclude` - paths to exclude
43+ mix xref callers MyMod
44+ mix xref callers MyMod.fun
45+ mix xref callers MyMod.fun/3
2846
29- * `--source` - display only files for which there is a path from the
30- given source file
47+ ### graph
3148
32- * `--sink` - display only files for which there is a path to the
33- given sink file.
49+ Prints a file dependency graph where an edge from `A` to `B` indicates
50+ that `A` depends on `B`.
51+
52+ mix xref graph --format dot
3453
35- * `--format` - can be set to one of :
54+ The following options are accepted :
3655
37- * `pretty` - use Unicode codepoints for formatting the graph. This is the default except on
38- Windows
56+ * `--exclude` - paths to exclude
3957
40- * `plain` - do not use Unicode codepoints for formatting the graph. This is the default on
41- Windows
58+ * `--source` - display all files that the given source file references (directly or indirectly)
4259
43- * `dot` - produces a DOT graph description in `xref_graph.dot` in the
44- current directory. Warning: this will override any previously generated file
60+ * `--sink` - display all files that references the given file (directly or indirectly)
4561
46- ## Options for all commands
62+ * `--format` - can be set to one of:
63+
64+ * `pretty` - use Unicode codepoints for formatting the graph.
65+ This is the default except on Windows
66+
67+ * `plain` - do not use Unicode codepoints for formatting the graph.
68+ This is the default on Windows
69+
70+ * `dot` - produces a DOT graph description in `xref_graph.dot` in the
71+ current directory. Warning: this will override any previously generated file
72+
73+ The `--source` and `--sink` options are particularly useful to understand how
74+ the modules in a particule file interact with the whole system.
75+
76+ ## Shared options
77+
78+ Those options are shared across all modes:
4779
4880 * `--no-compile` - do not compile even if files require compilation
4981
@@ -55,7 +87,7 @@ defmodule Mix.Tasks.Xref do
5587
5688 ## Configuration
5789
58- All configuration for Xref should be placed under the key `:xref`.
90+ All configuration for Xref should be placed under the key `:xref`.
5991
6092 * `:exclude` - a list of modules and `{module, function, arity}` tuples to ignore when checking
6193 cross references. For example: `[MissingModule, {MissingModule2, :missing_func, 2}]`
0 commit comments