WhatsApp / eqwalizer

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

ignore modules option #43

Open tsloughter opened 11 months ago

tsloughter commented 11 months ago

Using https://github.com/tomas-abrahamsson/gpb there is generated code like:

e_type_string(S, Bin, _TrUserData) ->
    Utf8 = unicode:characters_to_binary(S),
    Bin2 = e_varint(byte_size(Utf8), Bin),
    <<Bin2/binary, Utf8/binary>>.

Since unicode:characters_to_binary/1 can return an error or incomplete tuple the byte_size function call fails to type check.

With gradualizer I ignore these modules:

{gradualizer_opts, [{exclude_modules, [opentelemetry_exporter_trace_service_pb,
                                       opentelemetry_exporter_metrics_service_pb,
                                       opentelemetry_exporter_logs_service_pb,
                                       opentelemetry_zipkin_pb]}]}.

It'd be nice if eqwalizer had a similar option.

ilya-klyuchnikov commented 11 months ago

As pointed out in https://github.com/WhatsApp/eqwalizer/issues/37#issuecomment-1667601488 - we have recently released ELP which has more options and flexibility for running eqwalizer. And it does support ignoring modules via putting -eqwalizer(ignore). in the module's body.

tsloughter commented 11 months ago

Thanks I noticed ELP this morning and am actually trying it out.

But adding to a module body doesn't help here since the module is generated. I'd just put the %% eqwalizer:ignore if it wasn't a generated module.