Repository: MarketSquare/robotframework-robocop
Pull request #1266 (2025-02-28 11:06:13)

Add tests for extended view for duplications rules


Patch:
diff --git a/src/robocop/linter/rules/duplications.py b/src/robocop/linter/rules/duplications.py
index c1b5478..68ac8f2 100644
--- a/src/robocop/linter/rules/duplications.py
+++ b/src/robocop/linter/rules/duplications.py
@@ -374,7 +374,11 @@ class DuplicationsChecker(VisitorChecker):
         for error in get_errors(node):
             if "is allowed only once" in error:
                 self.report(
-                    self.duplicated_setting, error_msg=error, node=node, end_col=node.data_tokens[0].end_col_offset
+                    self.duplicated_setting,
+                    error_msg=error,
+                    node=node,
+                    col=node.data_tokens[0].col_offset + 1,
+                    end_col=node.data_tokens[0].end_col_offset,
                 )
 
 


Test patch:
diff --git a/tests/linter/rules/duplications/both_tests_and_tasks/expected_extended.txt b/tests/linter/rules/duplications/both_tests_and_tasks/expected_extended.txt
new file mode 100644
index 0000000..ba277ae
--- /dev/null
+++ b/tests/linter/rules/duplications/both_tests_and_tasks/expected_extended.txt
@@ -0,0 +1,17 @@
+test.robot:14:1 DUP09 Both Task(s) and Test Case(s) section headers defined in file
+    |
+ 14 | *** Tasks ***
+    | ^^^^^^^^^^^^^ DUP09
+ 15 | Task
+ 16 |     No Operation
+    |
+
+test2.robot:3:1 DUP09 Both Task(s) and Test Case(s) section headers defined in file
+   |
+ 1 | *** Tasks ***
+ 2 | Documentation    abc
+ 3 | *** Test Cases ***
+   | ^^^^^^^^^^^^^^^^^^ DUP09
+ 4 | Documentation    some
+   |
+
diff --git a/tests/linter/rules/duplications/both_tests_and_tasks/test_rule.py b/tests/linter/rules/duplications/both_tests_and_tasks/test_rule.py
index e0553eb..931c17e 100644
--- a/tests/linter/rules/duplications/both_tests_and_tasks/test_rule.py
+++ b/tests/linter/rules/duplications/both_tests_and_tasks/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 class TestRuleAcceptance(RuleAcceptance):
     def test_rule(self):
         self.check_rule(expected_file="expected_output.txt")
+
+    def test_extended(self):
+        self.check_rule(expected_file="expected_extended.txt", output_format="extended")
diff --git a/tests/linter/rules/duplications/duplicated_keyword/expected_extended.txt b/tests/linter/rules/duplications/duplicated_keyword/expected_extended.txt
new file mode 100644
index 0000000..741e347
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_keyword/expected_extended.txt
@@ -0,0 +1,7 @@
+test.robot:25:1 DUP02 Multiple keywords with name 'Duplicated Keyword' (first occurrence in line 15)
+    |
+ 25 | Duplicated Keyword
+    | ^^^^^^^^^^^^^^^^^^ DUP02
+ 26 |     No Operation
+    |
+
diff --git a/tests/linter/rules/duplications/duplicated_keyword/test_rule.py b/tests/linter/rules/duplications/duplicated_keyword/test_rule.py
index cba6753..5cfbbdd 100644
--- a/tests/linter/rules/duplications/duplicated_keyword/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_keyword/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 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(expected_file="expected_extended.txt", output_format="extended")
diff --git a/tests/linter/rules/duplications/duplicated_library/expected_extended.txt b/tests/linter/rules/duplications/duplicated_library/expected_extended.txt
new file mode 100644
index 0000000..2115431
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_library/expected_extended.txt
@@ -0,0 +1,29 @@
+test.robot:7:12 DUP05 Multiple library imports with name 'MyLib' and identical arguments (first occurrence in line 3)
+   |
+ 5 | Library
+ 6 | Resource  some_resource.robot
+ 7 | Library    MyLib
+   |            ^^^^^ DUP05
+ 8 | Library    MyLib    arg
+ 9 | Library    MyLib    arg
+   |
+
+test.robot:9:12 DUP05 Multiple library imports with name 'MyLib' and identical arguments (first occurrence in line 8)
+   |
+ 7 | Library    MyLib
+ 8 | Library    MyLib    arg
+ 9 | Library    MyLib    arg
+   |            ^^^^^ DUP05
+10 | Library    MyLib  WITH NAME    MyLib2
+11 | Library    MyLib  AS    MyLib3
+   |
+
+test.robot:12:12 DUP05 Multiple library imports with name 'MyLib' and identical arguments (first occurrence in line 10)
+    |
+ 10 | Library    MyLib  WITH NAME    MyLib2
+ 11 | Library    MyLib  AS    MyLib3
+ 12 | Library    MyLib  AS    MyLib2
+    |            ^^^^^ DUP05
+ 13 | Library    MyLib    argument    AS    MyLib2
+    |
+
diff --git a/tests/linter/rules/duplications/duplicated_library/test_rule.py b/tests/linter/rules/duplications/duplicated_library/test_rule.py
index 678349e..e42db0a 100644
--- a/tests/linter/rules/duplications/duplicated_library/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_library/test_rule.py
@@ -7,3 +7,6 @@ class TestRuleAcceptance(RuleAcceptance):
 
     def test_rule_rf6(self):
         self.check_rule(expected_file="expected_output_rf6.txt", test_on_version=">=6.0")
