# src/x.erl [FAIL]
- export_used_types (https://github.com/inaka/elvis_core/tree/main/doc_rules/elvis_style/export_used_types.md)
- Type state/0, defined on line 7, is used by an exported function but not exported itself
Expected Behavior
No warnings.
Proposed Solution
We already faced a similar issue in rebar3_hank. Until erlang/otp#4847 is dealt with and we get the ability to specify dynamic callbacks, Elvis should avoid emitting this type of warning for types used in exported functions of modules implementing a behavior.
It may be slightly smarter and (just like hank) use the fact that some behaviors (like gen_server) are well-known and they don't have dynamic callbacks.
Bug Description
In the module I'm showing below, Elvis will ask me to export the
state/0
type. That's not a good idea.To Reproduce
Run Elvis on this module:
You'll get…
Expected Behavior
No warnings.
Proposed Solution
We already faced a similar issue in
rebar3_hank
. Until erlang/otp#4847 is dealt with and we get the ability to specify dynamic callbacks, Elvis should avoid emitting this type of warning for types used in exported functions of modules implementing a behavior. It may be slightly smarter and (just like hank) use the fact that some behaviors (likegen_server
) are well-known and they don't have dynamic callbacks.