diff options
Diffstat (limited to 'lib/stdlib/doc/src/erl_lint.xml')
-rw-r--r-- | lib/stdlib/doc/src/erl_lint.xml | 147 |
1 files changed, 77 insertions, 70 deletions
diff --git a/lib/stdlib/doc/src/erl_lint.xml b/lib/stdlib/doc/src/erl_lint.xml index 3747b0f3c3..77cb7a9916 100644 --- a/lib/stdlib/doc/src/erl_lint.xml +++ b/lib/stdlib/doc/src/erl_lint.xml @@ -28,39 +28,45 @@ <docno>1</docno> <approved>Bjarne Däcker</approved> <checked></checked> - <date>97-01-27</date> + <date>1997-01-27</date> <rev>B</rev> - <file>erl_lint.sgml</file> + <file>erl_lint.xml</file> </header> <module>erl_lint</module> - <modulesummary>The Erlang Code Linter</modulesummary> + <modulesummary>The Erlang code linter.</modulesummary> <description> <p>This module is used to check Erlang code for illegal syntax and - other bugs. It also warns against coding practices which are - not recommended. </p> + other bugs. It also warns against coding practices that are + not recommended.</p> + <p>The errors detected include:</p> + <list type="bulleted"> - <item>redefined and undefined functions</item> - <item>unbound and unsafe variables</item> - <item>illegal record usage.</item> + <item>Redefined and undefined functions</item> + <item>Unbound and unsafe variables</item> + <item>Illegal record use</item> </list> - <p>Warnings include:</p> + + <p>The warnings detected include:</p> + <list type="bulleted"> - <item>unused functions and imports</item> - <item>unused variables</item> - <item>variables imported into matches</item> - <item>variables exported from - <c>if</c>/<c>case</c>/<c>receive</c></item> - <item>variables shadowed in lambdas and list - comprehensions.</item> + <item>Unused functions and imports</item> + <item>Unused variables</item> + <item>Variables imported into matches</item> + <item>Variables exported from + <c>if</c>/<c>case</c>/<c>receive</c></item> + <item>Variables shadowed in funs and list comprehensions</item> </list> + <p>Some of the warnings are optional, and can be turned on by - giving the appropriate option, described below.</p> + specifying the appropriate option, described below.</p> + <p>The functions in this module are invoked automatically by the - Erlang compiler and there is no reason to invoke these + Erlang compiler. There is no reason to invoke these functions separately unless you have written your own Erlang compiler.</p> </description> + <datatypes> <datatype> <name name="error_info"/> @@ -69,86 +75,87 @@ <name name="error_description"/> </datatype> </datatypes> + <funcs> <func> + <name name="format_error" arity="1"/> + <fsummary>Format an error descriptor.</fsummary> + <desc> + <p>Takes an <c><anno>ErrorDescriptor</anno></c> and returns a string + that describes the error or warning. This function is usually + called implicitly when processing an <c>ErrorInfo</c> structure + (see section + <seealso marker="#errorinfo">Error Information</seealso>).</p> + </desc> + </func> + + <func> + <name name="is_guard_test" arity="1"/> + <fsummary>Test for a guard test.</fsummary> + <desc> + <p>Tests if <c><anno>Expr</anno></c> is a legal guard test. + <c><anno>Expr</anno></c> is an Erlang term representing the abstract + form for the expression. <seealso marker="erl_parse#parse_exprs/1"> + <c>erl_parse:parse_exprs(Tokens)</c></seealso> + can be used to generate a list of <c><anno>Expr</anno></c>.</p> + </desc> + </func> + + <func> <name name="module" arity="1"/> <name name="module" arity="2"/> <name name="module" arity="3"/> - <fsummary>Check a module for errors</fsummary> + <fsummary>Check a module for errors.</fsummary> <desc> - <p>This function checks all the forms in a module for errors. - It returns: - </p> + <p>Checks all the forms in a module for errors. It returns:</p> <taglist> <tag><c>{ok,<anno>Warnings</anno>}</c></tag> <item> - <p>There were no errors in the module.</p> + <p>There are no errors in the module.</p> </item> <tag><c>{error,<anno>Errors</anno>,<anno>Warnings</anno>}</c></tag> <item> - <p>There were errors in the module.</p> + <p>There are errors in the module.</p> </item> </taglist> - <p>Since this module is of interest only to the maintainers of - the compiler, and to avoid having the same description in - two places to avoid the usual maintenance nightmare, the + <p>As this module is of interest only to the maintainers of the + compiler, and to avoid the same description in two places, the elements of <c>Options</c> that control the warnings are - only described in <seealso marker="compiler:compile#erl_lint_options">compile(3)</seealso>. - </p> - <p>The <c><anno>AbsForms</anno></c> of a module which comes from a file - that is read through <c>epp</c>, the Erlang pre-processor, - can come from many files. This means that any references to - errors must include the file name (see <seealso marker="epp">epp(3)</seealso>, or parser <seealso marker="erl_parse">erl_parse(3)</seealso>). - The warnings and errors returned have the following format: - </p> + only described in the + <seealso marker="compiler:compile#erl_lint_options"> + <c>compile(3)</c></seealso> module.</p> + <p><c><anno>AbsForms</anno></c> of a module, which comes from a file + that is read through <c>epp</c>, the Erlang preprocessor, can come + from many files. This means that any references to errors must + include the filename, see the <seealso marker="epp"> + <c>epp(3)</c></seealso> module or parser (see the + <seealso marker="erl_parse"><c>erl_parse(3)</c></seealso> module). + The returned errors and warnings have the following format:</p> <code type="none"> - [{<anno>FileName2</anno>,[<anno>ErrorInfo</anno>]}] </code> - <p>The errors and warnings are listed in the order in which - they are encountered in the forms. This means that the - errors from one file may be split into different entries in - the list of errors.</p> - </desc> - </func> - <func> - <name name="is_guard_test" arity="1"/> - <fsummary>Test for a guard test</fsummary> - <desc> - <p>This function tests if <c><anno>Expr</anno></c> is a legal guard test. - <c><anno>Expr</anno></c> is an Erlang term representing the abstract form - for the expression. <c>erl_parse:parse_exprs(Tokens)</c> can - be used to generate a list of <c><anno>Expr</anno></c>.</p> - </desc> - </func> - <func> - <name name="format_error" arity="1"/> - <fsummary>Format an error descriptor</fsummary> - <desc> - <p>Takes an <c><anno>ErrorDescriptor</anno></c> and returns a string which - describes the error or warning. This function is usually - called implicitly when processing an <c>ErrorInfo</c> - structure (see below).</p> +[{<anno>FileName2</anno>,[<anno>ErrorInfo</anno>]}]</code> + <p>The errors and warnings are listed in the order in which they are + encountered in the forms. The errors from one file can therefore be + split into different entries in the list of errors.</p> </desc> </func> </funcs> <section> + <marker id="errorinfo"/> <title>Error Information</title> - <p>The <c>ErrorInfo</c> mentioned above is the standard - <c>ErrorInfo</c> structure which is returned from all IO - modules. It has the following format: - </p> + <p><c>ErrorInfo</c> is the standard <c>ErrorInfo</c> structure that is + returned from all I/O modules. The format is as follows:</p> <code type="none"> - {ErrorLine, Module, ErrorDescriptor} </code> - <p>A string which describes the error is obtained with the following call: - </p> +{ErrorLine, Module, ErrorDescriptor}</code> + <p>A string describing the error is obtained with the following call:</p> <code type="none"> - Module:format_error(ErrorDescriptor) </code> +Module:format_error(ErrorDescriptor)</code> </section> <section> <title>See Also</title> - <p><seealso marker="erl_parse">erl_parse(3)</seealso>, - <seealso marker="epp">epp(3)</seealso></p> + <p><seealso marker="epp"><c>epp(3)</c></seealso>, + <seealso marker="erl_parse"><c>erl_parse(3)</c></seealso></p> </section> </erlref> |