dialyzer(3)

MODULE
dialyzer - The Dialyzer, a DIscrepancy AnalYZer for ERlang programs

DESCRIPTION

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 from 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.

USING THE DIALYZER FROM THE COMMAND LINE

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 [--help] [--version] [--shell] [--quiet] [--verbose]
               [-pa dir]* [-plt plt] [-Ddefine]* [-I include_dir]*
               [--output_plt file] [-Wwarn]*  [--src]
               [-c applications] [-r applications] [-o outfile]

Options:

    -c applications(or --command-line applications):
        use Dialyzer from the command line (no GUI) to detect defects in the specified applications (directories or .erl or .beam files)

    -r applications:
        same as -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):
        when using Dialyzer from the command line, send the analysis results in the specified outfile rather than in stdout

    --src:
        overwrite the default, which is to analyze BEAM bytecode, and analyze starting from Erlang source code instead

    -Dname(or -Dname=value):
        when analyzing from source, pass the define to Dialyzer (**)

    -I include_dir:
        when analyzing from source, pass the include_dir to Dialyzer (**)

    -pa dir:
        Include dir in the path for Erlang. Useful when analyzing files that have -include_lib() directives.

    --output_plt file:
        Store the plt at the specified location after building it.

    --no_warn_on_inline:
        Suppress warnings when analyzing an inline compiled bytecode file.

    -plt plt:
        Use the specified plt as the initial plt. If the plt was built during setup the files will be checked for consistency.

    -Wwarn:
        a family of option which selectively turn on/off warnings. (for help on the names of warnings use dialyzer -Whelp)

    --check_init_plt:
        Only checks if the init plt is up to date. For installed systems this also forces the rebuilding of the plt if this is not the case.

    --shell:
        do not disable the Erlang shell while running the GUI

    --version (or -v):
        prints the Dialyzer version and some more information and exits

    --help (or -h):
        prints this message and exits

    --quiet (or -q):
        makes Dialyzer a bit more quiet

    --verbose:
        makes Dialyzer a bit more verbose

    --dataflow:
        Makes Dialyzer use dataflow analysis to find discrepancies. (Default)

    --succ_typings:
        Makes Dialyzer use success typings to find discrepancies.

  Note:

* denotes that multiple occurrences of these options are possible.

** options -D and -I work both from command-line and in the Dialyzer GUI; the syntax of defines and includes is the same as that used by erlc.

Warning options:

    -Wno_return:
        Suppress warnings for functions of no return.

    -Wno_unused:
        Suppress warnings for unused functions.

    -Wno_improper_lists:
        Suppress warnings for construction of improper lists.

    -Wno_tuple_as_fun:
        Suppress warnings for using tuples instead of funs.

    -Wno_fun_app:
        Suppress warnings for fun applications that will fail.

    -Wno_match:
        Suppress warnings for pattern matching operations that will never succeed.

    -Wno_comp:
        Suppress warnings for term comparisons that will always return false.

    -Wno_guards:
        Suppress warnings for guards that will always fail.

    -Wno_unsafe_beam:
        Suppress warnings for unsafe BEAM code produced by an old BEAM compiler.

    -Werror_handling***:
        Include warnings for functions that only return by means of an exception.

  Note:

*** This is the only option that turns on warnings rather than turning them off.

USING THE DIALYZER FROM ERLANG

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.

EXPORTS

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.