Skip to content

Commit cdbf9b7

Browse files
Improve function argument naming, specs and guards in Mix (#15216)
1 parent a58a40c commit cdbf9b7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/mix/lib/mix.ex

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,8 @@ defmodule Mix do
612612
Sets Mix debug mode.
613613
"""
614614
@spec debug(boolean()) :: :ok
615-
def debug(debug) when is_boolean(debug) do
616-
Mix.State.put(:debug, debug)
615+
def debug(enabled?) when is_boolean(enabled?) do
616+
Mix.State.put(:debug, enabled?)
617617
end
618618

619619
@doc """
@@ -652,6 +652,8 @@ defmodule Mix do
652652
"""
653653
@doc since: "1.10.0"
654654
@spec path_for(:archives | :escripts) :: String.t()
655+
def path_for(kind)
656+
655657
def path_for(:archives) do
656658
System.get_env("MIX_ARCHIVES") || Path.join(Mix.Utils.mix_home(), "archives")
657659
end
@@ -671,6 +673,7 @@ defmodule Mix do
671673
This function does not start the given applications.
672674
"""
673675
@doc since: "1.15.0"
676+
@spec ensure_application!(Application.app()) :: :ok
674677
def ensure_application!(app) when is_atom(app) do
675678
ensure_application!(app, Mix.State.builtin_apps(), [], %{})
676679
:ok
@@ -1131,7 +1134,7 @@ defmodule Mix do
11311134
end
11321135

11331136
@doc false
1134-
def in_install_project(fun) do
1137+
def in_install_project(fun) when is_function(fun, 0) do
11351138
case safe_get_installed() do
11361139
{id, dynamic_config} ->
11371140
config = install_project_config(dynamic_config)

0 commit comments

Comments
 (0)