Repository: MarketSquare/robotframework-robocop
Pull request #1270 (2025-03-01 13:44:48)

Add tests for extended view for keywords and whitespace rules


Patch:
diff --git a/src/robocop/linter/rules/errors.py b/src/robocop/linter/rules/errors.py
index 71bd91d..4d8bd4a 100644
--- a/src/robocop/linter/rules/errors.py
+++ b/src/robocop/linter/rules/errors.py
@@ -446,10 +446,12 @@ class ParsingErrorChecker(VisitorChecker):
             for setting in self.suite_settings:
                 if suite_sett_cand.startswith(setting):
                     if setting_error[0].strip():  # filter out "suite-setting-should-be-left-aligned"
+                        token = node.data_tokens[0]
                         self.report(
                             self.not_enough_whitespace_after_suite_setting,
                             setting_name=self.suite_settings[setting],
-                            node=node,
+                            node=token,
+                            end_col=token.end_col_offset + 1,
                         )
                     return
             error = error.replace("\n   ", "").replace("Robot Framework syntax error: ", "")
diff --git a/src/robocop/linter/rules/keywords.py b/src/robocop/linter/rules/keywords.py
index 326c606..15b7879 100644
--- a/src/robocop/linter/rules/keywords.py
+++ b/src/robocop/linter/rules/keywords.py
@@ -138,7 +138,7 @@ class NoEmbeddedKeywordArgumentsRule(Rule):
 
     name = "no-embedded-keyword-arguments"
     rule_id = "KW03"
-    message = "Not allowed embedded arguments {arguments} found in keyword '{keyword}'"
+    message = "Keyword with embedded arguments: {arguments}"
     severity = RuleSeverity.WARNING
     enabled = False
     added_in_version = "5.5.0"
@@ -247,5 +247,4 @@ class NoEmbeddedKeywordArgumentsChecker(VisitorChecker):  # TODO merge
             node=name_token,
             end_col=name_token.end_col_offset + 1,
             arguments=", ".join([t.value for t in variable_tokens]),
-            keyword=name_token,
         )


