Repository: MarketSquare/robotframework-robocop
Pull request #1269 (2025-02-28 17:29:43)

Add tests for extended view for order rules & refactor issues locations


Patch:
diff --git a/src/robocop/linter/rules/misc.py b/src/robocop/linter/rules/misc.py
index 92bffd5..c415eae 100644
--- a/src/robocop/linter/rules/misc.py
+++ b/src/robocop/linter/rules/misc.py
@@ -7,7 +7,7 @@ from typing import Optional
 
 from robot.api import Token
 from robot.errors import VariableError
-from robot.parsing.model.blocks import Keyword, TestCase, TestCaseSection
+from robot.parsing.model.blocks import TestCaseSection
 from robot.parsing.model.statements import Arguments, KeywordCall, Teardown
 from robot.utils import unescape
 from robot.variables.search import search_variable
@@ -29,7 +29,6 @@ from robocop.linter.rules import (
     VisitorChecker,
     arguments,
     deprecated,
-    order,
     variables,
 )
 from robocop.linter.utils import (  # FIXME: import as module
@@ -1527,51 +1526,6 @@ class ExpressionsChecker(VisitorChecker):
             )
 
 
-class TestAndKeywordOrderChecker(VisitorChecker):
-    test_case_section_out_of_order: order.TestCaseSectionOutOfOrderRule
-    keyword_section_out_of_order: order.KeywordSectionOutOfOrderRule
-
-    def __init__(self):
-        self.rules_by_node_type = {}
-        self.expected_order = {}
-        super().__init__()
-
-    def visit_File(self, node) -> None:  # noqa: N802
-        self.rules_by_node_type = {
-            Keyword: self.keyword_section_out_of_order,
-            TestCase: self.test_case_section_out_of_order,
-        }
-        self.expected_order = {
-            Keyword: self.keyword_section_out_of_order.sections_order,
-            TestCase: self.test_case_section_out_of_order.sections_order,
-        }
-        self.generic_visit(node)
-
-    def check_order(self, node) -> None:
-        max_order_indicator = -1
-        for subnode in node.body:
-            try:
-                subnode_type = subnode.type
-            except AttributeError:
-                continue
-            if subnode_type not in self.expected_order[type(node)]:
-                continue
-            this_node_expected_order = self.expected_order[type(node)].index(subnode.type)
-            if this_node_expected_order < max_order_indicator:
-                self.report(
-                    self.rules_by_node_type[type(node)],
-                    section_name=subnode_type,
-                    recommended_order=", ".join(self.expected_order[type(node)]),
-                    node=subnode,
-                    col=subnode.col_offset + 1,
-                    end_col=subnode.end_col_offset + 1,
-                )
-            else:
-                max_order_indicator = this_node_expected_order
-
-    visit_Keyword = visit_TestCase = check_order  # noqa: N815
-
-
 class NonLocalVariableChecker(VisitorChecker):
     no_global_variable: variables.NoGlobalVariableRule
     no_suite_variable: variables.NoSuiteVariableRule
diff --git a/src/robocop/linter/rules/order.py b/src/robocop/linter/rules/order.py
index ebdb66f..9ff0c3e 100644
--- a/src/robocop/linter/rules/order.py
+++ b/src/robocop/linter/rules/order.py
@@ -1,8 +1,9 @@
 from __future__ import annotations
 
 from robot.api import Token
+from robot.parsing.model.blocks import Keyword, TestCase
 
-from robocop.linter.rules import Rule, RuleParam, RuleSeverity
+from robocop.linter.rules import Rule, RuleParam, RuleSeverity, VisitorChecker
 
 
 def parse_order_comma_sep_list(value: str, mapping: dict) -> list:
@@ -222,3 +223,49 @@ class SectionOutOfOrderRule(Rule):  # FIXME it is not dup, more like ORD
             desc="order of sections in comma-separated list",
         )
     ]
