Skip to content

Commit dd672b1

Browse files
demerphqYves Orton
andauthored
mix xref graph - rework cycles output description (#14330)
Include a link to the wikipedia article on strongly connected components, and use the term in the output for clarity. Co-authored-by: Yves Orton <yves.orton@remote.com>
1 parent 37b6f0b commit dd672b1

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/mix/lib/mix/tasks/xref.ex

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,15 @@ defmodule Mix.Tasks.Xref do
383383
lib/b.ex
384384
lib/a.ex (compile)
385385
386-
More precisely, `xref` is printing strongly connected cycles, which
387-
is the largest cycle possible involving these files. For this reason,
388-
files may have multiple relationships between them, and therefore the
389-
cycles are not printed in order. The label reflects the highest type
390-
of relationship between the given file and any other file in the cycle.
391-
In the example above, it means `lib/a.ex` depends on something else in
392-
the cycle at compile-time. Those are exactly the type of dependencies
386+
More precisely, `xref` is printing the (strongly connected components)[https://en.wikipedia.org/wiki/Strongly_connected_component]
387+
in the dependency graph, which is (roughly speaking) the largest set of
388+
files which are part of a dependency cycle involving these files.
389+
390+
For this reason, files may have multiple relationships between them, and
391+
therefore the cycles are not printed in order. The label reflects the
392+
highest type of relationship between the given file and any other file in
393+
the cycle. In the example above, it means `lib/a.ex` depends on something
394+
else in the cycle at compile-time. Those are exactly the type of dependencies
393395
we want to avoid, and you can ask `mix xref` to only print graphs with
394396
with compile dependencies in them by passing the `--label` flag:
395397
@@ -1264,7 +1266,9 @@ defmodule Mix.Tasks.Xref do
12641266
0
12651267

12661268
cycles ->
1267-
shell.info("#{length(cycles)} cycles found. Showing them in decreasing size:\n")
1269+
shell.info(
1270+
"#{length(cycles)} strongly connected components (cycles) found. Showing them in decreasing size:\n"
1271+
)
12681272

12691273
for {length, cycle} <- cycles do
12701274
shell.info("Cycle of length #{length}:\n")

0 commit comments

Comments
 (0)