Closed rlipscombe closed 4 days ago
š
Should it pertain only to cases where the function is called explicitly?
I'm thinking you can do
M = ets,
M:fun2ms(_)
in which case it would be harder to detect. Or even if using apply
, for example...
We can add a flag, likeā¦ method :: aggressive | naive
.
With naive
(the default), Elvis will only emit a warning if it finds ets:fun2ms
and no include for ms_transform.hrl
.
With aggressive
, Elvis will emit a warning if it finds the atom fun2ms
somewhere in the code and no include for ms_transform.hrl
.
The parse transform only works on explicit calls to ets:fun2ms and dbg:fun2ms, based on a (very) brief skim of the code, so I don't see the need for complicating it beyond that.
See https://github.com/erlang/otp/blob/OTP-25.2/lib/stdlib/src/ms_transform.erl#L394-L399
Using ets:fun2ms without including ms_transform.hrl raises a runtime error, rather than a compile error:
Describe the solution you'd like
If elvis could spot this, and raise an error, that'd save some headaches. I understand that it probably can't be exhaustive, but it'd be nice.