+
+
+class TestAndKeywordOrderChecker(VisitorChecker):
+    test_case_section_out_of_order: TestCaseSectionOutOfOrderRule
+    keyword_section_out_of_order: KeywordSectionOutOfOrderRule
+
+    def __init__(self):
+        self.rules_by_node_type = {}
+        self.expected_order = {}
+        super().__init__()
+
+    def visit_File(self, node) -> None:  # noqa: N802
+        self.rules_by_node_type = {
+            Keyword: self.keyword_section_out_of_order,
+            TestCase: self.test_case_section_out_of_order,
+        }
+        self.expected_order = {
+            Keyword: self.keyword_section_out_of_order.sections_order,
+            TestCase: self.test_case_section_out_of_order.sections_order,
+        }
+        self.generic_visit(node)
+
+    def check_order(self, node) -> None:
+        max_order_indicator = -1
+        for subnode in node.body:
+            try:
+                subnode_type = subnode.type
+            except AttributeError:
+                continue
+            if subnode_type not in self.expected_order[type(node)]:
+                continue
+            this_node_expected_order = self.expected_order[type(node)].index(subnode.type)
+            if this_node_expected_order < max_order_indicator:
+                error_node = subnode.data_tokens[0]
+                self.report(
+                    self.rules_by_node_type[type(node)],
+                    section_name=subnode_type,
+                    recommended_order=", ".join(self.expected_order[type(node)]),
+                    node=error_node,
+                    col=error_node.col_offset + 1,
+                    end_col=error_node.end_col_offset + 1,
+                )
+            else:
+                max_order_indicator = this_node_expected_order
+
+    visit_Keyword = visit_TestCase = check_order  # noqa: N815


Test patch:
diff --git a/tests/linter/rules/order/keyword_section_out_of_order/expected_extended.txt b/tests/linter/rules/order/keyword_section_out_of_order/expected_extended.txt
new file mode 100644
index 0000000..50b2551
--- /dev/null
+++ b/tests/linter/rules/order/keyword_section_out_of_order/expected_extended.txt
@@ -0,0 +1,35 @@
+test.robot:25:5 ORD02 'DOCUMENTATION' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+    |
+ 23 | Documentation After Tags
+ 24 |     [Tags]    xd
+ 25 |     [Documentation]  this is doc
+    |     ^^^^^^^^^^^^^^^ ORD02
+ 26 |     No Operation
+    |
+
+test.robot:31:5 ORD02 'TAGS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+    |
+ 29 |     [Documentation]  this is doc
+ 30 |     [Arguments]    ${argument1}
+ 31 |     [Tags]    xd
+    |     ^^^^^^ ORD02
+ 32 |     Fail
+    |
+
+test.robot:37:5 ORD02 'ARGUMENTS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+    |
+ 35 |     [Documentation]  this is doc
+ 36 |     [Timeout]    30
+ 37 |     [Arguments]    ${argument1}
+    |     ^^^^^^^^^^^ ORD02
+ 38 |     No Operation
+    |
+
+test.robot:44:5 ORD02 'KEYWORD' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+    |
+ 42 |     No Operation
+ 43 |     [Teardown]    Log    Cleaning
+ 44 |     No Operation
+    |     ^^^^^^^^^^^^ ORD02
+    |
+
diff --git a/tests/linter/rules/order/keyword_section_out_of_order/expected_output.txt b/tests/linter/rules/order/keyword_section_out_of_order/expected_output.txt
index 396a9c4..c231406 100644
--- a/tests/linter/rules/order/keyword_section_out_of_order/expected_output.txt
+++ b/tests/linter/rules/order/keyword_section_out_of_order/expected_output.txt
@@ -1,4 +1,4 @@
-test.robot:25:1 [W] ORD02 'DOCUMENTATION' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test.robot:31:1 [W] ORD02 'TAGS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test.robot:37:1 [W] ORD02 'ARGUMENTS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test.robot:44:1 [W] ORD02 'KEYWORD' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:25:5 [W] ORD02 'DOCUMENTATION' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:31:5 [W] ORD02 'TAGS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:37:5 [W] ORD02 'ARGUMENTS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:44:5 [W] ORD02 'KEYWORD' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
diff --git a/tests/linter/rules/order/keyword_section_out_of_order/expected_output_rf7.txt b/tests/linter/rules/order/keyword_section_out_of_order/expected_output_rf7.txt
index 0925e88..75525a1 100644
--- a/tests/linter/rules/order/keyword_section_out_of_order/expected_output_rf7.txt
+++ b/tests/linter/rules/order/keyword_section_out_of_order/expected_output_rf7.txt
@@ -1,6 +1,6 @@
-test.robot:25:1 [W] ORD02 'DOCUMENTATION' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test.robot:31:1 [W] ORD02 'TAGS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test.robot:37:1 [W] ORD02 'ARGUMENTS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test.robot:44:1 [W] ORD02 'KEYWORD' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test_kw_setup_added_in_rf7.robot:27:1 [W] ORD02 'TIMEOUT' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
-test_kw_setup_added_in_rf7.robot:33:1 [W] ORD02 'SETUP' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:25:5 [W] ORD02 'DOCUMENTATION' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:31:5 [W] ORD02 'TAGS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:37:5 [W] ORD02 'ARGUMENTS' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test.robot:44:5 [W] ORD02 'KEYWORD' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test_kw_setup_added_in_rf7.robot:27:5 [W] ORD02 'TIMEOUT' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
+test_kw_setup_added_in_rf7.robot:33:5 [W] ORD02 'SETUP' is in wrong place of Keyword. Recommended order of elements in Keyword: DOCUMENTATION, TAGS, ARGUMENTS, TIMEOUT, SETUP, KEYWORD, TEARDOWN
diff --git a/tests/linter/rules/order/keyword_section_out_of_order/expected_output_teardown_keyword.txt b/tests/linter/rules/order/keyword_section_out_of_order/expected_output_teardown_keyword.txt
index 602d3f7..b84659b 100644
--- a/tests/linter/rules/order/keyword_section_out_of_order/expected_output_teardown_keyword.txt
+++ b/tests/linter/rules/order/keyword_section_out_of_order/expected_output_teardown_keyword.txt
@@ -1,2 +1,2 @@
-test.robot:21:1 [W] ORD02 'TEARDOWN' is in wrong place of Keyword. Recommended order of elements in Keyword: TEARDOWN, KEYWORD
-test.robot:43:1 [W] ORD02 'TEARDOWN' is in wrong place of Keyword. Recommended order of elements in Keyword: TEARDOWN, KEYWORD
+test.robot:21:5 [W] ORD02 'TEARDOWN' is in wrong place of Keyword. Recommended order of elements in Keyword: TEARDOWN, KEYWORD
+test.robot:43:5 [W] ORD02 'TEARDOWN' is in wrong place of Keyword. Recommended order of elements in Keyword: TEARDOWN, KEYWORD
diff --git a/tests/linter/rules/order/keyword_section_out_of_order/test_rule.py b/tests/linter/rules/order/keyword_section_out_of_order/test_rule.py
index 9da931c..f680b87 100644
--- a/tests/linter/rules/order/keyword_section_out_of_order/test_rule.py
+++ b/tests/linter/rules/order/keyword_section_out_of_order/test_rule.py
@@ -5,6 +5,9 @@ class TestRuleAcceptance(RuleAcceptance):
     def test_rule(self):
         self.check_rule(src_files=["test.robot"], expected_file="expected_output.txt")
 
