The Dialyzer is a static analysis tool that identifies software discrepancies such as type errors, unreachable code, unnecessary tests, etc in single Erlang modules or entire (sets of) applications. Currently, Dialyzer starts its analysis for either BEAM bytecode or from Erlang source code and reports to its user the functions where the discrepancies occur and an indication of what the discrepancy is about. Dialyzer currently supports various modes of operation and its analysis is precise (in particular, there are no false positives) and quite fast.
Read more about Dialyzer and about how to use it from the GUI in Dialyzer User's Guide.
Dialyzer also has a command line version for automated use. Below is a brief description of the list of its options. The same information can be obtained by writing
dialyzer --help
in a shell. Please refer to the GUI description for more details on the operation of Dialyzer.
The exit status of the command line version is:
0 - No problems were encountered during the analysis and no warnings were emitted. 1 - Problems were encountered during the analysis. 2 - No problems were encountered, but warnings were emitted.
Usage:
dialyzer [--otp OTP_DIR] [--help] [--version] [--shell] [-pa dir]* [-plt plt] [-Ddefine]* [-I include_dir]* [--output_plt file] [-Wwarn]* [--src] [-c applications] [-r applications] [-o outfile] [-q]
Options:
-c applications
(or --command-line applications
)
.erl
or .beam
files)
-r applications
-c
only that directories are searched recursively for
subdirectories containing .erl
or .beam
files (depending on the
type of analysis)
-o outfile
(or --output outfile
)
outfile
rather than in stdout
--src
-Dname
(or -Dname=value
)
-I include_dir
include_dir
to Dialyzer (**)
--output_plt file
--no_warn_on_inline
-plt plt
-pa dir
dir
in the path for Erlang. Useful when analyzing files
that have -include_lib()
directives.
-Wwarn
dialyzer -Whelp
)
--check_init_plt
--otp OTP_DIR
--shell
--version (or -v)
--help (or -h)
-q
--verbose
* denotes that multiple occurrences of these options are possible. ** options |
Warning options:
-Wno_return
-Wno_unused
-Wno_improper_lists
-Wno_tuple_as_fun
-Wno_fun_app
-Wno_match
-Wno_comp
false
.
-Wno_guards
-Wno_unsafe_beam
-Werror_handling
***
*** This is the only option that turns on warnings rather than turning them off. |
You can also use Dialyzer directly from Erlang. Both the gui and the command line version is available. The options are similar to the ones given from the command line, so please refer to the sections above for a description of these.
gui() -> ok | {error, Msg}
gui(OptList) -> ok | {error, Msg}
Types:
OptList -- see below
Dialyzer GUI version.
OptList : [Option] Option : {files, [Filename : string()]} | {files_rec, [DirName : string()]} | {defines, [{Macro: atom(), Value : term()}]} | {from, src_code | byte_code} %% Defaults to byte_code | {init_plt, FileName : string()} %% If changed from default | {include_dirs, [DirName : string()]} | {output_file, FileName : string()} | {supress_inline, bool()} %% Defaults to true | {warnings, [WarnOpts]} WarnOpts : no_return | no_unused | no_improper_lists | no_tuple_as_fun | no_fun_app | no_match | no_comp | no_guards | no_unsafe_beam | no_fail_call | error_handling
run(OptList) -> {ok, Warnings, Errors} | {ok, Warnings}
| {error, Message}
Types:
OptList -- see gui/0,1
Warnings = [{MFA, string()}]
MFA = {Module, Function, Arity}
Module = Function = atom()
Arity = int()
Errors = string()
Message = string()
Dialyzer command line version.