Skip to content

Commit b878e41

Browse files
committed
Fix mix dialyzer warnings and improve task specs
1 parent c447868 commit b878e41

34 files changed

+52
-12
lines changed

lib/mix/lib/mix/archive.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ defmodule Mix.Archive do
6666
{:ok, _} = :zip.create(String.to_char_list(target_path),
6767
files_to_add(source_path, dir),
6868
uncompress: ['.beam', '.app'])
69+
:ok
6970
end
7071

7172
defp files_to_add(path, dir) do

lib/mix/lib/mix/compilers/elixir.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ defmodule Mix.Compilers.Elixir do
157157

158158
defp remove_stale_entries([{beam, module, source, _d, _f} = entry|t], changed, removed, acc) do
159159
if source in changed do
160-
File.rm(beam)
160+
_ = File.rm(beam)
161161
remove_stale_entries(t, changed, [module|removed], acc)
162162
else
163163
remove_stale_entries(t, changed, removed, [entry|acc])

lib/mix/lib/mix/task.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ defmodule Mix.Task do
307307
Mix.TasksServer.delete_many([{:task, task, proj},
308308
{:alias, task, proj}])
309309

310-
if (module = get(task)) && recursive(module) && Mix.Project.umbrella? do
310+
_ = if (module = get(task)) && recursive(module) && Mix.Project.umbrella? do
311311
recur fn proj ->
312312
Mix.TasksServer.delete_many([{:task, task, proj},
313313
{:alias, task, proj}])

lib/mix/lib/mix/tasks/app.start.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ defmodule Mix.Tasks.App.Start do
1717
* `--no-start` - do not start applications after compilation
1818
1919
"""
20+
@spec run(OptionParser.argv) :: :ok
2021
def run(args) do
2122
Mix.Project.get!
2223
Mix.Task.run "loadpaths", ["--no-readd"|args]

lib/mix/lib/mix/tasks/archive.build.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ defmodule Mix.Tasks.Archive.Build do
3030
Only applies when `mix.exs` is available.
3131
3232
"""
33-
33+
@spec run(OptionParser.argv) :: :ok
3434
def run(args) do
3535
{opts, _, _} = OptionParser.parse(args, aliases: [o: :output, i: :input],
3636
switches: [force: :boolean, compile: :boolean])

lib/mix/lib/mix/tasks/archive.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule Mix.Tasks.Archive do
1515
variable to different locations based on a particular
1616
Elixir installation.
1717
"""
18-
18+
@spec run(OptionParser.argv) :: :ok
1919
def run(_) do
2020
archives =
2121
Mix.Local.archives_path

lib/mix/lib/mix/tasks/archive.uninstall.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defmodule Mix.Tasks.Archive.Uninstall do
99
mix archive.uninstall archive.ez
1010
1111
"""
12-
12+
@spec run(OptionParser.argv) :: :ok
1313
def run(argv) do
1414
{_, argv, _} = OptionParser.parse(argv)
1515

lib/mix/lib/mix/tasks/clean.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ defmodule Mix.Tasks.Clean do
1616

1717
@switches [deps: :boolean, only: :string]
1818

19+
@spec run(OptionParser.argv) :: :ok
1920
def run(args) do
2021
Mix.Project.get!
2122
loadpaths!

lib/mix/lib/mix/tasks/cmd.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ defmodule Mix.Tasks.Cmd do
1515
Aborts when the first command exits with status different
1616
than zero.
1717
"""
18+
@spec run(OptionParser.argv) :: :ok
1819
def run(args) do
1920
case Mix.shell.cmd(Enum.join(args, " ")) do
2021
0 -> :ok

lib/mix/lib/mix/tasks/compile.app.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ defmodule Mix.Tasks.Compile.App do
5858
* `--force` - forces compilation regardless of modification times
5959
6060
"""
61+
@spec run(OptionParser.argv) :: :ok | :noop
6162
def run(args) do
6263
{opts, _, _} = OptionParser.parse(args, switches: [force: :boolean])
6364

0 commit comments

Comments
 (0)