Dialyxir v0.5.1 Mix.Tasks.Dialyzer

This task compiles the mix project, creates a PLT with dependencies if needed and runs dialyzer. Much of its behavior can be managed in configuration as described below.

If executed outside of a mix project, it will build the core PLT files and exit.

Command line options

  • --no-compile - do not compile even if needed.
  • --no-check - do not perform (quick) check to see if PLT needs updated.
  • --halt-exit-status - exit immediately with same exit status as dialyzer. useful for CI. do not use with mix do.
  • --plt - only build the required plt(s) and exit.

Warning flags passed to this task are passed on to :dialyzer.

e.g. mix dialyzer --unmatched_returns


All configuration is included under a dialyzer key in the mix project keyword list.


You can specify any dialyzer command line argument with the :flags keyword.

Dialyzer supports a number of warning flags used to enable or disable certain kinds of analysis features. Until version 0.4, dialyxir used by default the additional warning flags shown in the example below. However some of these create warnings that are often more confusing than helpful, particularly to new users of Dialyzer. As of 0.4, there are no longer any flags used by default. To get the old behavior, specify them in your Mix project file. For compatibility reasons you can use eiher the -Wwarning convention of the dialyzer CLI, or (preferred) the WarnOpts atoms supported by the API. e.g.

def project do
[ app: :my_app,
version: "0.0.1",
deps: deps,
dialyzer: [ flags: ["-Wunmatched_returns", :error_handling, :underspecs]]

PLT Configuration

The task will build a PLT with default core Erlang applications: :erts :kernel :stdlib :crypto and re-use this core file in multiple projects - another core file is created for Elixir.

OTP application dependencies are (transitively) added to your project’s PLT by default. The applications added are the same as you would see displayed with the command mix app.tree. There is also a :plt_add_deps option you can set to control the dependencies added. The following options are supported:

  • :project - Direct Mix and OTP dependencies
  • :apps_direct - Only Direct OTP application dependencies - not the entire tree
  • :transitive - Include Mix and OTP application dependencies recursively
  • :app_tree - Transitive OTP application dependencies e.g. mix app.tree (default)
def project do
  [ app: :my_app,
  version: "0.0.1",
  deps: deps,
  dialyzer: [plt_add_deps: :apps_direct, plt_add_apps: :wx]

You can also configure applications to include in the PLT more directly:

  • dialyzer: :plt_add_apps - applications to include in addition to the core applications and project dependencies.

  • dialyzer: :plt_apps - a list of applications to include that will replace the default, include all the apps you need e.g.

Other Configuration

  • dialyzer: :plt_file - Deprecated - specify the plt file name to create and use - default is to create one in the project’s current build environmnet (e.g. _build/dev/) specific to the Erlang/Elixir version used. Note that use of this key in version 0.4 or later will produce a deprecation warning - you can silence the warning by providing a pair with key :no_warn e.g. plt_file: {:no_warn,"filename"}.

  • dialyzer: :plt_core_path - specify an alternative to MIX_HOME to use to store the Erlang and Elixir core files.

  • dialyzer: :ignore_warnings - specify file path to filter well-known warnings.



Callback implementation for Mix.Task.run/1


dependency_hash :: {[atom], binary}

Callback implementation for Mix.Task.run/1.