@@ -12,38 +12,70 @@ defmodule Mix.Tasks.Xref do
12
12
13
13
## Xref modes
14
14
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
16
22
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.
18
28
19
- * ` unreachable` - prints all unreachable "file:line: module.function/arity" entries
29
+ ### unreachable
20
30
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
23
39
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:
26
42
27
- * `--exclude` - paths to exclude
43
+ mix xref callers MyMod
44
+ mix xref callers MyMod.fun
45
+ mix xref callers MyMod.fun/3
28
46
29
- * `--source` - display only files for which there is a path from the
30
- given source file
47
+ ### graph
31
48
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
34
53
35
- * `--format` - can be set to one of :
54
+ The following options are accepted :
36
55
37
- * `pretty` - use Unicode codepoints for formatting the graph. This is the default except on
38
- Windows
56
+ * `--exclude` - paths to exclude
39
57
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)
42
59
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)
45
61
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:
47
79
48
80
* `--no-compile` - do not compile even if files require compilation
49
81
@@ -55,7 +87,7 @@ defmodule Mix.Tasks.Xref do
55
87
56
88
## Configuration
57
89
58
- All configuration for Xref should be placed under the key `:xref`.
90
+ All configuration for Xref should be placed under the key `:xref`.
59
91
60
92
* `:exclude` - a list of modules and `{module, function, arity}` tuples to ignore when checking
61
93
cross references. For example: `[MissingModule, {MissingModule2, :missing_func, 2}]`
0 commit comments