summaryrefslogblamecommitdiffstats
path: root/docs/en/erlang.mk/1/guide/dialyzer/index.html
blob: 8846ff609dd3bea1c65625400206a666af9e5b99 (plain) (tree)














































































































































































































                                                                                                                                                                                                                           
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Loïc Hoguin based on a design from (Soft10) Pol Cámara">

    <meta name="generator" content="Hugo 0.15" />

    <title>Nine Nines: Dialyzer</title>

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,400italic' rel='stylesheet' type='text/css'>
	
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/99s.css" rel="stylesheet">

    <link rel="shortcut icon" href="/img/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="/img/ico/apple-touch-icon-114.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="/img/ico/apple-touch-icon-72.png">
    <link rel="apple-touch-icon-precomposed" href="/img/ico/apple-touch-icon-57.png">

    
</head>


<body class="">
  <header id="page-head">
    <div id="topbar" class="container">
        <div class="row">
          <div class="span2">
            <h1 id="logo"><a href="/" title="99s">99s</a></h1>
          </div>
          <div class="span10">
            
            <div id="side-header">
              <nav>
                <ul>
                  <li><a title="Hear my thoughts" href="/articles">Articles</a></li>
  				  <li><a title="Watch my talks" href="/talks">Talks</a></li>
  				  <li class="active"><a title="Read the docs" href="/docs">Documentation</a></li>
  				  <li><a title="Request my services" href="/services">Consulting & Training</a></li>
                </ul>
              </nav> 
              <ul id="social">
                <li>
                  <a href="https://github.com/ninenines" title="Check my Github repositories"><img src="/img/ico_github.png" data-hover="/img/ico_github_alt.png" alt="Github"></a>
                </li>
                    <li>
						<a title="Keep in touch!" href="http://twitter.com/lhoguin"><img src="/img/ico_microblog.png" data-hover="/img/ico_microblog_alt.png"></a>
					</li>
                    <li>
						<a title="Contact me" href="mailto:[email protected]"><img src="/img/ico_mail.png" data-hover="/img/ico_mail_alt.png"></a>
					</li>
              </ul>
            </div>
          </div>
        </div>
    </div>


</header>

<div id="contents" class="two_col">
<div class="container">
<div class="row">
<div id="docs" class="span9 maincol">

<h1 class="lined-header"><span>Dialyzer</span></h1>

<div class="paragraph"><p>Dialyzer is a tool that will detect discrepancies in your
program. It does so using a technique known as success
typing analysis which has the advantage of providing no
false positives. Dialyzer is able to detect type errors,
dead code and more.</p></div>
<div class="paragraph"><p>Erlang.mk provides a wrapper around Dialyzer.</p></div>
<div class="sect1">
<h2 id="_how_it_works">How it works</h2>
<div class="sectionbody">
<div class="paragraph"><p>Dialyzer requires a PLT file to work. The PLT file contains
the analysis information from all applications which are not
expected to change, or rarely do. These would be all the
dependencies of the application or applications you are
currently working on, including standard applications in
Erlang/OTP itself.</p></div>
<div class="paragraph"><p>Dialyzer can generate this PLT file. Erlang.mk includes rules
to automatically generate the PLT file when it is missing.</p></div>
<div class="paragraph"><p>Once the PLT file is generated, Dialyzer can perform the
analysis in record time.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_configuration">Configuration</h2>
<div class="sectionbody">
<div class="paragraph"><p>In a typical usage scenario, no variable needs to be set.
The defaults should be enough. Do note however that the
dependencies need to be set properly using the <code>DEPS</code> and
<code>LOCAL_DEPS</code> variables.</p></div>
<div class="paragraph"><p>The <code>DIALYZER_PLT</code> file indicates where the PLT file will
be written to (and read from). By default this is
<em>$(PROJECT).plt</em> in the project&#8217;s directory. Note that
the <code>DIALYZER_PLT</code> variable is exported and is understood
by Dialyzer directly.</p></div>
<div class="paragraph"><p>The <code>PLT_APPS</code> variable can be used to add additional
applications to the PLT. You can either list application
names or paths to these applications.</p></div>
<div class="paragraph"><p>Erlang.mk defines two variables for specifying options
for the analysis: <code>DIALYZER_DIRS</code> and <code>DIALYZER_OPTS</code>.
The former one defines which directories should be part
of the analysis. The latter defines what extra warnings
Dialyzer should report.</p></div>
<div class="paragraph"><p>Note that Erlang.mk enables the race condition warnings
by default. As it can take considerably large resources
to run, you may want to disable it on larger projects.</p></div>
</div>
</div>
<div class="sect1">
<h2 id="_usage">Usage</h2>
<div class="sectionbody">
<div class="paragraph"><p>To perform an analysis, run the following command:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make dialyze</tt></pre></div></div>
<div class="paragraph"><p>This will create the PLT file if it doesn&#8217;t exist.</p></div>
<div class="paragraph"><p>The analysis will also be performed when you run the
following command, alongside tests:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
<pre><tt>$ make check</tt></pre></div></div>
<div class="paragraph"><p>You can use the <code>plt</code> target to create the PLT file if
it doesn&#8217;t exist. This is normally not necessary as
Dialyzer creates it automatically.</p></div>
<div class="paragraph"><p>The PLT file will be removed when you run <code>make distclean</code>.</p></div>
</div>
</div>



</div>

<div class="span3 sidecol">


<h3>
	Erlang.mk
	1
	
	User Guide
</h3>

<ul>
	
	
	
</ul>

<h4 id="docs-nav">Navigation</h4>

<h4>Version select</h4>
<ul>
	
	
	
		<li><a href="/docs/en/erlang.mk/1/guide">1</a></li>
	
</ul>

</div>
</div>
</div>
</div>

      <footer>
        <div class="container">
          <div class="row">
            <div class="span6">
              <p id="scroll-top"><a href="#">↑ Scroll to top</a></p>
              <nav>
                <ul>
                  <li><a href="mailto:[email protected]" title="Contact us">Contact us</a></li><li><a href="https://github.com/ninenines/ninenines.github.io" title="Github repository">Contribute to this site</a></li>
                </ul>
              </nav>
            </div>
            <div class="span6 credits">
               <p><img src="/img/footer_logo.png"></p>
               <p>Copyright &copy; Loïc Hoguin 2012-2016</p>
            </div>
          </div>
        </div>
      </footer>

    
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script src="/js/bootstrap-carousel.js"></script>
    <script src="/js/bootstrap-dropdown.js"></script>
    <script src="/js/custom.js"></script>
  </body>
</html>