Skip to content

Commit

Permalink
Fix task section detection (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhirsz authored May 6, 2024
1 parent 28e028e commit 95bd18b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
7 changes: 7 additions & 0 deletions docs/releasenotes/unreleased/fixes.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Task section not recognized for mixed-task-test-settings rule (#1074)
----------------------------------------------------------------------

If last section of the file wasn't Tasks section, Robocop assumed that file contains only Test Cases section. This
caused W0326 ``mixed-task-test-settings`` to be issued with incorrect message.

Thanks @MrBIN89 for finding the issue.
5 changes: 3 additions & 2 deletions robocop/checkers/naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -877,8 +877,9 @@ def visit_File(self, node): # noqa
ROBOT_VERSION.major >= 6 and section.header.type == Token.TASK_HEADER
):
self.task_section = True
else:
self.task_section = False
break
else:
self.task_section = False
super().visit_File(node)

def visit_Setup(self, node): # noqa
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ Task Tags tag
Documentation some docs

*** Variables ***
${variable} value



*** Tasks ***
Some Task
No Operation

*** Keywords ***
Some Keyword
No Operation
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ Task Tags tag
Documentation some docs

*** Variables ***
${variable} value


*** Test Cases ***
Some Task
No Operation
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def test_rule_rf6(self):
"golden_test.robot",
],
expected_file="expected_output_rf6.txt",
target_version="==6.*",
target_version=">=6",
)

def test_rule(self):
Expand Down

0 comments on commit 95bd18b

Please sign in to comment.