[erlang-questions] Attempting to use erl_lint on a .erl source file

Sparr sparr0@REDACTED
Thu Dec 17 19:45:13 CET 2015

I'm trying to use erl_lint() to build a simple Erlang syntax and style
checker. I've gotten far enough to load the file and parse it into Forms
and to get erl_lint to partially understand it, but then erl_lint complains
about undefined functions that are defined. What am I doing wrong?

erlint.erl :


    % based on http://stackoverflow.com/a/28086396/13675

    lint(File) ->
        {ok, B} = file:read_file(File),
        Forms = scan(erl_scan:tokens([],binary_to_list(B),1),[]),
        F = fun(X) -> {ok,Y} = erl_parse:parse_form(X), Y end,
        erl_lint:module([F(X) || X <- Forms],File).

    scan({done,{ok,T,N},S},Res) ->
    scan(_,Res) ->

hello.erl :


    hello_world() -> io:fwrite("hello, world\n").

attempt to use :

    1> c(erlint).
    2> erlint:lint("hello.erl").

PS: This is a cross post after posting on reddit and stackoverflow.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151217/05f62cf8/attachment.htm>

More information about the erlang-questions mailing list