inaka / elvis

Erlang Style Reviewer
Apache License 2.0
426 stars 87 forks source link

There's no ignore option for the `state_record_and_type` rule #551

Closed NAR closed 3 years ago

NAR commented 3 years ago

It is not possible to ignore the warnings from the state_record_and_type rule, the code does not check for the ignore option. It would be really cool if I could suppress this warning :-)

elbrujohalcon commented 3 years ago

Have you tried adding the following attribute to your module(s)?

-elvis([{elvis_style, state_record_and_type, disable}]).
NAR commented 3 years ago

Now I tried, but still get the error. This is my source file:

-module(lint_bug).
-elvis([{elvis_style, state_record_and_type, disable}]).

-behavior(gen_server).

-export([handle_call/3, handle_cast/2, init/1]).

handle_call(_, _, _) ->
  {reply, ok, []}.

handle_cast(_, _) ->
  {noreply, []}.

init(_) ->
  {ok, []}.
NAR commented 3 years ago

I have to add I'm using elvis through the rebar3_lint plugin, I need to check if using elvis directly works or not...

elbrujohalcon commented 3 years ago

I can confirm this is a bug. Thanks for reporting, @NAR

elbrujohalcon commented 3 years ago

@paulo-ferraz-oliveira / @Licenser : Can it be that rebar3_lint is still using an old version of elvis_core? Maybe one without support for -elvis or the generic ignore property?

elbrujohalcon commented 3 years ago

Yeah… I think that's it! We need a new release of elvis_core. Stay tuned, @NAR … I'll coordinate with @paulo-ferraz-oliveira and @Licenser and let you know.

paulo-ferraz-oliveira commented 3 years ago

Yes, I would say that master elvis_core fixes that, but since it's not had a release, so hasn't rebar3_lint. I was in the middle of finishing something for elvis_core, rebased some stuff and got stuck with an unusable version :-) but master is OK to release, if @elbrujohalcon's OK with this.

In the meantime could you check if the behavior persists by forcing (via either rebar.config or rebar.lock) the latest commit on elvis_core?

paulo-ferraz-oliveira commented 3 years ago

@paulo-ferraz-oliveira / @Licenser : Can it be that rebar3_lint is still using an old version of elvis_core? Maybe one without support for -elvis or the generic ignore property?

This is correct. Support for both the directive and the generic ignore is not released (or published to Hex.pm) in either elvis_core or rebar3_lint.

paulo-ferraz-oliveira commented 3 years ago

Also related: check https://github.com/inaka/elvis_core/blob/master/test/examples/pass_state_record_and_type_elvis_attr.erl (what @elbrujohalcon was referring to).

NAR commented 3 years ago

With the latest elvis_core the

-elvis([{elvis_style, state_record_and_type, disable}]).

line suppresses the warning, I can confirm that. I could only test with elvis and not with the rebar3_lint plugin, but elvis worked with the master version of elvis_core (didn't suppress the warning with 0.6.0 though).

elbrujohalcon commented 3 years ago

Alright… I'll see if I can cut a release of elvis_core next Monday.

elbrujohalcon commented 3 years ago

Aaaaand… project-fifo/rebar3_lint#19

paulo-ferraz-oliveira commented 3 years ago

@NAR, I'm closing this since it's only a matter of releasing rebar3_lint for your issue to be fixed. Let us know if further issues come up.