From 989f8708fb477212bcaf881a05584f367e0f3518 Mon Sep 17 00:00:00 2001 From: belltoy Date: Thu, 15 Aug 2024 22:01:07 +0800 Subject: [PATCH] Add opaque state as a type declaration --- src/elvis_style.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/elvis_style.erl b/src/elvis_style.erl index 5329914d..e1442e39 100644 --- a/src/elvis_style.erl +++ b/src/elvis_style.erl @@ -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) /= [].