Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle variables in [Tags] with RenameVariables #665

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/releasenotes/unreleased/fixes.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ SplitTooLongLine fails with fatal exception when splitting invalid keyword (#659
----------------------------------------------------------------------------------

``SplitTooLongLine`` did not handle invalid syntax where keyword name was omitted::

Keyword
${arg} ${second_arg}
... ${third_arg}
Expand Down
14 changes: 14 additions & 0 deletions docs/releasenotes/unreleased/fixes.4.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Variables in tags should be renamed with RenameVariables (#641)
---------------------------------------------------------------

Variables defined in the ``[Tags]`` should be now handled by ``RenameVariables`` transformer. Following code::

Test case
[Tags] tag with ${variable}
Test Step

should now (with the default configuration) be transformed to::

Test case
[Tags] tag with ${VARIABLE}
Test Step
4 changes: 3 additions & 1 deletion robotidy/transformers/RenameVariables.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ def visit_LibraryImport(self, node): # noqa
)
return self.generic_visit(node)

visit_DefaultTags = (
visit_Tags = (
visit_DefaultTags
) = (
visit_TestTags
) = (
visit_ForceTags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${VAR} tag with ${VAR}
Step


*** Keywords ***
Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${VAR} tag with ${VAR}
Step


*** Keywords ***
Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${var} tag with ${var}
Step


*** Keywords ***
Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${VAR} tag with ${VAR}
Step


*** Keywords ***
Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${var} tag with ${var}
Step


*** Keywords ***
Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${var} tag with ${var}
Step


*** Keywords ***
Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${VARIABLE} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${VAR} tag with ${VAR}
Step


*** Keywords ***
Arguments
Expand Down
4 changes: 4 additions & 0 deletions tests/atest/transformers/RenameVariables/source/test.robot
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Test case with ${variable} in name
[Documentation] The RF surprises me vol. 678
Step

Test with variables in tags
[Tags] ${var} tag with ${var}
Step


*** Keywords ***
Arguments
Expand Down
Loading