Credo.Check.Warning.OperationWithConstantResult (Credo v1.5.0-rc.5) View Source

This check has a base priority of high and works with any version of Elixir.

Explanation

Some numerical operations always yield the same result and therefore make little sense in production code.

Examples:

x * 1   # always returns x
x * 0   # always returns 0

In practice they are likely the result of a debugging session or were made by mistake.

Configuration parameters

There are no parameters for this check.

Link to this section Summary

Link to this section Functions

Link to this function

do_run_on_source_file(exec, source_file, params)

View Source