robotframework-tidy icon indicating copy to clipboard operation
robotframework-tidy copied to clipboard

RenameVariables handling of default value with environment variables

Open tnh8 opened this issue 10 months ago • 2 comments

Robotidy, version 4.11.0 with RenameVariables tries to do the following change of the default value of an environment variable:

-  Set Test Variable    ${MY_VAR}    %{MY_ENV_VAR=None}
+  Set Test Variable    ${MY_VAR}    %{MY_ENV_VAR=_None}

Manually setting the default value to uppercase or lowercase also satisfies Robotidy:RenameVariables.

-  Set Test Variable    ${MY_VAR}    %{MY_ENV_VAR=None}
+  Set Test Variable    ${MY_VAR}    %{MY_ENV_VAR=NONE}

I was under the impression that Robot Framework was "None/NONE/none"-insensitive.

Robotidy should probably don't change the default value.

tnh8 avatar Apr 09 '24 07:04 tnh8

Agreed, robotidy simply do not read default value in RenameVariables (it is parsed as part of the name). I will fix it so default value is ignored.

bhirsz avatar Apr 26 '24 09:04 bhirsz

  • also handled variables in defaults:
Log    %{MY_ENV=default with ${global}
Log    %{MY_ENV=${local}

which should be converted to

Log    %{MY_ENV=default with ${GLOBAL}
Log    %{MY_ENV=${local}

bhirsz avatar Apr 26 '24 09:04 bhirsz