ReplaceReturns#
Replace return statements (such as [Return]
setting or Return From Keyword
keyword) with new RETURN
statement.
Note
Required Robot Framework version: >=5.0
Transformer configuration
ReplaceReturns is included in the default transformers, but it can be also run separately with:
robotidy --transform ReplaceReturns src
You can also disable ReplaceReturns:
robotidy --configure ReplaceReturns:enabled=False src
This transformer replace [Return]
statement with RETURN
:
*** Keywords ***
Keyword
Sub Keyword
[Return] ${value}
*** Keywords ***
Keyword
Sub Keyword
RETURN ${value}
It also does replace Return From Keyword
and Return From Keyword If
:
*** Keywords ***
Keyword
Return From Keyword If $condition ${value}
Sub Keyword
Return From Keyword ${other_value}
*** Keywords ***
Keyword
IF $condition
RETURN ${value}
END
Sub Keyword
RETURN ${other_value}