+    def test_extended(self):
+        self.check_rule(src_files=["test.robot"], expected_file="expected_extended.txt", output_format="extended")
+
     def test_rule_setup(self):
         self.check_rule(
             src_files=["test.robot", "test_kw_setup_added_in_rf7.robot"],
diff --git a/tests/linter/rules/order/section_out_of_order/expected_extended.txt b/tests/linter/rules/order/section_out_of_order/expected_extended.txt
new file mode 100644
index 0000000..503d97a
--- /dev/null
+++ b/tests/linter/rules/order/section_out_of_order/expected_extended.txt
@@ -0,0 +1,13 @@
+test.robot:20:1 ORD03 '*** Settings ***' section header is defined in wrong order: Settings > Variables > Test Cases / Tasks > Keywords
+    |
+ 20 | *** Settings ***
+    | ^^^^^^^^^^^^^^^^ ORD03
+ 21 | Documentation  doc
+    |
+
+test.robot:23:1 ORD03 '*** Variables ***' section header is defined in wrong order: Settings > Variables > Test Cases / Tasks > Keywords
+    |
+ 23 | *** Variables ***
+    | ^^^^^^^^^^^^^^^^^ ORD03
+    |
+
diff --git a/tests/linter/rules/order/section_out_of_order/test_rule.py b/tests/linter/rules/order/section_out_of_order/test_rule.py
index a8b2a06..1e4ac22 100644
--- a/tests/linter/rules/order/section_out_of_order/test_rule.py
+++ b/tests/linter/rules/order/section_out_of_order/test_rule.py
@@ -23,3 +23,6 @@ class TestRuleAcceptance(RuleAcceptance):
             src_files=["test.robot"],
             expected_file="expected_output_default_order.txt",
         )
