unnecessary-round (RUF057)
Fix is always available.
This rule is unstable and in preview. The --preview
flag is required for use.
What it does
Checks for round()
calls that have no effect on the input.
Why is this bad?
Rounding a value that's already an integer is unnecessary. It's clearer to use the value directly.
Example
Use instead:
Fix safety
The fix is marked unsafe if it is not possible to guarantee that the first argument of
round()
is of type int
, or if the fix deletes comments.