ReplaceBreakContinue#
Replace Continue For Loop
and Exit For Loop
keyword variants with CONTINUE
and BREAK
statements.
Note
Required Robot Framework version: >=5.0
Transformer configuration
ReplaceBreakContinue is included in the default transformers, but it can be also run separately with:
robotidy --transform ReplaceBreakContinue src
You can also disable ReplaceBreakContinue:
robotidy --configure ReplaceBreakContinue:enabled=False src
It will replace Continue For Loop
and Exit For Loop
keywords with CONTINUE
and BREAK
respectively:
*** Test Cases ***
Test
WHILE $flag
Continue For Loop
END
FOR ${var} IN abc
Exit For Loop
END
*** Test Cases ***
Test
WHILE $flag
CONTINUE
END
FOR ${var} IN abc
BREAK
END
Conditional variants are also handled. Shorter IFs can be also formatted to inline IF
with InlineIf transformer:
*** Test Cases ***
Test
WHILE $flag
Continue For Loop If $condition
END
FOR ${var} IN abc
Exit For Loop If $condition
END
*** Test Cases ***
Test
WHILE $flag
IF $condition
CONTINUE
END
END
FOR ${var} IN abc
IF $condition
BREAK
END
END
Continue For Loop
and Exit For Loop
along with conditional variants outside of the loop are ignored.