Skip to content

v2.3.0

Choose a tag to compare

@dannote dannote released this 11 May 10:15
· 124 commits to master since this release

New smell checks

  • Repeated traversal — same variable traversed by 2+ different Enum functions (e.g. Enum.max(list) + Enum.min(list)); suggests Enum.reduce/3.
  • Nested enumEnum.member?/2 nested inside Enum.map/filter/etc on the same variable (O(n²)); suggests MapSet.
  • Multiple Enum.at — 3+ Enum.at/2 calls on the same variable with literal indices; suggests pattern matching.
  • Append in recursion++ [item] in recursive tail calls (O(n²)); suggests prepend + reverse.
  • Piped Regex.replacetext |> Regex.replace(~r/.../, "") where the pipe puts the string in the regex position; uses the new ExAST piped() predicate to avoid false positives on direct calls.

New pattern smells

  • Map.keys/valuesEnum.join/uniq/count/length/member?/sum/max/min
  • List.foldr/3, Enum.min_by/max_by/dedup_by with identity fn
  • Enum.filter |> Enum.filter, Enum.map |> List.flatten/Enum.flat_map
  • Enum.sort/2 |> Enum.reverse, Enum.with_index |> Enum.reduce
  • Enum.map_join(_, "", _) redundant separator
  • Integer.to_string |> String.graphemes, length(String.split) - 1, Enum.at(list, -1)

Other

  • Parser warning suppression via emit_warnings: false
  • ex_ast bumped to ~> 0.11.1
  • Corpus-tested against 200 top Hex packages: 0 crashes, 0 false positives