Skip to content

Commit

Permalink
Add opaque state as a type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
belltoy committed Aug 15, 2024
1 parent 3e327ef commit 989f870
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/elvis_style.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1834,7 +1834,9 @@ has_state_record(Root) ->
-spec has_state_type(ktn_code:tree_node()) -> boolean().
has_state_type(Root) ->
IsStateType =
fun(Node) -> (type_attr == ktn_code:type(Node)) and (state == ktn_code:attr(name, Node))
fun(Node) ->
TypeOrOpaque = (type_attr == ktn_code:type(Node)) or (opaque == ktn_code:type(Node)),
TypeOrOpaque and (state == ktn_code:attr(name, Node))
end,
elvis_code:find(IsStateType, Root) /= [].

Expand Down

0 comments on commit 989f870

Please sign in to comment.