+
+    def test_extended(self):
+        self.check_rule(expected_file="expected_extended.txt", output_format="extended", test_on_version=">=6.0")
diff --git a/tests/linter/rules/duplications/duplicated_metadata/expected_extended.txt b/tests/linter/rules/duplications/duplicated_metadata/expected_extended.txt
new file mode 100644
index 0000000..439ce32
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_metadata/expected_extended.txt
@@ -0,0 +1,8 @@
+__init__.robot:4:1 DUP06 Duplicated metadata 'some text' (first occurrence in line 2)
+   |
+ 2 | Metadata  some text
+ 3 | Metadata  some text2
+ 4 | Metadata  some text
+   | ^^^^^^^^^^^^^^^^^^^^ DUP06
+   |
+
diff --git a/tests/linter/rules/duplications/duplicated_metadata/test_rule.py b/tests/linter/rules/duplications/duplicated_metadata/test_rule.py
index e0553eb..931c17e 100644
--- a/tests/linter/rules/duplications/duplicated_metadata/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_metadata/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 class TestRuleAcceptance(RuleAcceptance):
     def test_rule(self):
         self.check_rule(expected_file="expected_output.txt")
+
+    def test_extended(self):
+        self.check_rule(expected_file="expected_extended.txt", output_format="extended")
diff --git a/tests/linter/rules/duplications/duplicated_resource/expected_extended.txt b/tests/linter/rules/duplications/duplicated_resource/expected_extended.txt
new file mode 100644
index 0000000..e2d6596
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_resource/expected_extended.txt
@@ -0,0 +1,8 @@
+test.robot:5:1 DUP04 Multiple resource imports with path 'resource.robot' (first occurrence in line 3)
+   |
+ 3 | Resource  resource.robot
+ 4 | Resource  other_file.robot
+ 5 | Resource  resource.robot
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^ DUP04
+   |
+
diff --git a/tests/linter/rules/duplications/duplicated_resource/test_rule.py b/tests/linter/rules/duplications/duplicated_resource/test_rule.py
index cba6753..4a48afe 100644
--- a/tests/linter/rules/duplications/duplicated_resource/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_resource/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 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")
diff --git a/tests/linter/rules/duplications/duplicated_setting/expected_extended.txt b/tests/linter/rules/duplications/duplicated_setting/expected_extended.txt
new file mode 100644
index 0000000..671ea71
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_setting/expected_extended.txt
@@ -0,0 +1,284 @@
+test.robot:3:1 DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+   |
+ 1 | *** Settings ***
+ 2 | Documentation                 S1
+ 3 | Documentation                 S2
+   | ^^^^^^^^^^^^ DUP10
+ 4 | Metadata          Foo         M1
+ 5 | Metadata          Foo         M2
+   |
+
+test.robot:7:1 DUP10 Setting 'Suite Setup' is allowed only once. Only the first value is used.
+   |
+ 5 | Metadata          Foo         M2
+ 6 | Suite Setup       Log Many    S1
+ 7 | Suite Setup       Comment     S2
+   | ^^^^^^^^^^ DUP10
+ 8 | Suite Teardown    Comment     S1
+ 9 | Suite Teardown    Log Many    S2
+   |
+
+test.robot:9:1 DUP10 Setting 'Suite Teardown' is allowed only once. Only the first value is used.
+   |
+ 7 | Suite Setup       Comment     S2
+ 8 | Suite Teardown    Comment     S1
+ 9 | Suite Teardown    Log Many    S2
+   | ^^^^^^^^^^^^^ DUP10
+10 | Test Setup        Log Many    T1
+11 | Test Setup        Comment     T2
+   |
+
+test.robot:11:1 DUP10 Setting 'Test Setup' is allowed only once. Only the first value is used.
+    |
+  9 | Suite Teardown    Log Many    S2
+ 10 | Test Setup        Log Many    T1
+ 11 | Test Setup        Comment     T2
+    | ^^^^^^^^^ DUP10
+ 12 | Test Teardown
+ 13 | Test Teardown     Comment     T1
+    |
+
+test.robot:13:1 DUP10 Setting 'Test Teardown' is allowed only once. Only the first value is used.
+    |
+ 11 | Test Setup        Comment     T2
+ 12 | Test Teardown
+ 13 | Test Teardown     Comment     T1
+    | ^^^^^^^^^^^^ DUP10
+ 14 | Test Teardown     Log Many    T2
+ 15 | Test Template     Log Many
+    |
+
+test.robot:14:1 DUP10 Setting 'Test Teardown' is allowed only once. Only the first value is used.
+    |
+ 12 | Test Teardown
+ 13 | Test Teardown     Comment     T1
+ 14 | Test Teardown     Log Many    T2
+    | ^^^^^^^^^^^^ DUP10
+ 15 | Test Template     Log Many
+ 16 | Test Template     Ignored
+    |
+
+test.robot:16:1 DUP10 Setting 'Test Template' is allowed only once. Only the first value is used.
+    |
+ 14 | Test Teardown     Log Many    T2
+ 15 | Test Template     Log Many
+ 16 | Test Template     Ignored
+    | ^^^^^^^^^^^^ DUP10
+ 17 | Force Tags
+ 18 | Force Tags        F1
+    |
+
+test.robot:18:1 DUP10 Setting 'Force Tags' is allowed only once. Only the first value is used.
+    |
+ 16 | Test Template     Ignored
+ 17 | Force Tags
+ 18 | Force Tags        F1
+    | ^^^^^^^^^ DUP10
+ 19 | Force Tags        F2
+ 20 | Default Tags      D1
+    |
+
+test.robot:19:1 DUP10 Setting 'Force Tags' is allowed only once. Only the first value is used.
+    |
+ 17 | Force Tags
+ 18 | Force Tags        F1
+ 19 | Force Tags        F2
+    | ^^^^^^^^^ DUP10
+ 20 | Default Tags      D1
+ 21 | Default Tags      D2
+    |
+
+test.robot:21:1 DUP10 Setting 'Default Tags' is allowed only once. Only the first value is used.
+    |
+ 19 | Force Tags        F2
+ 20 | Default Tags      D1
+ 21 | Default Tags      D2
+    | ^^^^^^^^^^^ DUP10
+ 22 | Default Tags      D3
+ 23 | Test Timeout      1 s
+    |
+
+test.robot:22:1 DUP10 Setting 'Default Tags' is allowed only once. Only the first value is used.
+    |
+ 20 | Default Tags      D1
+ 21 | Default Tags      D2
+ 22 | Default Tags      D3
+    | ^^^^^^^^^^^ DUP10
+ 23 | Test Timeout      1 s
+ 24 | Test Timeout      0.001 s
+    |
+
+test.robot:24:1 DUP10 Setting 'Test Timeout' is allowed only once. Only the first value is used.
+    |
+ 22 | Default Tags      D3
+ 23 | Test Timeout      1 s
+ 24 | Test Timeout      0.001 s
+    | ^^^^^^^^^^^ DUP10
+    |
+
+test.robot:32:5 DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+    |
+ 30 | Test Settings
+ 31 |     [Documentation]    T1
+ 32 |     [Documentation]    FAIL 2 s
+    |     ^^^^^^^^^^^^^^ DUP10
+ 33 |     [Tags]
+ 34 |     [Tags]    T1
+    |
+
+test.robot:34:5 DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
+    |
+ 32 |     [Documentation]    FAIL 2 s
+ 33 |     [Tags]
+ 34 |     [Tags]    T1
+    |     ^^^^^ DUP10
+ 35 |     [Tags]    T2
+ 36 |     [Setup]    Log Many    Own
+    |
+
+test.robot:35:5 DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
+    |
+ 33 |     [Tags]
+ 34 |     [Tags]    T1
+ 35 |     [Tags]    T2
+    |     ^^^^^ DUP10
+ 36 |     [Setup]    Log Many    Own
+ 37 |     [Setup]    stuff    here
+    |
+
+test.robot:37:5 DUP10 Setting 'Setup' is allowed only once. Only the first value is used.
+    |
+ 35 |     [Tags]    T2
+ 36 |     [Setup]    Log Many    Own
+ 37 |     [Setup]    stuff    here
+    |     ^^^^^^ DUP10
+ 38 |     [Teardown]
+ 39 |     [Teardown]    Log Many    And
+    |
+
+test.robot:39:5 DUP10 Setting 'Teardown' is allowed only once. Only the first value is used.
+    |
+ 37 |     [Setup]    stuff    here
+ 38 |     [Teardown]
+ 39 |     [Teardown]    Log Many    And
+    |     ^^^^^^^^^ DUP10
+ 40 |     [Teardown]    also    here
+ 41 |     [Template]    Log
+    |
+
+test.robot:40:5 DUP10 Setting 'Teardown' is allowed only once. Only the first value is used.
+    |
+ 38 |     [Teardown]
+ 39 |     [Teardown]    Log Many    And
+ 40 |     [Teardown]    also    here
+    |     ^^^^^^^^^ DUP10
+ 41 |     [Template]    Log
+ 42 |     [Template]    ignored
+    |
+
+test.robot:42:5 DUP10 Setting 'Template' is allowed only once. Only the first value is used.
+    |
+ 40 |     [Teardown]    also    here
+ 41 |     [Template]    Log
+ 42 |     [Template]    ignored
+    |     ^^^^^^^^^ DUP10
+ 43 |     [Timeout]    2 s
+ 44 |     [Timeout]    2 ms
+    |
+
+test.robot:44:5 DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
+    |
+ 42 |     [Template]    ignored
+ 43 |     [Timeout]    2 s
+ 44 |     [Timeout]    2 ms
+    |     ^^^^^^^^ DUP10
+ 45 |     No Operation
+    |
+
+test.robot:55:5 DUP10 Setting 'Arguments' is allowed only once. Only the first value is used.
+    |
+ 53 | Keyword Settings
+ 54 |     [Arguments]    ${a1}    ${a2}    ${a3}
+ 55 |     [Arguments]    ${arg}
+    |     ^^^^^^^^^^ DUP10
+ 56 |     [Documentation]
+ 57 |     [Documentation]    K1
+    |
+
+test.robot:57:5 DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+    |
+ 55 |     [Arguments]    ${arg}
+ 56 |     [Documentation]
+ 57 |     [Documentation]    K1
+    |     ^^^^^^^^^^^^^^ DUP10
+ 58 |     [Documentation]    K2
+ 59 |     [Tags]    K1
+    |
+
+test.robot:58:5 DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+    |
+ 56 |     [Documentation]
+ 57 |     [Documentation]    K1
+ 58 |     [Documentation]    K2
+    |     ^^^^^^^^^^^^^^ DUP10
+ 59 |     [Tags]    K1
+ 60 |     [Tags]    K2
+    |
+
+test.robot:60:5 DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
+    |
+ 58 |     [Documentation]    K2
+ 59 |     [Tags]    K1
+ 60 |     [Tags]    K2
+    |     ^^^^^ DUP10
+ 61 |     [Timeout]
+ 62 |     [Timeout]    1s
+    |
+
+test.robot:62:5 DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
+    |
+ 60 |     [Tags]    K2
+ 61 |     [Timeout]
+ 62 |     [Timeout]    1s
+    |     ^^^^^^^^ DUP10
+ 63 |     [Timeout]    2s
+ 64 |     No Operation
+    |
+
+test.robot:63:5 DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
+    |
+ 61 |     [Timeout]
+ 62 |     [Timeout]    1s
+ 63 |     [Timeout]    2s
+    |     ^^^^^^^^ DUP10
+ 64 |     No Operation
+ 65 |     [Return]    R0
+    |
+
+test.robot:66:5 DUP10 Setting 'Return' is allowed only once. Only the first value is used.
+    |
+ 64 |     No Operation
+ 65 |     [Return]    R0
+ 66 |     [Return]    R1
+    |     ^^^^^^^ DUP10
+ 67 |     [Return]    R2
+ 68 |     [Return]    R3
+    |
+
+test.robot:67:5 DUP10 Setting 'Return' is allowed only once. Only the first value is used.
+    |
+ 65 |     [Return]    R0
+ 66 |     [Return]    R1
+ 67 |     [Return]    R2
+    |     ^^^^^^^ DUP10
+ 68 |     [Return]    R3
+    |
+
+test.robot:68:5 DUP10 Setting 'Return' is allowed only once. Only the first value is used.
+    |
+ 66 |     [Return]    R1
+ 67 |     [Return]    R2
+ 68 |     [Return]    R3
+    |     ^^^^^^^ DUP10
+    |
+
diff --git a/tests/linter/rules/duplications/duplicated_setting/expected_output.txt b/tests/linter/rules/duplications/duplicated_setting/expected_output.txt
index 2a1b118..6093af0 100644
--- a/tests/linter/rules/duplications/duplicated_setting/expected_output.txt
+++ b/tests/linter/rules/duplications/duplicated_setting/expected_output.txt
@@ -10,20 +10,20 @@ test.robot:19:1 [W] DUP10 Setting 'Force Tags' is allowed only once. Only the fi
 test.robot:21:1 [W] DUP10 Setting 'Default Tags' is allowed only once. Only the first value is used.
 test.robot:22:1 [W] DUP10 Setting 'Default Tags' is allowed only once. Only the first value is used.
 test.robot:24:1 [W] DUP10 Setting 'Test Timeout' is allowed only once. Only the first value is used.