+
+    def test_extended(self):
+        self.check_rule(src_files=["test.robot"], expected_file="expected_extended.txt", output_format="extended")
diff --git a/tests/linter/rules/order/test_case_section_out_of_order/expected_extended.txt b/tests/linter/rules/order/test_case_section_out_of_order/expected_extended.txt
new file mode 100644
index 0000000..f0e3499
--- /dev/null
+++ b/tests/linter/rules/order/test_case_section_out_of_order/expected_extended.txt
@@ -0,0 +1,53 @@
+test.robot:15:5 ORD01 'KEYWORD' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+    |
+ 13 |     [Tags]    tag1    tag2
+ 14 |     [Teardown]    Log    abc
+ 15 |     Keyword1
+    |     ^^^^^^^^ ORD01
+    |
+
+test.robot:19:5 ORD01 'DOCUMENTATION' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+    |
+ 17 | Documentation After Tags
+ 18 |     [Tags]    tag1    tag2
+ 19 |     [Documentation]    This is test Documentation
+    |     ^^^^^^^^^^^^^^^ ORD01
+ 20 |     Keyword1
+    |
+
+test.robot:25:5 ORD01 'TAGS' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+    |
+ 23 |     [Documentation]    This is test Documentation
+ 24 |     [Timeout]    30
+ 25 |     [Tags]    MyTag
+    |     ^^^^^^ ORD01
+ 26 |     Keyword1
+    |
+
+test.robot:31:5 ORD01 'TIMEOUT' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+    |
+ 29 |     [Documentation]    This is test Documentation
+ 30 |     [Setup]    Log    Setting up
+ 31 |     [Timeout]    30
+    |     ^^^^^^^^^ ORD01
+ 32 |     Keyword1
+    |
+
+test.robot:37:5 ORD01 'SETUP' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+    |
+ 35 |     [Documentation]    This is test Documentation
+ 36 |     [Template]    Do Stuff
+ 37 |     [Setup]    Log    Setting up
+    |     ^^^^^^^ ORD01
+ 38 |     a    b
+    |
+
+test.robot:43:5 ORD01 'TEMPLATE' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+    |
+ 41 |     [Documentation]    This is test Documentation
+ 42 |     [Teardown]    Teardown
+ 43 |     [Template]    Do Stuff
+    |     ^^^^^^^^^^ ORD01
+ 44 |     a    b
+    |
+
diff --git a/tests/linter/rules/order/test_case_section_out_of_order/expected_output.txt b/tests/linter/rules/order/test_case_section_out_of_order/expected_output.txt
index 20aebda..2b647bb 100644
--- a/tests/linter/rules/order/test_case_section_out_of_order/expected_output.txt
+++ b/tests/linter/rules/order/test_case_section_out_of_order/expected_output.txt
@@ -1,6 +1,6 @@
-test.robot:15:1 [W] ORD01 'KEYWORD' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
-test.robot:19:1 [W] ORD01 'DOCUMENTATION' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
-test.robot:25:1 [W] ORD01 'TAGS' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
-test.robot:31:1 [W] ORD01 'TIMEOUT' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
-test.robot:37:1 [W] ORD01 'SETUP' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
-test.robot:43:1 [W] ORD01 'TEMPLATE' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+test.robot:15:5 [W] ORD01 'KEYWORD' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+test.robot:19:5 [W] ORD01 'DOCUMENTATION' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+test.robot:25:5 [W] ORD01 'TAGS' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+test.robot:31:5 [W] ORD01 'TIMEOUT' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+test.robot:37:5 [W] ORD01 'SETUP' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
+test.robot:43:5 [W] ORD01 'TEMPLATE' is in wrong place of Test Case. Recommended order of elements in Test Cases: DOCUMENTATION, TAGS, TIMEOUT, SETUP, TEMPLATE, KEYWORD, TEARDOWN
diff --git a/tests/linter/rules/order/test_case_section_out_of_order/expected_output_teardown_keyword.txt b/tests/linter/rules/order/test_case_section_out_of_order/expected_output_teardown_keyword.txt
index b8866ea..b59c364 100644
--- a/tests/linter/rules/order/test_case_section_out_of_order/expected_output_teardown_keyword.txt
+++ b/tests/linter/rules/order/test_case_section_out_of_order/expected_output_teardown_keyword.txt
@@ -1,1 +1,1 @@
-test.robot:9:1 [W] ORD01 'TEARDOWN' is in wrong place of Test Case. Recommended order of elements in Test Cases: TEARDOWN, KEYWORD
+test.robot:9:5 [W] ORD01 'TEARDOWN' is in wrong place of Test Case. Recommended order of elements in Test Cases: TEARDOWN, KEYWORD
diff --git a/tests/linter/rules/order/test_case_section_out_of_order/test_rule.py b/tests/linter/rules/order/test_case_section_out_of_order/test_rule.py
index 64b1747..40b81c8 100644
--- a/tests/linter/rules/order/test_case_section_out_of_order/test_rule.py
+++ b/tests/linter/rules/order/test_case_section_out_of_order/test_rule.py
@@ -5,6 +5,9 @@ class TestRuleAcceptance(RuleAcceptance):
     def test_rule(self):
         self.check_rule(expected_file="expected_output.txt")
 
+    def test_extended(self):
+        self.check_rule(src_files=["test.robot"], expected_file="expected_extended.txt", output_format="extended")
+
     def test_rule_teardown_keyword(self):
         self.check_rule(
             configure=["test-case-section-out-of-order.sections_order=teardown,keyword"],