@@ -72,19 +72,22 @@ defmodule Mix.Tasks.Gradient do
7272
7373 IO . puts ( "Typechecking files..." )
7474
75- res =
76- files
77- |> Stream . map ( fn { app_path , paths } ->
78- Stream . map ( paths , & Gradient . type_check_file ( & 1 , [ { :app_path , app_path } | options ] ) )
79- end )
80- |> Stream . concat ( )
81- |> Enum . to_list ( )
75+ files
76+ |> Stream . map ( fn { app_path , paths } ->
77+ Stream . map ( paths , & Gradient . type_check_file ( & 1 , [ { :app_path , app_path } | options ] ) )
78+ end )
79+ |> Stream . concat ( )
80+ |> execute ( options )
81+
82+ :ok
83+ end
84+
85+ defp execute ( stream , opts ) do
86+ res = if opts [ :crash_on_error ] , do: stream , else: Enum . to_list ( stream )
8287
8388 if Enum . all? ( res , & ( & 1 == :ok ) ) do
8489 IO . puts ( "No problems found!" )
8590 end
86-
87- :ok
8891 end
8992
9093 defp maybe_compile_project ( options ) do
@@ -122,6 +125,10 @@ defmodule Mix.Tasks.Gradient do
122125
123126 defp prepare_option ( { :fmt_location , v } , opts ) , do: [ { :fmt_location , String . to_atom ( v ) } | opts ]
124127
128+ defp prepare_option ( { :no_fancy , _ } , opts ) , do: [ { :fancy , false } | opts ]
129+
130+ defp prepare_option ( { :stop_on_first_error , _ } , opts ) , do: [ { :crash_on_error , true } | opts ]
131+
125132 defp prepare_option ( { k , v } , opts ) , do: [ { k , v } | opts ]
126133
127134 defp get_beams_paths ( [ ] ) do
0 commit comments