Test patch:
diff --git a/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_extended.txt b/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_extended.txt
new file mode 100644
index 0000000..3a68f9f
--- /dev/null
+++ b/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_extended.txt
@@ -0,0 +1,36 @@
+test.robot:9:1 KW03 Keyword with embedded arguments: ${one}
+   |
+ 9 | Keyword with ${one} embedded argument
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW03
+10 |     No Operation
+   |
+
+test.robot:12:1 KW03 Keyword with embedded arguments: ${count}, ${arguments}
+    |
+ 12 | Keyword with ${count} embedded ${arguments}
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW03
+ 13 |     No Operation
+    |
+
+test.robot:15:1 KW03 Keyword with embedded arguments: ${keyword}, ${with}, ${only}, ${embedded}, ${arguments}
+    |
+ 15 | ${keyword} ${with} ${only} ${embedded} ${arguments}
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW03
+ 16 |     No Operation
+    |
+
+test.robot:18:1 KW03 Keyword with embedded arguments: ${embedded}
+    |
+ 18 | Keyword with both ${embedded} and normal arguments
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW03
+ 19 |     [Arguments]    ${foo}
+ 20 |     No Operation
+    |
+
+test.robot:22:1 KW03 Keyword with embedded arguments: ${regex:(\d{4}-\d{2}-\d{2}|today)}
+    |
+ 22 | Keyword with embedded ${regex:(\d{4}-\d{2}-\d{2}|today)} argument
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW03
+ 23 |     No Operation
+    |
+
diff --git a/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_output.txt b/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_output.txt
index 892df98..b376b16 100644
--- a/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_output.txt
+++ b/tests/linter/rules/keywords/no_embedded_keyword_arguments/expected_output.txt
@@ -1,5 +1,5 @@
-test.robot:12:1 [W] KW03 Not allowed embedded arguments ${count}, ${arguments} found in keyword 'Keyword with ${count} embedded ${arguments}'
-test.robot:15:1 [W] KW03 Not allowed embedded arguments ${keyword}, ${with}, ${only}, ${embedded}, ${arguments} found in keyword '${keyword} ${with} ${only} ${embedded} ${arguments}'
-test.robot:18:1 [W] KW03 Not allowed embedded arguments ${embedded} found in keyword 'Keyword with both ${embedded} and normal arguments'
-test.robot:22:1 [W] KW03 Not allowed embedded arguments ${regex:(\d{4}-\d{2}-\d{2}|today)} found in keyword 'Keyword with embedded ${regex:(\d{4}-\d{2}-\d{2}|today)} argument'
-test.robot:9:1 [W] KW03 Not allowed embedded arguments ${one} found in keyword 'Keyword with ${one} embedded argument'
+test.robot:12:1 [W] KW03 Keyword with embedded arguments: ${count}, ${arguments}
+test.robot:15:1 [W] KW03 Keyword with embedded arguments: ${keyword}, ${with}, ${only}, ${embedded}, ${arguments}
+test.robot:18:1 [W] KW03 Keyword with embedded arguments: ${embedded}
+test.robot:22:1 [W] KW03 Keyword with embedded arguments: ${regex:(\d{4}-\d{2}-\d{2}|today)}
+test.robot:9:1 [W] KW03 Keyword with embedded arguments: ${one}
diff --git a/tests/linter/rules/keywords/no_embedded_keyword_arguments/test_rule.py b/tests/linter/rules/keywords/no_embedded_keyword_arguments/test_rule.py
index c025377..4a48afe 100644
--- a/tests/linter/rules/keywords/no_embedded_keyword_arguments/test_rule.py
+++ b/tests/linter/rules/keywords/no_embedded_keyword_arguments/test_rule.py
@@ -3,7 +3,7 @@ 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",
-        )
+        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/keywords/not_allowed_keyword/expected_extended.txt b/tests/linter/rules/keywords/not_allowed_keyword/expected_extended.txt
new file mode 100644
index 0000000..9cc8e1e
--- /dev/null
+++ b/tests/linter/rules/keywords/not_allowed_keyword/expected_extended.txt
@@ -0,0 +1,127 @@
+test.robot:2:16 KW02 Keyword 'Not Allowed' is not allowed
+   |
+ 1 | *** Settings ***
+ 2 | Suite Setup    Not Allowed
+   |                ^^^^^^^^^^^ KW02
+ 3 | Suite Teardown
+ 4 | Test Setup    Not Allowed
+   |
+
+test.robot:4:15 KW02 Keyword 'Not Allowed' is not allowed
+   |
+ 2 | Suite Setup    Not Allowed
+ 3 | Suite Teardown
+ 4 | Test Setup    Not Allowed
+   |               ^^^^^^^^^^^ KW02
+ 5 | Test Teardown    Not Allowed With Args
+ 6 | ...    ${arg}
+   |
+
+test.robot:5:18 KW02 Keyword 'Not Allowed With Args' is not allowed
+   |
+ 3 | Suite Teardown
+ 4 | Test Setup    Not Allowed
+ 5 | Test Teardown    Not Allowed With Args
+   |                  ^^^^^^^^^^^^^^^^^^^^^ KW02
+ 6 | ...    ${arg}
+   |
+
+test.robot:15:5 KW02 Keyword 'Not Allowed' is not allowed
+    |
+ 13 |
+ 14 | Test with not allowed keywords
+ 15 |     Not Allowed
+    |     ^^^^^^^^^^^ KW02
+ 16 |     IF    $condition    Notallowed
+ 17 |     FOR    ${var}    IN RANGE    10
+    |
+
+test.robot:16:25 KW02 Keyword 'Notallowed' is not allowed
+    |
+ 14 | Test with not allowed keywords
+ 15 |     Not Allowed
+ 16 |     IF    $condition    Notallowed
+    |                         ^^^^^^^^^^ KW02
+ 17 |     FOR    ${var}    IN RANGE    10
+ 18 |         Not_allowed With Args    ${arg}
+    |
+
+test.robot:18:9 KW02 Keyword 'Not_allowed With Args' is not allowed
+    |
+ 16 |     IF    $condition    Notallowed
+ 17 |     FOR    ${var}    IN RANGE    10
+ 18 |         Not_allowed With Args    ${arg}
+    |         ^^^^^^^^^^^^^^^^^^^^^ KW02
+ 19 |         ...    ${arg}
+ 20 |     END
+    |
+
+test.robot:23:9 KW02 Keyword 'Not Allowed' is not allowed
+    |
+ 21 |     IF    True
+ 22 |         Log    statement
+ 23 |         Not Allowed
+    |         ^^^^^^^^^^^ KW02
+ 24 |     END
+    |
+
+test.robot:28:12 KW02 Keyword 'Not Allowed' is not allowed
+    |
+ 26 | Test with settings
+ 27 |     [Setup]    Run Keywords
+ 28 |     ...    Not Allowed
+    |            ^^^^^^^^^^^ KW02
+ 29 |     ...    AND
+ 30 |     ...    Not Allowed
+    |
+
+test.robot:30:12 KW02 Keyword 'Not Allowed' is not allowed
+    |
+ 28 |     ...    Not Allowed
+ 29 |     ...    AND
+ 30 |     ...    Not Allowed
+    |            ^^^^^^^^^^^ KW02
+ 31 |     [Teardown]    Not Allowed With Args    ${arg}
+    |
+
+test.robot:31:19 KW02 Keyword 'Not Allowed With Args' is not allowed
+    |
+ 29 |     ...    AND
+ 30 |     ...    Not Allowed
+ 31 |     [Teardown]    Not Allowed With Args    ${arg}
+    |                   ^^^^^^^^^^^^^^^^^^^^^ KW02
+    |
+
+test.robot:34:19 KW02 Keyword 'Not Allowed' is not allowed
+    |
+ 32 |
+ 33 | Test with template
+ 34 |     [Template]    Not Allowed
+    |                   ^^^^^^^^^^^ KW02
+    |
+
+test.robot:38:5 KW02 Keyword 'Library.Not Allowed With Lib' is not allowed
+    |
+ 36 | Test with library
+ 37 |     Not Allowed With Lib  # should be ignored
+ 38 |     Library.Not Allowed With Lib  # should be reported
+    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW02
+ 39 |     Library2.Nested.Not Allowed  # should be reported
+    |
+
+test.robot:39:5 KW02 Keyword 'Library2.Nested.Not Allowed' is not allowed
+    |
+ 37 |     Not Allowed With Lib  # should be ignored
+ 38 |     Library.Not Allowed With Lib  # should be reported
+ 39 |     Library2.Nested.Not Allowed  # should be reported
+    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ KW02
+    |
+
+test.robot:44:5 KW02 Keyword 'Not Allowed' is not allowed
+    |
+ 42 | *** Keywords ***
+ 43 | Keyword with not allowed
+ 44 |     Not Allowed
+    |     ^^^^^^^^^^^ KW02
+    |
+
diff --git a/tests/linter/rules/keywords/not_allowed_keyword/test_rule.py b/tests/linter/rules/keywords/not_allowed_keyword/test_rule.py
index 81f89d0..09c1e1d 100644
--- a/tests/linter/rules/keywords/not_allowed_keyword/test_rule.py
+++ b/tests/linter/rules/keywords/not_allowed_keyword/test_rule.py
@@ -11,6 +11,15 @@ class TestRuleAcceptance(RuleAcceptance):
             test_on_version=">=5",
         )
 
