Find division by zero

Proprietary

Finds divisions and remainders, including /=, %= and the divide, remainder and divideAndRemainder methods of BigInteger and BigDecimal, whose divisor can be zero: a zero literal, a final field initialized to zero, a local variable whose last assignment before the division can give zero, as on one branch of a conditional, or a variable just checked to be zero. An integer division by zero throws an ArithmeticException. A variable compared with anything between that assignment and the division, or in the condition of a loop around it, is left alone, since the check may rule zero out. Test sources are not searched.

io.moderne.staticanalysis.FindDivisionByZero
mod run . --recipe=io.moderne.staticanalysis.FindDivisionByZero

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.