Credence.Rule.NoMapAsSet (credence v0.2.0)

Copy Markdown

Style rule: Detects using a Map with boolean literal values (true/false) purely for membership tracking, when MapSet is more appropriate.

Map.put(seen, item, true) paired with Map.has_key?(seen, item) is a manual reimplementation of MapSet.put/2 and MapSet.member?/2. Using MapSet makes the intent clearer and avoids storing meaningless values.

Bad

{Map.put(seen, item, true), [item | acc]}

Good

{MapSet.put(seen, item), [item | acc]}