ReplaceReturns¶
Replace return statements (such as [Return]
setting or Return From Keyword
keyword) with new RETURN
statement.
Note
Required Robot Framework version: >=5.0
Formatter configuration
ReplaceReturns is included in the default formatters, but it can be also run separately with:
robocop format --select ReplaceReturns
You can also disable ReplaceReturns:
robocop format --configure ReplaceReturns.enabled=False
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}