WhatsApp / eqwalizer

A type-checker for Erlang
Apache License 2.0
506 stars 27 forks source link

Doc improvements for non-rebar builds? #44

Closed Olivier-Boudeville closed 10 months ago

Olivier-Boudeville commented 11 months ago

Hi,

Thanks for this interesting tool!

When reading https://github.com/WhatsApp/eqwalizer#using-it-with-non-rebar-projects (with Erlang 26.1) I have been a bit confused by:

At least if no relevant eqwalizer dependency is listed in the conf file, no error is found afterwards, whereas a ebin full of BEAM files with certainly many type errors was specified:

~/Software/eqwalizer/bin/elp eqwalize-all --project ./conf/xxx-for-eqwalizer.json
Loading JSON manifest  

Loading applications      ████████████████████ 1/1                                                                                                                   Seeding database                                                                                                                                                     
Compiling dependencies                                                                                                                                               
eqWAlizing                ████████████████████ 0/0                                                                                                                  NO ERRORS

(if it is due to no proper eqwalizer or eqwalizer_support being specified in the conf file, then maybe a check could be made and an error be raised?)

For more information, here is the very basic conf/xxx-for-eqwalizer.json file (a version of it without eqwalizer-related app/dep; slightly edited):

{

    "apps": [

        {   "name": "xxxx",

            "__comment": "Relative to project root:",
            "dir": ".",

            "__comment": "Not wanting the tool to operate on sources, but on BEAMs: (relative to app dir)",
            "src_dirs": [ "src" ],

            "__comment": "(relative to app dir)",
            "extra_src_dirs": [],

            "__comment": "A single path, not a list thereof  (relative to app dir)",
            "ebin": "ebin",

            "__comment": "Symlinks to all .hrl there: (relative to app dir)",
            "include_dirs": [ "include" ],

            "macros": []
        }

    ],

    "root": "."
}

On a side note, maybe I missed it in the doc, but it would be interesting to state whether eqwalizer relies on the BEAMs and/or on the source files to operate; I expected the BEAMs (which is fine, notably if user code uses very custom-built, possibly with parse transforms), as the app's ebin directory has to be specified, but on the other hand src_dirs may/must be specified as well.

VLanvin commented 10 months ago

You're right, the part about having eqwalizer_support ebin dir populated with BEAM files is a leftover from the rebar section.

To clarify several points here:

I'll clarify/add this info to the docs. Thanks for the feedback!

Olivier-Boudeville commented 10 months ago

Thanks for your answer! Even if due to parse-transforms I am more fond of tools operating on BEAM files, I will surely give Eqwalizer a try in the future. I close this issue, thanks again for your feedback!