File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -48,13 +48,15 @@ defmodule Mix.Tasks.Xref do
4848 Mix.Task . run ( "compile" )
4949 end
5050
51- cond do
52- opts [ :warnings ] ->
51+ mode = Keyword . take ( opts , [ :warnings , :unreachable ] )
52+
53+ case mode do
54+ [ warnings: true ] ->
5355 warnings ( )
54- opts [ : unreachable] ->
56+ [ unreachable: true ] ->
5557 unreachable ( )
56- true ->
57- Mix . raise "xref expects one of the following flags : --warnings, --unreachable"
58+ _ ->
59+ Mix . raise "xref expects exactly one of the following modes : --warnings, --unreachable"
5860 end
5961 end
6062
@@ -150,7 +152,7 @@ defmodule Mix.Tasks.Xref do
150152 end
151153
152154 defp format_file_lines ( file , lines ) do
153- [ "\n Found at #{ length ( lines ) } locations:\n " |
155+ [ "Found at #{ length ( lines ) } locations:\n " |
154156 Enum . map ( lines , & format_file_line ( file , & 1 ) ) ]
155157 end
156158
Original file line number Diff line number Diff line change @@ -146,13 +146,11 @@ defmodule Mix.Tasks.XrefTest do
146146 end
147147 """ , """
148148 warning: function A.no_func/0 is undefined or private
149-
150149 Found at 2 locations:
151150 lib/a.ex:2
152151 lib/a.ex:4
153152
154153 warning: function A2.no_func/0 is undefined (module A2 is not available)
155-
156154 Found at 2 locations:
157155 lib/a.ex:3
158156 lib/a.ex:5
You can’t perform that action at this time.
0 commit comments