MarketSquare / MarketSquare/robotframework-tidy

RenameVariables does not update named arguments everywhere

Open
#712 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
RobotFramework
Stars
113
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Following up on #711, I notice that RenameVariables works on keyword also applies to arguments (which is what I was looking for), but does not update the instances where these arguments are used with their name. Which is unfortunate since:

>The named argument syntax is both case and space sensitive. The former means that if you have an argument `arg`, you must use it like `arg=value`, and neither `Arg=value` nor `ARG=value` works. The latter means that spaces are not allowed before the `=` sign, and possible spaces after it are considered part of the given value.

([source](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#named-arguments))

However, I am not sure robotidy can handle this as it requires applying the change across multiple files.
Maybe raising a warning on this subject could be enough? Or a default configuration to not apply to keyword arguments.

BEFORE
![image](https://github.com/user-attachments/assets/ae233710-bf70-44ee-a2b6-71f9684806f5)

AFTER
![image](https://github.com/user-attachments/assets/634b5689-8dc5-4ca5-a677-4c7da7f2607c)

CODE TO REPRODUCE
```robot
My Keyword
[Arguments] ${expected error}
TRY
No Operation
EXCEPT ${expected error}
No Operation
END

Another Keyword
My Keyword expected error=my error pattern
```

Side Note: When I use RobotCode "rename symbol" feature, it nicely updates the named arguments all over the project.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RenameVariables behavior described in the issue and reproduce it using the provided Robot Framework example. Trace how the argument declaration and the named-argument call are handled; completion should either update named-argument uses consistently across the project or establish the warning/default configuration behavior agreed for this issue.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.