+    def test_extended(self):
+        self.check_rule(
+            src_files=["test.robot"],
+            expected_file="expected_extended.txt",
+            configure=["not-allowed-keyword.keywords=NotAllowed,Not_AllowedWithArgs,library.not_allowed_with_lib"],
+            output_format="extended",
+            test_on_version=">=5",
+        )
+
     def test_rule_rf3(self):
         self.check_rule(
             src_files=["test.robot"],
diff --git a/tests/linter/rules/keywords/sleep_keyword_used/expected_extended.txt b/tests/linter/rules/keywords/sleep_keyword_used/expected_extended.txt
new file mode 100644
index 0000000..5c7fd10
--- /dev/null
+++ b/tests/linter/rules/keywords/sleep_keyword_used/expected_extended.txt
@@ -0,0 +1,38 @@
+test.robot:8:5 KW01 Sleep keyword with '10s' sleep time found
+   |
+ 6 | Test with sleeps
+ 7 |     Log    Let's sleep for some time.
+ 8 |     Sleep    10s
+   |     ^^^^^ KW01
+ 9 |     Log    It may not be enough, let's do it in loop.
+10 |     FOR    ${var}    IN RANGE    1    10
+   |
+
+test.robot:11:9 KW01 Sleep keyword with '${var}' sleep time found
+    |
+  9 |     Log    It may not be enough, let's do it in loop.
+ 10 |     FOR    ${var}    IN RANGE    1    10
+ 11 |         Sleep    ${var}  # non-parsable time strings are ignored
+    |         ^^^^^ KW01
+ 12 |     END
+ 13 |     IF    ${var} == 10
+    |
+
+test.robot:14:9 KW01 Sleep keyword with '1 min' sleep time found
+    |
+ 12 |     END
+ 13 |     IF    ${var} == 10
+ 14 |         Sleep
+    |         ^^^^^ KW01
+ 15 |         ...    1 min
+ 16 |     END
+    |
+
+test.robot:17:5 KW01 Sleep keyword with '' sleep time found
+    |
+ 15 |         ...    1 min
+ 16 |     END
+ 17 |     Sleep
+    |     ^^^^^ KW01
+    |
+
diff --git a/tests/linter/rules/keywords/sleep_keyword_used/test_rule.py b/tests/linter/rules/keywords/sleep_keyword_used/test_rule.py
index 8a677d0..b7411cb 100644
--- a/tests/linter/rules/keywords/sleep_keyword_used/test_rule.py
+++ b/tests/linter/rules/keywords/sleep_keyword_used/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_1s(self):
         self.check_rule(
             configure=["sleep-keyword-used.max_time=1s"],
diff --git a/tests/linter/rules/keywords/unused_keyword/expected_extended.txt b/tests/linter/rules/keywords/unused_keyword/expected_extended.txt
new file mode 100644
index 0000000..e69de29
diff --git a/tests/linter/rules/keywords/unused_keyword/test_rule.py b/tests/linter/rules/keywords/unused_keyword/test_rule.py
index 3d59a03..315c685 100644
--- a/tests/linter/rules/keywords/unused_keyword/test_rule.py
+++ b/tests/linter/rules/keywords/unused_keyword/test_rule.py
@@ -7,3 +7,6 @@ class TestRuleAcceptance(RuleAcceptance):
     @pytest.mark.xfail(reason="Project checker needs to be reimplemented")  # FIXME:
     def test_rule(self):
         self.check_rule(src_files=["."], expected_file="expected_output.txt", issue_format="end_col")
+
+    def test_extended(self):
+        self.check_rule(src_files=["."], expected_file="expected_extended.txt", output_format="extended")
diff --git a/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/expected_extended.txt b/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/expected_extended.txt
new file mode 100644
index 0000000..68e2b73
--- /dev/null
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/expected_extended.txt
@@ -0,0 +1,44 @@
+settings_errors.robot:3:1 SPC20 Not enough whitespace after '...' marker
+   |
+ 1 | *** Settings ***
+ 2 | Default Tags  tag
+ 3 | ... tag2
+   | ^^^ SPC20
+   |
+
+test.robot:12:5 SPC20 Not enough whitespace after '...' marker
+    |
+ 10 |     Keyword
+ 11 |     One More  ${var}
+ 12 |     ... ${var2}
+    |     ^^^ SPC20
+    |
+
+test.robot:18:5 SPC20 Not enough whitespace after '...' marker
+    |
+ 16 | Keyword
+ 17 |     [Documentation]  this is doc
+ 18 |     ... and new line
+    |     ^^^ SPC20
+ 19 |     No Operation
+ 20 |     Pass
+    |
+
+variable_errors.robot:3:1 SPC20 Not enough whitespace after '...' marker
+   |
+ 1 | *** Variables ***
+ 2 | ${var}
+ 3 | ... val
+   | ^^^ SPC20
+ 4 |  .... val
+ 5 | value
+   |
+
+variable_errors.robot:13:1 SPC20 Not enough whitespace after '...' marker
+    |
+ 11 | ....   c
+ 12 | ...
+ 13 | ...d
+    | ^^^ SPC20
+    |
+
diff --git a/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/test_rule.py b/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/test_rule.py
index e0553eb..931c17e 100644
--- a/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/test_rule.py
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_newline_marker/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/whitespace/not_enough_whitespace_after_setting/expected_extended.txt b/tests/linter/rules/whitespace/not_enough_whitespace_after_setting/expected_extended.txt
new file mode 100644
index 0000000..322a9a8
--- /dev/null
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_setting/expected_extended.txt
@@ -0,0 +1,20 @@
+test.robot:7:5 SPC19 Not enough whitespace after '[Documentation]' setting
+   |
+ 5 | *** Test Cases ***
+ 6 | Test
+ 7 |     [Documentation] doc
+   |     ^^^^^^^^^^^^^^^^^^^ SPC19
+ 8 |     [Tags]  sometag
+ 9 |     Pass
+   |
+
+test.robot:20:5 SPC19 Not enough whitespace after '[Arguments]' setting
+    |
+ 18 | Keyword
+ 19 |     [Documentation]  this is doc
+ 20 |     [Arguments] ${var}
+    |     ^^^^^^^^^^^^^^^^^^ SPC19
+ 21 |     No Operation
+ 22 |     Pass
+    |
+
diff --git a/tests/linter/rules/whitespace/not_enough_whitespace_after_setting/test_rule.py b/tests/linter/rules/whitespace/not_enough_whitespace_after_setting/test_rule.py
index cba6753..4a48afe 100644
--- a/tests/linter/rules/whitespace/not_enough_whitespace_after_setting/test_rule.py
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_setting/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/whitespace/not_enough_whitespace_after_suite_setting/expected_extended.txt b/tests/linter/rules/whitespace/not_enough_whitespace_after_suite_setting/expected_extended.txt
new file mode 100644
index 0000000..167aa52
--- /dev/null
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_suite_setting/expected_extended.txt
@@ -0,0 +1,100 @@
+test.robot:2:1 SPC22 Not enough whitespace after 'Library' setting
+   |
+ 1 | *** Settings ***
+ 2 | Library Collections
+   | ^^^^^^^^^^^^^^^^^^^ SPC22
+ 3 | Resource file.robot
+ 4 | Variablesvars.yaml
+   |
+
+test.robot:3:1 SPC22 Not enough whitespace after 'Resource' setting
+   |
+ 1 | *** Settings ***
+ 2 | Library Collections
+ 3 | Resource file.robot
+   | ^^^^^^^^^^^^^^^^^^^ SPC22
+ 4 | Variablesvars.yaml
+   |
+
+test.robot:4:1 SPC22 Not enough whitespace after 'Variables' setting
+   |
+ 2 | Library Collections
+ 3 | Resource file.robot
+ 4 | Variablesvars.yaml
+   | ^^^^^^^^^^^^^^^^^^ SPC22
+   |
+
+test.robot:6:1 SPC22 Not enough whitespace after 'Force Tags' setting
+   |
+ 6 | Force Tags tag
+   | ^^^^^^^^^^^^^^ SPC22
+ 7 | ...    tag2
+ 8 | Default Tagstag1    tag2
+   |
+
+test.robot:8:1 SPC22 Not enough whitespace after 'Default Tags' setting
+   |
+ 6 | Force Tags tag
+ 7 | ...    tag2
+ 8 | Default Tagstag1    tag2
+   | ^^^^^^^^^^^^^^^^ SPC22
+   |
+
+test.robot:13:1 SPC22 Not enough whitespace after 'Suite Setup' setting
+    |
+ 11 |
+ 12 | Timeout 1min
+ 13 | Suite Setup Keyword
+    | ^^^^^^^^^^^^^^^^^^^ SPC22
+ 14 | Suite Teardown Keyword2
+    |
+
+test.robot:14:1 SPC22 Not enough whitespace after 'Suite Teardown' setting
+    |
+ 12 | Timeout 1min
+ 13 | Suite Setup Keyword
+ 14 | Suite Teardown Keyword2
+    | ^^^^^^^^^^^^^^^^^^^^^^^ SPC22
+    |
+
+test.robot:16:1 SPC22 Not enough whitespace after 'Test Setup' setting
+    |
+ 16 | Test Setup Keyword
+    | ^^^^^^^^^^^^^^^^^^ SPC22
+ 17 | Test Teardown Keyword2
+ 18 | Testtimeout 1min
+    |
+
+test.robot:17:1 SPC22 Not enough whitespace after 'Test Teardown' setting
+    |
+ 15 |
+ 16 | Test Setup Keyword
+ 17 | Test Teardown Keyword2
+    | ^^^^^^^^^^^^^^^^^^^^^^ SPC22
+ 18 | Testtimeout 1min
+ 19 | Documentation this is doc
+    |
+
+test.robot:18:1 SPC22 Not enough whitespace after 'Test Timeout' setting
+    |
+ 16 | Test Setup Keyword
+ 17 | Test Teardown Keyword2
+ 18 | Testtimeout 1min
+    | ^^^^^^^^^^^^^^^^ SPC22
+ 19 | Documentation this is doc
+    |
+
+test.robot:19:1 SPC22 Not enough whitespace after 'Documentation' setting
+    |
+ 17 | Test Teardown Keyword2
+ 18 | Testtimeout 1min
+ 19 | Documentation this is doc
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^ SPC22
+    |
+
+test.robot:21:1 SPC22 Not enough whitespace after 'Metadata' setting
+    |
+ 21 | Metadata key value
+    | ^^^^^^^^^^^^^^^^^^ SPC22
+    |
+
diff --git a/tests/linter/rules/whitespace/not_enough_whitespace_after_suite_setting/test_rule.py b/tests/linter/rules/whitespace/not_enough_whitespace_after_suite_setting/test_rule.py
index cba6753..4a48afe 100644
--- a/tests/linter/rules/whitespace/not_enough_whitespace_after_suite_setting/test_rule.py
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_suite_setting/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/whitespace/not_enough_whitespace_after_variable/expected_extended.txt b/tests/linter/rules/whitespace/not_enough_whitespace_after_variable/expected_extended.txt
new file mode 100644
index 0000000..6133c6a
--- /dev/null
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_variable/expected_extended.txt
@@ -0,0 +1,16 @@
+test.robot:2:1 SPC21 Not enough whitespace after '${VAR} 1' variable name
+   |
+ 1 | *** Variables ***
+ 2 | ${VAR} 1
+   | ^^^^^^^^ SPC21
+ 3 |  ${VAR}  1
+ 4 |   ${VAR}  1
+   |
+
+test.robot:7:1 SPC21 Not enough whitespace after '@{LIST} value' variable name
+   |
+ 7 | @{LIST} value
+   | ^^^^^^^^^^^^^ SPC21
+ 8 | ...  value2
+   |
+
diff --git a/tests/linter/rules/whitespace/not_enough_whitespace_after_variable/test_rule.py b/tests/linter/rules/whitespace/not_enough_whitespace_after_variable/test_rule.py
index baefc3b..90605cb 100644
--- a/tests/linter/rules/whitespace/not_enough_whitespace_after_variable/test_rule.py
+++ b/tests/linter/rules/whitespace/not_enough_whitespace_after_variable/test_rule.py
@@ -4,3 +4,11 @@ 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", test_on_version=">=4")
+
+    def test_extended(self):
+        self.check_rule(
+            src_files=["test.robot"],
+            expected_file="expected_extended.txt",
+            output_format="extended",
+            test_on_version=">=4",
+        )