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  un‐
37       less you have written your own Erlang compiler.
38

DATA TYPES

40       error_info() =
41           {erl_anno:location() | none, module(), error_description()}
42
43       error_description() = term()
44

EXPORTS

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

ERROR INFORMATION

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

SEE ALSO

123       epp(3), erl_parse(3)
124
125
126
127Ericsson AB                     stdlib 4.3.1.3                     erl_lint(3)
Impressum