diff --git a/.gitignore b/.gitignore index c10e56d..b45fdb9 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,7 @@ erl_crash.dump # Directories that get created during tests /test/projects/**/_build /test/projects/**/deps + +# Dialyzer files +/priv/plts/*.plt +/priv/plts/*.plt.hash diff --git a/lib/uniform.ex b/lib/uniform.ex index dfa753e..35b6f7a 100644 --- a/lib/uniform.ex +++ b/lib/uniform.ex @@ -125,7 +125,7 @@ defmodule Uniform do disk the ejected app will be written, etc.). If there is a mistake, the user will have a chance to abort before performing a potentially destructive action. """ && false - @spec prepare(init :: %{name: atom, opts: [prepare_opt]}) :: Uniform.App.t() + @spec prepare(init :: %{name: String.t(), opts: [prepare_opt]}) :: Uniform.App.t() def prepare(%{name: name, opts: opts}) do # ensure the name was passed in under_score format; otherwise subtle bugs happen unless name in Uniform.ejectable_app_names() do diff --git a/lib/uniform/app.ex b/lib/uniform/app.ex index d532950..eac1819 100644 --- a/lib/uniform/app.ex +++ b/lib/uniform/app.ex @@ -230,7 +230,7 @@ defmodule Uniform.App do # Given a manifest struct, returns a `%Deps{}` struct containing # information about lib and mix dependencies. - @spec deps(Config.t(), Manifest.t()) :: t + @spec deps(Config.t(), Manifest.t()) :: Deps.t() defp deps(config, manifest) do all_libs = Config.lib_deps(config) all_mixs = Config.mix_deps(config) diff --git a/lib/uniform/file.ex b/lib/uniform/file.ex index 756615c..23d27e8 100644 --- a/lib/uniform/file.ex +++ b/lib/uniform/file.ex @@ -185,7 +185,7 @@ defmodule Uniform.File do # Given a directory, return which paths to eject based on the rules # associated with that directory. Includes files in `lib/` # as well as `test/` - @spec lib_dir_files(App.t(), String.t(), keyword) :: [Uniform.File.t()] + @spec lib_dir_files(App.t(), String.t(), keyword | map) :: [Uniform.File.t()] defp lib_dir_files(app, lib_dir, opts) do # location of lib and test cp_r is configurable for testing only = opts[:only] diff --git a/mix.exs b/mix.exs index 47a0425..9860024 100644 --- a/mix.exs +++ b/mix.exs @@ -12,6 +12,11 @@ defmodule Uniform.MixProject do start_permanent: Mix.env() == :prod, deps: deps(), elixirc_paths: elixirc_paths(Mix.env()), + dialyzer: [ + plt_add_apps: [:mix], + plt_file: {:no_warn, "priv/plts/dialyzer.plt"}, + list_unused_filters: true + ], # Hex description: "Write less boilerplate and reuse more code in your portfolio of Elixir apps", @@ -30,7 +35,8 @@ defmodule Uniform.MixProject do defp deps do [ {:ex_doc, ">= 0.30.9", only: [:dev, :docs], runtime: false}, - {:sourceror, "~> 0.14"} + {:sourceror, "~> 0.14"}, + {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false, optional: true} ] end diff --git a/mix.lock b/mix.lock index 9790cbc..e8d8dd3 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,7 @@ %{ + "dialyxir": {:hex, :dialyxir, "1.4.2", "764a6e8e7a354f0ba95d58418178d486065ead1f69ad89782817c296d0d746a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "516603d8067b2fd585319e4b13d3674ad4f314a5902ba8130cd97dc902ce6bbd"}, "earmark_parser": {:hex, :earmark_parser, "1.4.37", "2ad73550e27c8946648b06905a57e4d454e4d7229c2dafa72a0348c99d8be5f7", [:mix], [], "hexpm", "6b19783f2802f039806f375610faa22da130b8edc21209d0bff47918bb48360e"}, + "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, "ex_doc": {:hex, :ex_doc, "0.30.9", "d691453495c47434c0f2052b08dd91cc32bc4e1a218f86884563448ee2502dd2", [:mix], [{:earmark_parser, "~> 1.4.31", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "d7aaaf21e95dc5cddabf89063327e96867d00013963eadf2c6ad135506a8bc10"}, "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.1", "cc9e3ca312f1cfeccc572b37a09980287e243648108384b97ff2b76e505c3555", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "e127a341ad1b209bd80f7bd1620a15693a9908ed780c3b763bccf7d200c767c6"},