ReplaceRunKeywordIfΒΆ

Replace Run Keyword If keyword calls with IF expressions.

ReplaceRunKeywordIf is included in the default transformers but it can be also run separately with:

robotidy --transform ReplaceRunKeywordIf src
*** Keywords ***
Keyword
    Run Keyword If  ${condition}
    ...  Keyword  ${arg}
    ...  ELSE IF  ${condition2}  Keyword2
    ...  ELSE  Keyword3

Any return value will be applied to every ELSE/ELSE IF branch.

*** Keywords ***
Keyword
    ${var}  Run Keyword If  ${condition}  Keyword  ELSE  Keyword2

Run Keywords inside Run Keyword If will be split into separate keywords.

*** Keywords ***
Keyword
    Run Keyword If  ${condition}  Run Keywords  Keyword  ${arg}  AND  Keyword2

Run Keyword If that assigns values but does not provide default branch will receive ELSE branch with Set Variable:

*** Keywords ***
Keyword
    ${var}  Run Keyword If  ${condition}  Keyword

Supports global formatting params: --spacecount, --startline and --endline.