1erl_lint(3)                Erlang Module Definition                erl_lint(3)
2
3
4

NAME

6       erl_lint - The Erlang code linter.
7

DESCRIPTION

9       This  module  is used to check Erlang code for illegal syntax and other
10       bugs. It also warns against coding practices that are not recommended.
11
12       The errors detected include:
13
14         * Redefined and undefined functions
15
16         * Unbound and unsafe variables
17
18         * Illegal record use
19
20       The warnings detected include:
21
22         * Unused functions and imports
23
24         * Unused variables
25
26         * Variables imported into matches
27
28         * Variables exported from if/case/receive
29
30         * Variables shadowed in funs and list comprehensions
31
32       Some of the warnings are optional, and can be turned on  by  specifying
33       the appropriate option, described below.
34
35       The  functions  in  this module are invoked automatically by the Erlang
36       compiler. There is no  reason  to  invoke  these  functions  separately
37       unless you have written your own Erlang compiler.
38

DATA TYPES

40       error_info() = {erl_anno:line(), module(), error_description()}
41
42       error_description() = term()
43

EXPORTS

45       format_error(ErrorDescriptor) -> io_lib:chars()
46
47              Types:
48
49                 ErrorDescriptor = error_description()
50
51              Takes an ErrorDescriptor and returns a string that describes the
52              error or warning. This function  is  usually  called  implicitly
53              when processing an ErrorInfo structure (see section Error Infor‐
54              mation).
55
56       is_guard_test(Expr) -> boolean()
57
58              Types:
59
60                 Expr = erl_parse:abstract_expr()
61
62              Tests if Expr is a legal guard test. Expr is an Erlang term rep‐
63              resenting    the    abstract    form    for    the   expression.
64              erl_parse:parse_exprs(Tokens) can be used to generate a list  of
65              Expr.
66
67       module(AbsForms) -> {ok, Warnings} | {error, Errors, Warnings}
68
69       module(AbsForms, FileName) ->
70                 {ok, Warnings} | {error, Errors, Warnings}
71
72       module(AbsForms, FileName, CompileOptions) ->
73                 {ok, Warnings} | {error, Errors, Warnings}
74
75              Types:
76
77                 AbsForms         =        [erl_parse:abstract_form()        |
78                 erl_parse:form_info()]
79                 FileName = atom() | string()
80                 CompileOptions = [compile:option()]
81                 Warnings = [{file:filename(), [ErrorInfo]}]
82                 Errors = [{FileName2 :: file:filename(), [ErrorInfo]}]
83                 ErrorInfo = error_info()
84
85              Checks all the forms in a module for errors. It returns:
86
87                {ok,Warnings}:
88                  There are no errors in the module.
89
90                {error,Errors,Warnings}:
91                  There are errors in the module.
92
93              As this module is of interest only to  the  maintainers  of  the
94              compiler,  and  to avoid the same description in two places, the
95              elements of Options that control the warnings are only described
96              in the compile(3) module.
97
98              AbsForms  of  a  module,  which  comes  from a file that is read
99              through epp, the Erlang preprocessor, can come from many  files.
100              This  means that any references to errors must include the file‐
101              name, see the epp(3) module or parser (see the erl_parse(3) mod‐
102              ule).  The  returned errors and warnings have the following for‐
103              mat:
104
105              [{FileName2,[ErrorInfo]}]
106
107              The errors and warnings are listed in the order  in  which  they
108              are  encountered  in  the  forms.  The  errors from one file can
109              therefore be split into different entries in the list of errors.
110

ERROR INFORMATION

112       ErrorInfo is the standard ErrorInfo structure that is returned from all
113       I/O modules. The format is as follows:
114
115       {ErrorLine, Module, ErrorDescriptor}
116
117       A string describing the error is obtained with the following call:
118
119       Module:format_error(ErrorDescriptor)
120

SEE ALSO

122       epp(3), erl_parse(3)
123
124
125
126Ericsson AB                      stdlib 3.12.1                     erl_lint(3)
Impressum