-test.robot:32:1 [W] DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
-test.robot:34:1 [W] DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
-test.robot:35:1 [W] DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
-test.robot:37:1 [W] DUP10 Setting 'Setup' is allowed only once. Only the first value is used.
-test.robot:39:1 [W] DUP10 Setting 'Teardown' is allowed only once. Only the first value is used.
-test.robot:40:1 [W] DUP10 Setting 'Teardown' is allowed only once. Only the first value is used.
-test.robot:42:1 [W] DUP10 Setting 'Template' is allowed only once. Only the first value is used.
-test.robot:44:1 [W] DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
-test.robot:55:1 [W] DUP10 Setting 'Arguments' is allowed only once. Only the first value is used.
-test.robot:57:1 [W] DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
-test.robot:58:1 [W] DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
-test.robot:60:1 [W] DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
-test.robot:62:1 [W] DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
-test.robot:63:1 [W] DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
-test.robot:66:1 [W] DUP10 Setting 'Return' is allowed only once. Only the first value is used.
-test.robot:67:1 [W] DUP10 Setting 'Return' is allowed only once. Only the first value is used.
-test.robot:68:1 [W] DUP10 Setting 'Return' is allowed only once. Only the first value is used.
\ No newline at end of file
+test.robot:32:5 [W] DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+test.robot:34:5 [W] DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
+test.robot:35:5 [W] DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
+test.robot:37:5 [W] DUP10 Setting 'Setup' is allowed only once. Only the first value is used.
+test.robot:39:5 [W] DUP10 Setting 'Teardown' is allowed only once. Only the first value is used.
+test.robot:40:5 [W] DUP10 Setting 'Teardown' is allowed only once. Only the first value is used.
+test.robot:42:5 [W] DUP10 Setting 'Template' is allowed only once. Only the first value is used.
+test.robot:44:5 [W] DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
+test.robot:55:5 [W] DUP10 Setting 'Arguments' is allowed only once. Only the first value is used.
+test.robot:57:5 [W] DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+test.robot:58:5 [W] DUP10 Setting 'Documentation' is allowed only once. Only the first value is used.
+test.robot:60:5 [W] DUP10 Setting 'Tags' is allowed only once. Only the first value is used.
+test.robot:62:5 [W] DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
+test.robot:63:5 [W] DUP10 Setting 'Timeout' is allowed only once. Only the first value is used.
+test.robot:66:5 [W] DUP10 Setting 'Return' is allowed only once. Only the first value is used.
+test.robot:67:5 [W] DUP10 Setting 'Return' is allowed only once. Only the first value is used.
+test.robot:68:5 [W] DUP10 Setting 'Return' is allowed only once. Only the first value is used.
\ No newline at end of file
diff --git a/tests/linter/rules/duplications/duplicated_setting/test_rule.py b/tests/linter/rules/duplications/duplicated_setting/test_rule.py
index d9d8f9b..a2a1042 100644
--- a/tests/linter/rules/duplications/duplicated_setting/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_setting/test_rule.py
@@ -7,3 +7,6 @@ class TestRuleAcceptance(RuleAcceptance):
 
     def test_unrecognized_header_bug(self):
         self.check_rule(src_files=["unrecognized_header.robot"], expected_file=None)
