Dialyxir v1.0.0 mix dialyzer View Source
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.
--no-compile- do not compile even if needed.
--no-check- do not perform (quick) check to see if PLT needs update.
--force-check- force PLT check also if lock file is unchanged. useful when dealing with local deps.
--ignore-exit-status- display warnings but do not halt the VM or return an exit status code
--list-unused-filters- list unused ignore filters useful for CI. do not use with
--plt- only build the required plt(s) and exit.
--format short- format the warnings in a compact format.
--format raw- format the warnings in format returned before Dialyzer formatting
--format dialyxir- format the warnings in a pretty printed format
--format dialyzer- format the warnings in the original Dialyzer format
--quiet- suppress all informational messages
Warning flags passed to this task are passed on to
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 either 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]] ] end
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:
- :apps_direct - Only Direct OTP runtime application dependencies - not the entire tree
- :app_tree - Transitive OTP runtime application dependencies e.g.
def project do [ app: :my_app, version: "0.0.1", deps: deps, dialyzer: [plt_add_deps: :apps_direct, plt_add_apps: [:wx]] ] end
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_ignore_apps- applications to ignore from the list of core applications and dependencies.
dialyzer: :plt_apps- a list of applications to include that will replace the default, include all the apps you need e.g.
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.
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.