credo icon indicating copy to clipboard operation
credo copied to clipboard

Add Warning Check to Evaluate Total Field amount in Structs

Open mgmilton opened this issue 1 year ago • 1 comments

This PR introduces a new Warning Check that evaluates structs to check to see if they contain a reasonable number of fields. Structs are stored as flat maps if they have fewer than 32 fields. However, the Erlang VM stores structs with greater than 32 fields as hash maps. This can potentially lead to bloating and higher memory usage.

Structs with more than 32 fields are considered an anti-pattern in the official Elixir documentation.

mgmilton avatar Feb 20 '25 23:02 mgmilton

Hi, I like the idea behind this check.

Will try to review as soon as I can 👍

rrrene avatar Feb 22 '25 05:02 rrrene