Skip to content

Commit

Permalink
Change order of Timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
bhirsz committed May 12, 2024
1 parent e60d84d commit 3e3ef26
Show file tree
Hide file tree
Showing 8 changed files with 414 additions and 14 deletions.
7 changes: 0 additions & 7 deletions docs/releasenotes/unreleased/fixes.2.rst

This file was deleted.

15 changes: 15 additions & 0 deletions docs/releasenotes/unreleased/transformers.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Timeout] and [Setup] order for keywords in OrderSettings (#690)
-----------------------------------------------------------------

Default order of keyword settings in ``OrderSettings`` transformer was modified. Robot Framework 7.0 added ``[Setup]``
to keywords (which wasn't supported by Robotidy until now). ``[Timeout]`` order was also changed.

Old default order was ``documentation,tags,timeout,arguments`` and new order is
``documentation,tags,arguments,timeout,setup``.

``[Timeout]`` order was changed to follow Robot Framework Style Guide recommendation.

If you are using ``OrderSettings`` with custom order, this change requires to add ``setup`` to your order.

Note that if you're using ``[Setup]`` with keywords in your code (supported in RF from 7.0) but run Robotidy with older
version (pre 7.0) it will order ``[Setup]`` like a keyword call - essentially ignoring its order.
2 changes: 1 addition & 1 deletion robotidy/transformers/OrderSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class OrderSettings(Transformer):
KEYWORD_SETTINGS = {
"documentation": Token.DOCUMENTATION,
"tags": Token.TAGS,
"timeout": Token.TIMEOUT,
"arguments": Token.ARGUMENTS,
"timeout": Token.TIMEOUT,
"setup": Token.SETUP,
"return": Token.RETURN,
"teardown": Token.TEARDOWN,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
*** Test Cases ***
Test case 1
Keyword
Keyword
[Documentation] this is
... doc
[Tags]
... tag
[Setup] Setup # comment
[Teardown] Teardown

Test case 2
Keyword
[Timeout] timeout2 # this is error because it is duplicate
[Template] Template
[Timeout] timeout

Test case with comment at the end
[Teardown] Keyword
# comment

# comment

Test case 3
Golden Keyword

Test case 4
Keyword1
# comment1
Keyword2
# comment2
Keyword3
[Teardown] teardown

Test case 5 # comment1
Keyword1
# comment2
Keyword2
# comment3
Keyword3
[Documentation] this is
[Teardown] teardown

*** Keywords ***
Keyword
Keyword
No Operation
IF ${condition}
Log ${stuff}
END
FOR ${var} IN 1 2
Log ${var}
END
Pass
[Setup] Setup
[Documentation] this is
... doc
[Tags] sanity
[Arguments] ${arg}
[Teardown] Keyword
[Return] ${value}

Another Keyword ${var}
No Operation
[Timeout]

Keyword With Comment
Keyword
[Return] ${value}
# I am comment

Keyword With Empty Line And Comment
Keyword
[Return] ${value}

# I am comment in new line

Another Keyword
No Operation
# innocent comment

Comment Before setting
Keyword
# I want to be here
[Return] ${value}

Return first and comment last
Keyword
[Return] stuff
# I want to be here

Comment on the same line # comment
[Documentation] this is
... doc
# what will happen with me?
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
*** Test Cases ***
Test case 1
[Documentation] this is
... doc
[Tags]
... tag
[Setup] Setup # comment
Keyword
Keyword
[Teardown] Teardown

Test case 2
[Template] Template
[Timeout] timeout
Keyword
[Timeout] timeout2 # this is error because it is duplicate

Test case with comment at the end
[Teardown] Keyword
# comment

# comment

Test case 3
Golden Keyword

Test case 4
Keyword1
# comment1
Keyword2
# comment2
Keyword3
[Teardown] teardown

Test case 5 # comment1
[Documentation] this is
Keyword1
# comment2
Keyword2
# comment3
Keyword3
[Teardown] teardown

*** Keywords ***
Keyword
[Documentation] this is
... doc
[Tags] sanity
[Arguments] ${arg}
Keyword
No Operation
IF ${condition}
Log ${stuff}
END
FOR ${var} IN 1 2
Log ${var}
END
Pass
[Setup] Setup
[Teardown] Keyword
[Return] ${value}

Another Keyword ${var}
[Timeout]
No Operation

Keyword With Comment
Keyword
[Return] ${value}
# I am comment

Keyword With Empty Line And Comment
Keyword
[Return] ${value}

# I am comment in new line

Another Keyword
No Operation
# innocent comment

Comment Before setting
Keyword
# I want to be here
[Return] ${value}

Return first and comment last
Keyword
[Return] stuff
# I want to be here

Comment on the same line # comment
[Documentation] this is
... doc
# what will happen with me?
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
*** Test Cases ***
Test case 1
[Documentation] this is
... doc
[Tags]
... tag
[Setup] Setup # comment
[Teardown] Teardown
Keyword
Keyword

Test case 2
[Template] Template
[Timeout] timeout
Keyword
[Timeout] timeout2 # this is error because it is duplicate

Test case with comment at the end
[Teardown] Keyword
# comment

# comment

Test case 3
Golden Keyword

Test case 4
[Teardown] teardown
Keyword1
# comment1
Keyword2
# comment2
Keyword3

Test case 5 # comment1
[Documentation] this is
[Teardown] teardown
Keyword1
# comment2
Keyword2
# comment3
Keyword3

*** Keywords ***
Keyword
[Documentation] this is
... doc
[Tags] sanity
[Arguments] ${arg}
Keyword
No Operation
IF ${condition}
Log ${stuff}
END
FOR ${var} IN 1 2
Log ${var}
END
Pass
[Setup] Setup
[Teardown] Keyword
[Return] ${value}

Another Keyword ${var}
[Timeout]
No Operation

Keyword With Comment
Keyword
[Return] ${value}
# I am comment

Keyword With Empty Line And Comment
Keyword
[Return] ${value}

# I am comment in new line

Another Keyword
No Operation
# innocent comment

Comment Before setting
Keyword
# I want to be here
[Return] ${value}

Return first and comment last
Keyword
[Return] stuff
# I want to be here

Comment on the same line # comment
[Documentation] this is
... doc
# what will happen with me?
Loading

0 comments on commit 3e3ef26

Please sign in to comment.