+
+    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/duplications/duplicated_test_case/expected_extended.txt b/tests/linter/rules/duplications/duplicated_test_case/expected_extended.txt
new file mode 100644
index 0000000..93ac903
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_test_case/expected_extended.txt
@@ -0,0 +1,28 @@
+test.robot:13:1 DUP01 Multiple test cases with name 'Test' (first occurrence in line 6)
+    |
+ 13 | Test
+    | ^^^^ DUP01
+ 14 |     No Operation
+    |
+
+test1.robot:13:1 DUP01 Multiple test cases with name 'test' (first occurrence in line 6)
+    |
+ 13 | test
+    | ^^^^ DUP01
+ 14 |     No Operation
+    |
+
+test2.robot:13:1 DUP01 Multiple test cases with name 'test1' (first occurrence in line 6)
+    |
+ 13 | test1
+    | ^^^^^ DUP01
+ 14 |     No Operation
+    |
+
+test2.robot:16:1 DUP01 Multiple test cases with name 'Te s t_1' (first occurrence in line 6)
+    |
+ 16 | Te s t_1
+    | ^^^^^^^^ DUP01
+ 17 |     No Operation
+    |
+
diff --git a/tests/linter/rules/duplications/duplicated_test_case/test_rule.py b/tests/linter/rules/duplications/duplicated_test_case/test_rule.py
index e0553eb..931c17e 100644
--- a/tests/linter/rules/duplications/duplicated_test_case/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_test_case/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 class TestRuleAcceptance(RuleAcceptance):
     def test_rule(self):
         self.check_rule(expected_file="expected_output.txt")
