Credence.Pattern.NoMultiplyByOnePointZero
(credence v0.4.2)
Copy Markdown
Detects expr * 1.0 used to coerce an integer result to a float.
This is a Python idiom (int * 1.0 produces a float) that LLMs carry
over to Elixir. In Elixir, * 1.0 is a no-op — it does not change the
runtime type the way it does in Python. If a float result is needed,
Elixir's / operator always returns a float naturally.
Bad
Enum.at(sorted_list, mid) * 1.0
count * 1.0
count = count * 1.0Good
Enum.at(sorted_list, mid)
count
# (self-assignment line removed entirely)Auto-fix
Removes the * 1.0 (or 1.0 *) from the expression. When the entire
line is a no-op self-assignment (var = var * 1.0), the line is deleted.