+
+    def test_extended(self):
+        self.check_rule(expected_file="expected_extended.txt", output_format="extended")
diff --git a/tests/linter/rules/duplications/duplicated_variable/expected_extended.txt b/tests/linter/rules/duplications/duplicated_variable/expected_extended.txt
new file mode 100644
index 0000000..3de347a
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_variable/expected_extended.txt
@@ -0,0 +1,17 @@
+test.robot:8:1 DUP03 Multiple variables with name '${V AR}' in Variables section (first occurrence in line 6)
+   |
+ 6 | ${v_ar}       10
+ 7 | ${other_var}  20
+ 8 | ${V AR}       a
+   | ^^^^^^^ DUP03
+ 9 | ${other_var}  30
+   |
+
+test.robot:9:1 DUP03 Multiple variables with name '${other_var}' in Variables section (first occurrence in line 7)
+   |
+ 7 | ${other_var}  20
+ 8 | ${V AR}       a
+ 9 | ${other_var}  30
+   | ^^^^^^^^^^^^ DUP03
+   |
+
diff --git a/tests/linter/rules/duplications/duplicated_variable/test_rule.py b/tests/linter/rules/duplications/duplicated_variable/test_rule.py
index cba6753..4a48afe 100644
--- a/tests/linter/rules/duplications/duplicated_variable/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_variable/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 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")
diff --git a/tests/linter/rules/duplications/duplicated_variables_import/expected_extended.txt b/tests/linter/rules/duplications/duplicated_variables_import/expected_extended.txt
new file mode 100644
index 0000000..94c4a89
--- /dev/null
+++ b/tests/linter/rules/duplications/duplicated_variables_import/expected_extended.txt
@@ -0,0 +1,47 @@
+test.robot:5:1 DUP07 Duplicated variables import with path 'variables.py' (first occurrence in line 3)
+   |
+ 3 | Variables  variables.py
+ 4 | Variables  other.robot
+ 5 | Variables  variables.py
+   | ^^^^^^^^^^^^^^^^^^^^^^^^ DUP07
+   |
+
+test.robot:10:1 DUP07 Duplicated variables import with path 'other1.py' (first occurrence in line 9)
+    |
+  8 | Variables  other.py    arg2
+  9 | Variables  other1.py    arg1
+ 10 | Variables  other1.py    arg1
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ DUP07
+ 11 | Variables  vars.yaml    arg1
+ 12 | Variables  vars2.yaml
+    |
+
+test.robot:13:1 DUP07 Duplicated variables import with path 'vars2.yaml' (first occurrence in line 12)
+    |
+ 11 | Variables  vars.yaml    arg1
+ 12 | Variables  vars2.yaml
+ 13 | Variables  vars2.yaml
+    | ^^^^^^^^^^^^^^^^^^^^^^ DUP07
+ 14 | Variables  variables.robot
+ 15 | Variables  variables.robot
+    |
+
+test.robot:15:1 DUP07 Duplicated variables import with path 'variables.robot' (first occurrence in line 14)
+    |
+ 13 | Variables  vars2.yaml
+ 14 | Variables  variables.robot
+ 15 | Variables  variables.robot
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ DUP07
+ 16 | Variables  variables.robot
+ 17 | Variables  variables.robot    arg
+    |
+
+test.robot:16:1 DUP07 Duplicated variables import with path 'variables.robot' (first occurrence in line 14)
+    |
+ 14 | Variables  variables.robot
+ 15 | Variables  variables.robot
+ 16 | Variables  variables.robot
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ DUP07
+ 17 | Variables  variables.robot    arg
+    |
+
diff --git a/tests/linter/rules/duplications/duplicated_variables_import/test_rule.py b/tests/linter/rules/duplications/duplicated_variables_import/test_rule.py
index cba6753..4a48afe 100644
--- a/tests/linter/rules/duplications/duplicated_variables_import/test_rule.py
+++ b/tests/linter/rules/duplications/duplicated_variables_import/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 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")
diff --git a/tests/linter/rules/duplications/section_already_defined/expected_extended.txt b/tests/linter/rules/duplications/section_already_defined/expected_extended.txt
new file mode 100644
index 0000000..dbc9f9d
--- /dev/null
+++ b/tests/linter/rules/duplications/section_already_defined/expected_extended.txt
@@ -0,0 +1,38 @@
+test.robot:8:1 DUP08 '*** Variables ***' section header already defined in file (first occurrence in line 7)
+   |
+ 6 |
+ 7 | *** Variables ***
+ 8 | *** Variables ***
+   | ^^^^^^^^^^^^^^^^^ DUP08
+   |
+
+test.robot:20:1 DUP08 '*** Test Case ***' section header already defined in file (first occurrence in line 11)
+    |
+ 20 | *** Test Case ***
+    | ^^^^^^^^^^^^^^^^^ DUP08
+    |
+
+test.robot:22:1 DUP08 '*** Keywords ***' section header already defined in file (first occurrence in line 5)
+    |
+ 22 | *** Keywords ***
+    | ^^^^^^^^^^^^^^^^ DUP08
+ 23 | Keyword
+ 24 |     [Documentation]  this is doc
+    |
+
+test.robot:30:1 DUP08 '*** Settings ***' section header already defined in file (first occurrence in line 1)
+    |
+ 30 | *** Settings ***
+    | ^^^^^^^^^^^^^^^^ DUP08
+ 31 | *** Tasks ***
+ 32 | *** Tasks ***
+    |
+
+test.robot:32:1 DUP08 '*** Tasks ***' section header already defined in file (first occurrence in line 31)
+    |
+ 30 | *** Settings ***
+ 31 | *** Tasks ***
+ 32 | *** Tasks ***
+    | ^^^^^^^^^^^^ DUP08
+    |
+
diff --git a/tests/linter/rules/duplications/section_already_defined/test_rule.py b/tests/linter/rules/duplications/section_already_defined/test_rule.py
index cba6753..4a48afe 100644
--- a/tests/linter/rules/duplications/section_already_defined/test_rule.py
+++ b/tests/linter/rules/duplications/section_already_defined/test_rule.py
@@ -4,3 +4,6 @@ from tests.linter.utils import RuleAcceptance
 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")