Rules list¶
This is the complete list of all Robocop rules grouped by categories. If you want to learn more about the rules and their features, see Rule basics.
There are over a 100 rules available in Robocop and they are organized into the following categories:
01: Base
02: Documentation
03: Naming
04: Errors
05: Lengths
06: Tags
07: Comments
08: Duplications
09: Misc
10: Spacing
Each rule has a 4-digit ID that contains: - a 2-digit category ID (listed above), followed by - a 2-digit rule number.
Below is the list of all built-in Robocop rules. Enjoy 😎
Documentation¶
missing-doc-keyword / W0201¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Missing documentation in '{{ name }}' keyword
Documentation:
Keyword documentation is displayed in a tooltip in most code editors, so it is recommended to write it for each keyword.
You can add documentation to keyword using following syntax:
*** Keywords ***
Keyword
[Documentation] Keyword documentation
Keyword Step
Other Step
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
missing-doc-test-case / W0202¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Missing documentation in '{{ name }}' test case
Documentation:
You can add documentation to test case using following syntax:
*** Test Cases ***
Test
[Documentation] Test documentation
Keyword Step
Other Step
The rule by default ignores templated test cases but it can be configured with:
robocop --configure missing-doc-test-case:ignore_templated:False
Possible values are: Yes
/ 1
/ True
(default) or No
/ False
/ 0
.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
whether templated tests should be documented or not |
missing-doc-suite / W0203¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Missing documentation in suite
Documentation:
You can add documentation to suite using following syntax:
*** Settings ***
Documentation Suite documentation
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
missing-doc-resource-file / W0204¶
Added in v2.8.0
⦁ Supported RF versions: All
Message:
Missing documentation in resource file
Documentation:
You can add documentation to resource file using following syntax:
*** Settings ***
Documentation Resource file documentation
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
Naming¶
not-allowed-char-in-name / W0301¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Not allowed character '{{ character }}' found in {{ block_name }} name
Documentation:
Reports not allowed characters found in Test Case or Keyword names. By default it’s a dot (.
). You can
configure what patterns are reported by calling:
robocop --configure not-allowed-char-in-name:pattern:regex_pattern
regex_pattern
should define regex pattern not allowed in names. For example [@\[]
pattern
would report any occurrence of @[
characters.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
pattern defining characters (not) allowed in a name |
wrong-case-in-keyword-name / W0302¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Keyword name '{{ keyword_name }}' does not follow case convention
Documentation:
Keyword names need to follow a specific case convention.
The convention can be set using convention
parameter and accepts
one of the 2 values: each_word_capitalized
or first_word_capitalized
.
By default, it’s configured to each_word_capitalized
, which requires each keyword to follow such convention:
*** Keywords ***
Fill Out The Form
Provide Shipping Address
Provide Payment Method
Click 'Next' Button
[Teardown] Log Form Data
You can also set it to first_word_capitalized
which requires first word to have first letter capital:
*** Keywords ***
Fill out the form
Provide shipping address
Provide payment method
Click 'Next' button
[Teardown] Log form data
The rule also accepts another parameter pattern
which can be used to configure words
that are accepted in the keyword name, even though they violate the case convention.
pattern
parameter accepts a regex pattern. For example, configuring it to robocop\.readthedocs\.io
would make such keyword legal:
Go To robocop.readthedocs.io Page
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
possible values: ‘each_word_capitalized’ (default) or ‘first_word_capitalized’ |
|
|
|
pattern for accepted words in keyword |
keyword-name-is-reserved-word / E0303¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
'{{ keyword_name }}' is a reserved keyword{{ error_msg }}
Documentation:
Do not use reserved names for keyword names. Following names are reserved:
IF
ELSE IF
ELSE
FOR
END
WHILE
CONTINUE
RETURN
TRY
EXCEPT
FINALLY
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
underscore-in-keyword-name / W0305¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Underscores in keyword name '{{ keyword_name }}' can be replaced with spaces
Documentation:
Bad ❌
keyword_with_underscores
Good ✅
Keyword Without Underscores
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
setting-name-not-in-title-case / W0306¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Setting name '{{ setting_name }}' should use title or upper case
Documentation:
Good ✅
*** Settings ***
Resource file.resource
*** Test Cases ***
Test
[DOCUMENTATION] Some documentation
Step
Bad ❌
*** Settings ***
resource file.resource
*** Test Cases ***
Test
[documentation] Some documentation
Step
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
section-name-invalid / W0307¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Section name should be in format '{{ section_title_case }}' or '{{ section_upper_case }}'
Documentation:
Good ✅
*** SETTINGS ***
*** Keywords ***
Bad ❌
*** keywords ***
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
not-capitalized-test-case-title / W0308¶
Added in v1.4.0
⦁ Supported RF versions: All
Message:
Test case '{{ test_name }}' title should start with capital letter
Documentation:
Good ✅
*** Test Cases ***
Validate user details
Bad ❌
*** Test Cases ***
validate user details
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
section-variable-not-uppercase / W0309¶
Added in v1.4.0
⦁ Supported RF versions: All
Message:
Section variable '{{ variable_name }}' name should be uppercase
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
non-local-variables-should-be-uppercase / W0310¶
Added in v1.4.0
⦁ Supported RF versions: All
Message:
Test, suite and global variables should be uppercase
Documentation:
Good ✅
Set Task Variable ${MY_VAR} 1
Set Suite Variable ${MY VAR} 1
Set Test Variable ${MY_VAR} 1
Set Global Variable ${MY VAR${nested}} 1
Bad ❌
Set Task Variable ${my_var} 1
Set Suite Variable ${My Var} 1
Set Test Variable ${myvar} 1
Set Global Variable ${my_var${NESTED}} 1
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
else-not-upper-case / E0311¶
Added in v1.5.0
⦁ Supported RF versions: All
Message:
ELSE and ELSE IF should be upper case
Documentation:
Good ✅
*** Keywords ***
Describe Temperature
[Arguments] ${degrees}
IF ${degrees} > ${30}
RETURN Hot
ELSE IF ${degrees} > ${15}
RETURN Warm
ELSE
RETURN Cold
Bad ❌
*** Keywords ***
Describe Temperature
[Arguments] ${degrees}
If ${degrees} > ${30}
RETURN Hot
else if ${degrees} > ${15}
RETURN Warm
Else
RETURN Cold
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
keyword-name-is-empty / E0312¶
Added in v1.8.0
⦁ Supported RF versions: All
Message:
Keyword name should not be empty
Documentation:
Remember to always add a keyword name and avoid such code:
*** Keywords ***
# no keyword name here!!!
Log To Console hi
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
test-case-name-is-empty / E0313¶
Added in v1.8.0
⦁ Supported RF versions: All
Message:
Test case name should not be empty
Documentation:
Remember to always add a test case name and avoid such code:
*** Test Cases ***
# no test case name here!!!
Log To Console hello
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-library-alias / E0314¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
Library alias should not be empty
Documentation:
Use non-empty name when using library import with alias.
Good ✅
*** Settings ***
Library CustomLibrary AS AnotherName
Bad ❌
*** Settings ***
Library CustomLibrary AS
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-library-alias / W0315¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
Library alias should not be the same as original name
Documentation:
Examples of rule violation:
*** Settings ***
Library CustomLibrary AS CustomLibrary # same as library name
Library CustomLibrary AS Custom Library # same as library name (spaces are ignored)
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
possible-variable-overwriting / I0316¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
Variable '{{ variable_name }}' may overwrite similar variable inside '{{ block_name }}' {{ block_type }}. Note that variables are case-insensitive, and also spaces and underscores are ignored.
Documentation:
Following assignments overwrite the same variable:
*** Keywords ***
Retrieve Usernames
${username} Get Username id=1
${User Name} Get Username id=2
${user_name} Get Username id=3
Use consistent variable naming guidelines to avoid unintended variable overwriting. Remember that variable names in Robot Framework are case-insensitive and underscores and whitespaces are ignored.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
hyphen-in-variable-name / I0317¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
Use underscore in variable name '{{ variable_name }}' instead of hyphens to avoid treating them like minus sign
Documentation:
Robot Framework supports evaluation of Python code inside ${ } brackets. For example:
That’s why there is a possibility that hyphen in name is not recognized as part of the name but as a minus sign. Better to use underscore instead:
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
bdd-without-keyword-call / W0318¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
BDD reserved keyword '{{ keyword_name }}' not followed by any keyword{{ error_msg }}
Documentation:
When using BDD reserved keywords (such as GIVEN, WHEN, AND, BUT or THEN) use them together with name of the keyword to run.
Good ✅
Given Setup Is Complete
When User Log In
Then User Should See Welcome Page
Bad ❌
Given
When User Log In
Then User Should See Welcome Page
Since those words are used for BDD style, it’s also recommended not to use them within the user keyword name.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
deprecated-statement / W0319¶
Added in v2.0.0
⦁ Supported RF versions: All
Message:
'{{ statement_name }}' is deprecated since Robot Framework version {{ version }}, use '{{ alternative }}' instead
Documentation:
This rule detects any piece of code that is marked as deprecated but still works in RF.
For example, Run Keyword
and Continue For Loop
keywords or [Return]
setting.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
not-allowed-char-in-filename / W0320¶
Added in v2.1.0
⦁ Supported RF versions: All
Message:
Not allowed character '{{ character }}' found in {{ block_name }} name
Documentation:
Reports not allowed pattern found in Suite names. By default, it’s a dot (.). You can configure what characters are reported by running:
robocop --configure not-allowed-char-in-filename:pattern:regex_pattern .
where regex_pattern
should define regex pattern for characters not allowed in names. For example [@[]
pattern would report any occurrence of @[
characters.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
pattern defining characters (not) allowed in a name |
deprecated-with-name / W0321¶
Added in v2.5.0
⦁ Supported RF versions: >=6.0
Message:
'WITH NAME' alias marker is deprecated since Robot Framework 6.0 version and will be removed in the future release. Use 'AS' instead
Documentation:
WITH NAME
marker that is used when giving an alias to an imported library is going to be renamed to AS
.
The motivation is to be consistent with Python that uses as
for similar purpose.
Code with the deprecated marker:
*** Settings ***
Library Collections WITH NAME AliasedName
Code with the supported marker:
*** Settings ***
Library Collections AS AliasedName
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
deprecated-singular-header / W0322¶
Added in v2.6.0
⦁ Supported RF versions: >=6.0
Message:
'{{ singular_header }}' singular header form is deprecated since RF 6.0 and will be removed in the future releases. Use '{{ plural_header }}' instead
Documentation:
Robot Framework 6.0 starts deprecation period for singular headers forms. The rationale behind this change is available at https://github.com/robotframework/robotframework/issues/4431
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
inconsistent-variable-name / W0323¶
Added in v3.2.0
⦁ Supported RF versions: All
Message:
Variable '{{ name }}' has inconsistent naming. First used as '{{ first_use }}'
Documentation:
Variable names are case-insensitive and ignore underscores and spaces. It is possible to write the variable in multiple ways and it will be a valid Robot Framework code. However, it makes it harder to maintain the code that does not follow the consistent naming.
Example:
*** Keywords ***
Check If User Is Admin
[Arguments] ${username}
${role} Get User Role ${username}
IF '${ROLE}' == 'Admin' # inconsistent name with ${role}
Log ${Username} is an admin # inconsistent name with ${username}
ELSE
Log ${user name} is not an admin # inconsistent name
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
overwriting-reserved-variable / W0324¶
Added in v3.2.0
⦁ Supported RF versions: All
Message:
{{ var_or_arg }} '{{ variable_name }}' overwrites reserved variable '{{ reserved_variable }}'
Documentation:
Overwriting reserved variables may bring unexpected results.
For example, overwriting variable with name ${LOG_LEVEL}
can break Robot Framework logging.
See the full list of reserved variables at
Robot Framework User Guide
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-section / E0325¶
Added in v3.2.0
⦁ Supported RF versions: >=6.1
Message:
Invalid section '{{ invalid_section }}'. Consider using --language parameter if the file is defined with different language
Documentation:
Robot Framework 6.1 detects unrecognized sections based on the language defined for the specific files.
Consider using --language
parameter if the file is defined with different language.
It is also possible to configure language in the file:
language: pl
*** Przypadki Testowe ***
Wypisz dyrektywę 4
Log Błąd dostępu
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
mixed-task-test-settings / W0326¶
Added in v3.3.0
⦁ Supported RF versions: All
Message:
Use {{ task_or_test }}-related setting '{{ setting }}' if {{ tasks_or_tests }} section is used
Documentation:
If *** Tasks ***
section is present in the file, use task-related settings like Task Setup
,
Task Teardown
, Task Template
, Task Tags
and Task Timeout
instead of their Test variants.
Similarly, use test-related settings when using *** Test Cases ***
section.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
replace-set-variable-with-var / I0327¶
Added in v5.0.0
⦁ Supported RF versions: >=7.0
Message:
{{ set_variable_keyword }} can be replaced with VAR
Documentation:
Starting from Robot Framework 7.0, it is possible to create variables inside tests and user keywords using the VAR syntax. The VAR syntax is recommended over previously existing keywords.
Example with Set Variable keywords:
*** Keywords ***
Set Variables To Different Scopes
Set Local Variable ${local} value
Set Test Variable ${TEST_VAR} value
Set Task Variable ${TASK_VAR} value
Set Suite Variable ${SUITE_VAR} value
Set Global Variable ${GLOBAL_VAR} value
Can be now rewritten to:
*** Keywords ***
Set Variables To Different Scopes
VAR ${local} value
VAR ${TEST_VAR} value scope=TEST
VAR ${TASK_VAR} value scope=TASK
VAR ${SUITE_VAR} value scope=SUITE
VAR ${GLOBAL_VAR} value scope=GLOBAL
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
replace-create-with-var / I0328¶
Added in v5.0.0
⦁ Supported RF versions: >=7.0
Message:
{{ create_keyword }} can be replaced with VAR
Documentation:
Starting from Robot Framework 7.0, it is possible to create variables inside tests and user keywords using the VAR syntax. The VAR syntax is recommended over previously existing keywords.
Example with Create keywords:
*** Keywords ***
Create Variables
@{list} Create List a b
&{dict} Create Dictionary key=value
Can be now rewritten to:
*** Keywords ***
Create Variables
VAR @{list} a b
VAR &{dict} key=value
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
Errors¶
parsing-error / E0401¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Robot Framework syntax error: {{ error_msg }}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
not-enough-whitespace-after-setting / E0402¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Provide at least two spaces after '{{ setting_name }}' setting
Documentation:
Example of rule violation:
*** Test Cases ***
Test
[Documentation] doc # only one space after [Documentation]
Keyword
*** Keywords ***
Keyword
[Documentation] This is doc
[Arguments] ${var} # only one space after [Arguments]
Should Be True ${var}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
missing-keyword-name / E0403¶
Added in v1.8.0
⦁ Supported RF versions: All
Message:
Missing keyword name when calling some values
Documentation:
Example of rule violation:
*** Keywords ***
Keyword
${var}
${one} ${two}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
variables-import-with-args / E0404¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
YAML variable files do not take arguments
Documentation:
Example of rule violation:
*** Settings ***
Variables vars.yaml arg1
Variables variables.yml arg2
Variables module arg3 # valid from RF > 5
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-continuation-mark / E0405¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
Invalid continuation mark '{{ mark }}'. It should be '...'
Documentation:
Example of rule violation:
Keyword
.. ${var} # .. instead of ...
... 1
.... 2 # .... instead of ...
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
not-enough-whitespace-after-newline-marker / E0406¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
Provide at least two spaces after '...' marker
Documentation:
Example of rule violation:
@{LIST} 1
... 2 # not enough whitespace
... 3
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-argument / E0407¶
Added in v1.11.0
⦁ Supported RF versions: >=4.0
Message:
{{ error_msg }}
Documentation:
Argument names should follow variable naming syntax: start with identifier ($
, @
or &
) and enclosed in
curly brackets ({}
).
Valid names:
Keyword
[Arguments] ${var} @{args} &{config} ${var}=default
Invalid names:
Keyword
[Arguments] {var} @args} var=default
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
non-existing-setting / E0408¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
{{ error_msg }}
Documentation:
Non-existing setting can’t be used in the code.
Example of rule violation:
*** Test Cases ***
My Test Case
[Not Existing] arg
[Arguments] ${arg}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
setting-not-supported / E0409¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
Setting '[{{ setting_name }}]' is not supported in {{ test_or_keyword }}. Allowed are: {{ allowed_settings }}
Documentation:
Following settings are supported in Test Case or Task:
[Documentation] Used for specifying a test case documentation.
[Tags] Used for tagging test cases.
[Setup] Used for specifying a test setup.
[Teardown] Used for specifying a test teardown.
[Template] Used for specifying a template keyword.
[Timeout] Used for specifying a test case timeout.
Following settings are supported in Keyword:
[Documentation] Used for specifying a user keyword documentation.
[Tags] Used for specifying user keyword tags.
[Arguments] Used for specifying user keyword arguments.
[Return] Used for specifying user keyword return values.
[Teardown] Used for specifying user keyword teardown.
[Timeout] Used for specifying a user keyword timeout.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
not-enough-whitespace-after-variable / E0410¶
Added in v1.11.0
⦁ Supported RF versions: >=4.0
Message:
Provide at least two spaces after '{{ variable_name }}' variable name
Documentation:
Example of rule violation:
${variable} 1 # not enough whitespace
${other_var} 2
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
not-enough-whitespace-after-suite-setting / E0411¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
Provide at least two spaces after '{{ setting_name }}' setting
Documentation:
Example of rule violation:
*** Settings ***
Library Collections # not enough whitespace
Force Tags tag
... tag2
Suite Setup Keyword # not enough whitespace
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-for-loop / E0412¶
Added in v1.11.0
⦁ Supported RF versions: >=4.0
Message:
Invalid for loop syntax: {{ error_msg }}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-if / E0413¶
Added in v1.11.0
⦁ Supported RF versions: >=4.0
Message:
Invalid IF syntax: {{ error_msg }}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
return-in-test-case / E0414¶
Added in v2.0.0
⦁ Supported RF versions: >=5.0
Message:
RETURN can only be used inside a user keyword
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-section-in-resource / E0415¶
Added in v3.1.0
⦁ Supported RF versions: All
Message:
Resource file can't contain '{{ section_name }}' section
Documentation:
The higher-level structure of resource files is the same as that of test case files, but they can’t contain Test Cases or Tasks sections.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
invalid-setting-in-resource / E0416¶
Added in v3.3.0
⦁ Supported RF versions: All
Message:
Settings section in resource file can't contain '{{ section_name }}' setting
Documentation:
The Setting section in resource files can contain only import settings (Library
,
Resource
, Variables
), Documentation
and Keyword Tags
.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
unsupported-setting-in-init-file / E0417¶
Added in v3.3.0
⦁ Supported RF versions: All
Message:
Setting '{{ setting }}' is not supported in initialization files
Documentation:
Settings Default Tags
and Test Template
are not supported in initialization files.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
Lengths¶
too-long-keyword / W0501¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Keyword '{{ keyword_name }}' is too long ({{ keyword_length }}/{{ allowed_length}})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_len
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_len
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of lines allowed in a keyword |
|
|
|
Ignore documentation |
too-few-calls-in-keyword / W0502¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Keyword '{{ keyword_name }}' has too few keywords inside ({{ keyword_count }}/{{ min_allowed_count }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter min_calls
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set min_calls
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of keyword calls required in a keyword |
too-many-calls-in-keyword / W0503¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Keyword '{{ keyword_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_calls
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_calls
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of keyword calls allowed in a keyword |
too-long-test-case / W0504¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Test case '{{ test_name }}' is too long ({{ test_length }}/{{ allowed_length }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_len
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_len
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of lines allowed in a test case |
|
|
|
Ignore documentation |
too-many-calls-in-test-case / W0505¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Test case '{{ test_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }})
Documentation:
Redesign the test and move complex logic to separate keywords to increase readability.
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_calls
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_calls
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of keyword calls allowed in a test case |
|
|
|
Ignore templated tests |
file-too-long / W0506¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
File has too many lines ({{ lines_count }}/{{max_allowed_count }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_lines
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_lines
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of lines allowed in a file |
too-many-arguments / W0507¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Keyword '{{ keyword_name }}' has too many arguments ({{ arguments_count }}/{{ max_allowed_count }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_args
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_args
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of lines allowed in a file |
line-too-long / W0508¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Line is too long ({{ line_length }}/{{ allowed_length }})
Documentation:
It is possible to ignore lines that match regex pattern. Configure it using following option:
robocop --configure line-too-long:ignore_pattern:pattern
The default pattern is https?://\S+
that ignores the lines that look like an URL.
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter line_length
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set line_length
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of characters allowed in line |
|
|
|
ignore lines that contain configured pattern |
empty-section / W0509¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Section '{{ section_name }}' is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
number-of-returned-values / W0510¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Too many return values ({{ return_count }}/{{ max_allowed_count }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_returns
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_returns
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
allowed number of returned values from a keyword |
empty-metadata / W0511¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Metadata settings does not have any value set
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-documentation / W0512¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Documentation of {{ block_name }} is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-variables-import / E0515¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Import variables path is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-resource-import / E0516¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Import resource path is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-library-import / E0517¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Import library path is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-setup / E0518¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Setup of {{ block_name }} does not have any keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-suite-setup / E0519¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Suite Setup does not have any keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-test-setup / E0520¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Test Setup does not have any keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-teardown / E0521¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Teardown of {{ block_name }} does not have any keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-suite-teardown / E0522¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Suite Teardown does not have any keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-test-teardown / E0523¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Test Teardown does not have any keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-timeout / W0524¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Timeout of {{ block_name }} is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-test-timeout / W0525¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Test Timeout is empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-arguments / E0526¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Arguments of {{ block_name }} are empty
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
too-many-test-cases / W0527¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
Too many test cases ({{ test_count }}/{{ max_allowed_count }})
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_testcases or max_templated_testcases
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_testcases or max_templated_testcases
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of test cases allowed in a suite |
|
|
|
number of test cases allowed in a templated suite |
too-few-calls-in-test-case / E0528¶
Added in v2.4.0
⦁ Supported RF versions: All
Message:
Test case '{{ test_name }}' has too few keywords inside ({{ keyword_count }}/{{ min_allowed_count }})
Documentation:
Test without keywords will fail. Add more keywords or set results using Fail
, Pass Execution
or
Skip
keywords:
*** Test Cases ***
Test case
[Tags] smoke
Skip Test case draft
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of keyword calls required in a test case |
|
|
|
Ignore templated tests |
empty-test-template / E0529¶
Added in v3.1.0
⦁ Supported RF versions: All
Message:
Test Template is empty
Documentation:
Test Template
sets the template to all tests in a suite. Empty value is considered an error
because it leads the users to wrong impression on how the suite operates.
Without value, the setting is ignored and the tests are not templated.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-template / W0530¶
Added in v3.1.0
⦁ Supported RF versions: All
Message:
Template of {{ block_name }} is empty. To overwrite suite Test Template use more explicit [Template] NONE
Documentation:
The [Template]
setting overrides the possible template set in the Setting section, and an empty value for
[Template]
means that the test has no template even when Test Template is used.
If it is intended behaviour, use more explicit NONE
value to indicate that you want to overwrite suite
Test Template:
*** Settings ***
Test Template Template Keyword
*** Test Cases ***
Templated test
argument
Not templated test
[Template] NONE
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
arguments-per-line / I0532¶
Added in v5.0.0
⦁ Supported RF versions: All
Message:
There is too many arguments per continuation line ({{ arguments_count }} / {{ max_arguments_count }})
Documentation:
If the keyword’s [Arguments]
are split into multiple lines, it is recommended to put only one argument
per every line.
Bad ❌
*** Keywords ***
Keyword With Multiple Arguments
[Arguments] ${first_arg
... ${second_arg} ${third_arg}=default
Good ✅
.. code-block:: none
* Keywords * Keyword With Multiple Arguments [Arguments] ${first_arg … ${second_arg} … ${third_arg}=default
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
maximum number of arguments allowed in the continuation line |
Duplications¶
duplicated-test-case / E0801¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Multiple test cases with name '{{ name }}' (first occurrence in line {{ first_occurrence_line }})
Documentation:
It is not allowed to reuse the same name of the test case within the same suite in Robot Framework. Name matching is case-insensitive and ignores spaces and underscore characters. Duplicated test cases example:
*** Test Cases ***
Test with name
No Operation
test_with Name # it is a duplicate of 'Test with name'
No Operation
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-keyword / E0802¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Multiple keywords with name '{{ name }}' (first occurrence in line {{ first_occurrence_line }})
Documentation:
Do not define keywords with the same name inside the same file. Name matching is case-insensitive and ignores spaces and underscore characters. Duplicated keyword names example:
*** Keywords ***
Keyword
No Operation
keyword
No Operation
K_eywor d
No Operation
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-variable / E0803¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Multiple variables with name '{{ name }}' in Variables section (first occurrence in line {{ first_occurrence_line }}). Note that Robot Framework is case-insensitive
Documentation:
Variable names in Robot Framework are case-insensitive and ignore spaces and underscores. Following variables are duplicates:
*** Variables ***
${variable} 1
${VARIAble} a
@{variable} a b
${v ariabl e} c
${v_ariable} d
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-resource / W0804¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Multiple resource imports with path '{{ name }}' (first occurrence in line {{ first_occurrence_line }})
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-library / W0805¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Multiple library imports with name '{{ name }}' and identical arguments (first occurrence in line {{ first_occurrence_line }})
Documentation:
If you need to reimport library use alias:
*** Settings ***
Library RobotLibrary
Library RobotLibrary AS OtherRobotLibrary
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-metadata / W0806¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Duplicated metadata '{{ name }}' (first occurrence in line {{ first_occurrence_line }})
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-variables-import / W0807¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Duplicated variables import with path '{{ name }}' (first occurrence in line {{ first_occurrence_line }})
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
section-already-defined / W0808¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
'{{ section_name }}' section header already defined in file (first occurrence in line {{ first_occurrence_line }})
Documentation:
Duplicated section in the file. Robot Framework will handle repeated sections but it is recommended to not duplicate them.
Example:
*** Test Cases ***
My Test
Keyword
*** Keywords ***
Keyword
No Operation
*** Test Cases *** # duplicate
Other Test
Keyword
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
section-out-of-order / W0809¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
'{{ section_name }}' section header is defined in wrong order: {{ recommended_order }}
Documentation:
Sections should be defined in order set by sections_order
parameter (default: settings,variables,testcases,keywords
).
To change the default order use following option:
robocop --configure section-out-of-order:sections_order:comma,separated,list,of,sections
where section should be case-insensitive name from the list: comments, settings, variables, testcases, keywords. Order of not configured sections is ignored.
Example:
*** Settings ***
*** Keywords ***
*** Test Cases *** # it will report issue because Test Cases should be defined before Keywords
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
order of sections in comma-separated list |
both-tests-and-tasks / E0810¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Both Task(s) and Test Case(s) section headers defined in file
Documentation:
The file contains both *** Test Cases ***
and *** Tasks ***
sections. Use only one of them.
*** Test Cases ***
*** Tasks ***
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-argument-name / E0811¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
Argument name '{{ argument_name }}' is already used
Documentation:
Variable names in Robot Framework are case-insensitive and ignores spaces and underscores. Following arguments are duplicates:
*** Keywords ***
Keyword
[Arguments] ${var} ${VAR} ${v_ar} ${v ar}
Other Keyword
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-assigned-var-name / I0812¶
Added in v1.12.0
⦁ Supported RF versions: All
Message:
Assigned variable name '{{ variable_name }}' is already used
Documentation:
Variable names in Robot Framework are case-insensitive and ignores spaces and underscores. Following variables are duplicates:
*** Test Cases ***
Test
${var} ${VAR} ${v_ar} ${v ar} Keyword
It is possible to use ${_} to note that variable name is not important and will not be used:
*** Keywords ***
Get Middle Element
[Arguments] ${list}
${_} ${middle} ${_} Split List ${list}
RETURN ${middle}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
duplicated-setting / W0813¶
Added in v2.0.0
⦁ Supported RF versions: All
Message:
{{ error_msg }}
Documentation:
Some settings can be used only once in a file. Only the first value is used. Example:
*** Settings ***
Force Tags F1
Force Tags F2 # this setting will be ignored
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
Misc¶
keyword-after-return / W0901¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
{{ error_msg }}
Documentation:
To improve readability use [Return]
setting at the end of the keyword. If you want to return immediately
from the keyword, use RETURN
statement instead. [Return]
does not return from the keyword but only
sets the values that will be returned at the end of the keyword.
Bad:
Keyword
Step
[Return] ${variable}
${variable} Other Step
Good:
Keyword
Step
${variable} Other Step
[Return] ${variable}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-return / W0903¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
[Return] is empty
Documentation:
[Return]
statement is used to define variables returned from keyword. If you don’t return anything from
keyword, don’t use [Return]
.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
nested-for-loop / E0907¶
Added in v1.0.0
⦁ Supported RF versions: <4.0
Message:
Nested for loops are not supported. You can use keyword with for loop instead
Documentation:
Older versions of Robot Framework did not support nested for loops:
FOR ${var} IN RANGE 10
FOR ${other_var} IN a b
# Nesting supported from Robot Framework 4.0+
END
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
if-can-be-used / I0908¶
Added in v1.4.0
⦁ Supported RF versions: ==4.*
Message:
'{{ run_keyword }}' can be replaced with IF block since Robot Framework 4.0
Documentation:
Starting from Robot Framework 4.0 Run Keyword If
and Run Keyword Unless
can be replaced by IF block.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
inconsistent-assignment / W0909¶
Added in v1.7.0
⦁ Supported RF versions: All
Message:
The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead
Documentation:
Use only one type of assignment sign in a file.
Example of rule violation:
*** Keywords ***
Keyword
${var} = Other Keyword
No Operation
Keyword 2
No Operation
${var} ${var2} Some Keyword # this assignment doesn't use equal sign while the previous one uses ' ='
By default Robocop looks for most popular assignment sign in the file. It is possible to define expected assignment sign by running:
robocop --configure inconsistent-assignment:assignment_sign_type:equal_sign
You can choose between following signs: ‘autodetect’ (default), ‘none’, ‘equal_sign’ (=
) or
space_and_equal_sign (`` =``).
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
possible values: ‘autodetect’ (default), ‘none’ (‘’), ‘equal_sign’ (‘=’) or space_and_equal_sign (’ =’) |
inconsistent-assignment-in-variables / W0910¶
Added in v1.7.0
⦁ Supported RF versions: All
Message:
The assignment sign is not consistent inside the variables section. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead
Documentation:
Use one type of assignment sign in Variables section.
Example of rule violation:
*** Variables ***
${var} = 1
${var2}= 2
${var3} = 3
${var4} a
${var5} b
By default, Robocop looks for the most popular assignment sign in the file. It is possible to define expected assignment sign by running:
robocop --configure inconsistent-assignment-in-variables:assignment_sign_type:equal_sign
You can choose between following signs: ‘autodetect’ (default), ‘none’, ‘equal_sign’ (=
) or
space_and_equal_sign (`` =``).
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
possible values: ‘autodetect’ (default), ‘none’ (‘’), ‘equal_sign’ (‘=’) or space_and_equal_sign (’ =’) |
wrong-import-order / W0911¶
Added in v1.7.0
⦁ Supported RF versions: All
Message:
BuiltIn library import '{{ builtin_import }}' should be placed before '{{ custom_import }}'
Documentation:
Example of rule violation:
*** Settings ***
Library Collections
Library CustomLibrary
Library OperatingSystem # BuiltIn library defined after custom CustomLibrary
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-variable / I0912¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
Use built-in variable {{ var_type }}{EMPTY} instead of leaving variable without value or using backslash
Documentation:
Variables with placeholder ${EMPTY} values are more explicit.
Example of rule violation:
*** Variables ***
${VAR_NO_VALUE} # missing value
${VAR_WITH_EMPTY} ${EMPTY}
@{MULTILINE_FIRST_EMPTY}
... # missing value
... value
${EMPTY_WITH_BACKSLASH} \ # used backslash
*** Keywords ***
Create Variables
VAR ${var_no_value} # missing value
VAR ${var_with_empty} ${EMPTY}
You can configure empty-variable
rule to run only in `*** Variables ***`
section or on
VAR
statements using variable_source
parameter.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
Variable sources that will be checked |
can-be-resource-file / I0913¶
Added in v1.10.0
⦁ Supported RF versions: All
Message:
No tests in '{{ file_name }}' file, consider renaming to '{{ file_name_stem }}.resource'
Documentation:
If the Robot file contains only keywords or variables, it’s a good practice to use .resource
extension.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
if-can-be-merged / I0914¶
Added in v2.0.0
⦁ Supported RF versions: >=4.0
Message:
IF statement can be merged with previous IF (defined in line {{ line }})
Documentation:
IF
statement follows another IF
with identical conditions. It can be possibly merged into one.
Example of rule violation:
IF ${var} == 4
Keyword
END
# comments are ignored
IF ${var} == 4
Keyword 2
END
IF
statement is considered identical only if all branches have identical conditions.
Similar but not identical IF
:
IF ${variable}
Keyword
ELSE
Other Keyword
END
IF ${variable}
Keyword
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
statement-outside-loop / E0915¶
Added in v2.0.0
⦁ Supported RF versions: >=5.0
Message:
{{ name }} {{ statement_type }} used outside a loop
Documentation:
- Following keywords and statements should only be used inside loop (
WHILE
orFOR
): Exit For Loop
Exit For Loop If
Continue For Loop
Continue For Loop If
CONTINUE
BREAK
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
inline-if-can-be-used / I0916¶
Added in v2.0.0
⦁ Supported RF versions: >=5.0
Message:
IF can be replaced with inline IF
Documentation:
Short and simple IF
statements can be replaced with inline IF
.
Following IF
:
IF $condition
BREAK
END
can be replaced with:
IF $condition BREAK
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter max_width
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set max_width
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
maximum width of IF (in characters) below which it will be recommended to use inline IF |
unreachable-code / W0917¶
Added in v3.1.0
⦁ Supported RF versions: >=5.0
Message:
Unreachable code after {{ statement }} statement
Documentation:
Detect the unreachable code after RETURN
, BREAK
or CONTINUE
statements.
For example:
Example Keyword
FOR ${animal} IN cat dog
IF '${animal}' == 'cat'
CONTINUE
Log ${animal} # unreachable log
END
BREAK
Log Unreachable log
END
RETURN
Log Unreachable log
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
multiline-inline-if / W0918¶
Added in v3.1.0
⦁ Supported RF versions: >=5.0
Message:
Avoid splitting inline IF to multiple lines
Documentation:
It’s allowed to create inline IF
that spans multiple lines, but it should be avoided,
since it decreases readability. Try to use normal IF
/ELSE
instead.
Bad:
IF ${condition} Log hello
... ELSE Log hi!
Good:
IF ${condition} Log hello ELSE Log hi!
or also good:
IF ${condition}
Log hello
ELSE
Log hi!
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
unused-argument / W0919¶
Added in v3.2.0
⦁ Supported RF versions: All
Message:
Keyword argument '{{ name }}' is not used
Documentation:
Keyword argument was defined but not used:
*** Keywords ***
Keyword
[Arguments] ${used} ${not_used} # will report ${not_used}
Log ${used}
IF $used
Log Escaped syntax is supported.
END
Keyword with ${embedded} and ${not_used} # will report ${not_used}
Log ${embedded}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
unused-variable / I0920¶
Added in v3.2.0
⦁ Supported RF versions: All
Message:
Variable '{{ name }}' is assigned but not used
Documentation:
Variable was assigned but not used:
*** Keywords ***
Get Triangle Base Points
[Arguments] ${triangle}
${p1} ${p2} ${p3} Get Triangle Points ${triangle}
Log Triangle base points are: ${p1} and ${p2}.
RETURN ${p1} ${p2} # ${p3} is never used
Use ${_}
variable name if you purposefully do not use variable:
*** Keywords ***
Process Value 10 Times
[Arguments] ${value}
FOR ${_} IN RANGE 10
Process Value ${value}
END
Note that some keywords may use your local variables even if you don’t pass them directly. For example
BuiltIn Replace Variables
or any custom keyword that retrieves variables from local scope. In such case
Robocop will still raise unused-variable
even if variable is used.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
argument-overwritten-before-usage / W0921¶
Added in v3.2.0
⦁ Supported RF versions: All
Message:
Keyword argument '{{ name }}' is overwritten before usage
Documentation:
Keyword argument was overwritten before it is used:
*** Keywords ***
Overwritten Argument
[Arguments] ${overwritten} # we do not use ${overwritten} value at all
${overwritten} Set Variable value # we only overwrite it
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
variable-overwritten-before-usage / W0922¶
Added in v3.2.0
⦁ Supported RF versions: All
Message:
Local variable '{{ name }}' is overwritten before usage
Documentation:
Local variable in Keyword, Test Case or Task is overwritten before it is used:
*** Keywords ***
Overwritten Variable
${value} Keyword
${value} Keyword
In case the value of the variable is not important, it is possible to use ${_}
name:
*** Test Cases ***
Call keyword and ignore some return values
${_} ${item} Unpack List @{LIST}
FOR ${_} IN RANGE 10
Log Run this code 10 times.
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
unnecessary-string-conversion / I0923¶
Warning
Rule is deprecated.
Added in v4.0.0
⦁ Supported RF versions: >=4.0
Message:
Variable '{{ name }}' in '{{ block_name }}' condition has unnecessary string conversion
Documentation:
Expressions in Robot Framework are evaluated using Python’s eval function. When a variable is used
in the expression using the normal ${variable}
syntax, its value is replaced before the expression
is evaluated. For example, with the following expression:
*** Test Cases ***
Check if schema was uploaded
Upload Schema schema.avsc
Check If File Exist In SFTP schema.avsc
*** Keywords ***
Upload Schema
[Arguments] ${filename}
IF ${filename} == 'default'
${filename} Get Default Upload Path
END
Send File To SFTP Root ${filename}
“${filename}” will be replaced by “schema.avsc”:
IF schema.avsc == 'default'
“schema.avsc” will not be recognized as Python variable. That’s why you need to quote it:
IF '${filename}' == 'default'
However it introduces unnecessary string conversion and can mask difference in the type. For example:
${numerical} Set Variable 10 # ${numerical} is actually string 10, not integer 10
IF "${numerical}" == "10"
You can use $variable
syntax instead:
IF $numerical == 10
It will put the actual variable in the evaluated expression without converting it to string.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
expression-can-be-simplified / I0924¶
Added in v4.0.0
⦁ Supported RF versions: >=4.0
Message:
'{{ block_name }}' condition can be simplified
Documentation:
Evaluated expression can be simplified. For example:
*** Keywords ***
Click On Element
[Arguments] ${locator}
IF ${is_element_visible}==${TRUE} RETURN
${is_element_enabled} Set Variable ${TRUE}
WHILE ${is_element_enabled} != ${TRUE}
${is_element_enabled} Get Element Status ${locator}
END
Click ${locator}
can be rewritten to:
*** Keywords ***
Click On Element
[Arguments] ${locator}
IF ${is_element_visible} RETURN
${is_element_enabled} Set Variable ${FALSE}
WHILE not ${is_element_enabled}
${is_element_enabled} Get Element Status ${locator}
END
Click ${locator}
Comparisons to empty sequences (lists, dicts, sets), empty string or 0
can be also simplified:
*** Test Cases ***
Check conditions
Should Be True ${list} == [] # equivalent of 'not ${list}'
Should Be True ${string} != "" # equivalent of '${string}'
Should Be True len(${sequence})) # equivalent of '${sequence}'
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
misplaced-negative-condition / I0925¶
Added in v4.0.0
⦁ Supported RF versions: >=4.0
Message:
'{{ block_name }}' condition '{{ original_condition }}' can be rewritten to '{{ proposed_condition }}'
Documentation:
Position of not operator can be changed for better readability.
For example:
*** Keywords ***
Check Unmapped Codes
${codes} Get Codes From API
IF not ${codes} is None
FOR ${code} IN @{codes}
Validate Single Code ${code}
END
ELSE
Fail Did not receive codes from API.
END
Can be rewritten to:
*** Keywords ***
Check Unmapped Codes
${codes} Get Codes From API
IF ${codes} is not None
FOR ${code} IN @{codes}
Validate Single Code ${code}
END
ELSE
Fail Did not receive codes from API.
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
builtin-imports-not-sorted / W0926¶
Added in v5.2.0
⦁ Supported RF versions: All
Message:
BuiltIn library import '{{ builtin_import }}' should be placed before '{{ previous_builtin_import }}'
Documentation:
Example of rule violation:
*** Settings ***
Library OperatingSystem
Library Collections # BuiltIn libraries imported not in alphabetical order
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
test-case-section-out-of-order / W0927¶
Added in v5.3.0
⦁ Supported RF versions: All
Message:
'{{ section_name }}' is in wrong place of Test Case. Recommended order of elements in Test Cases: {{ recommended_order }}
Documentation:
Sections should be defined in order set by sections_order
parameter (default: documentation,tags,timeout,setup,template,keyword,teardown
).
To change the default order use following option:
robocop --configure test-case-section-out-of-order:sections_order:comma,separated,list,of,sections
where section should be case-insensitive name from the list: documentation, tags, timeout, setup, template, keywords, teardown. Order of not configured sections is ignored.
Example of rule violation:
*** Test Cases ***
Keyword After Teardown
[Documentation] This is test Documentation
[Tags] tag1 tag2
[Teardown] Log abc
Keyword1
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
order of sections in comma-separated list |
keyword-section-out-of-order / W0928¶
Added in v5.3.0
⦁ Supported RF versions: All
Message:
'{{ section_name }}' is in wrong place of Keyword. Recommended order of elements in Keyword: {{ recommended_order }}
Documentation:
Sections should be defined in order set by sections_order
parameter (default: documentation,tags,arguments,timeout,setup,keyword,teardown
).
To change the default order use following option:
robocop --configure keyword-section-out-of-order:sections_order:comma,separated,list,of,sections
where section should be case-insensitive name from the list: documentation, tags, arguments, timeout, setup, keyword, teardown. Order of not configured sections is ignored.
Example of rule violation:
*** Keywords ***
Keyword After Teardown
[Documentation] This is keyword Documentation
[Tags] tag1 tag2
[Teardown] Log abc
Keyword1
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
order of sections in comma-separated list |
no-global-variable / W0929¶
Added in v5.6.0
⦁ Supported RF versions: All
Message:
Don't set global variables outside the variables section
Documentation:
Setting or updating global variables in a test/keyword often leads to hard-to-understand code. In most cases, you’re better off using local variables.
Changes in global variables during a test are hard to track because you must remember what’s happening in multiple pieces of code at once. A line in a seemingly unrelated file can mess up your understanding of what the code should be doing.
Local variables don’t suffer from this issue because they are always created in the keyword/test you’re looking at.
In this example, the keyword changes the global variable. This will cause the test to fail. Looking at just the test, it’s unclear why the test fails. It only becomes clear if you also remember the seemingly unrelated keyword:
*** Variables ***
${hello} Hello, world!
*** Test Cases ***
My Amazing Test
Do A Thing
Should Be Equal ${hello} Hello, world!
*** Keywords ***
Do A Thing
Set Global Variable ${hello} Goodnight, moon!
Using the VAR-syntax:
*** Variables ***
${hello} Hello, world!
*** Test Cases ***
My Amazing Test
Do A Thing
Should Be Equal ${hello} Hello, world!
*** Keywords ***
Do A Thing
VAR ${hello} Goodnight, moon! scope=GLOBAL
In some specific situations, global variables are a great tool. But most of the time, it makes code needlessly hard to understand.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
no-suite-variable / W0930¶
Added in v5.6.0
⦁ Supported RF versions: All
Message:
Don't use suite variables
Documentation:
Using suite variables in a test/keyword often leads to hard-to-understand code. In most cases, you’re better off using local variables.
Changes in suite variables during a test are hard to track because you must remember what’s happening in multiple pieces of code at once. A line in a seemingly unrelated file can mess up your understanding of what the code should be doing.
Local variables don’t suffer from this issue because they are always created in the keyword/test you’re looking at.
In this example, the keyword changes the suite variable. This will cause the test to fail. Looking at just the test, it’s unclear why the test fails. It only becomes clear if you also remember the seemingly unrelated keyword:
*** Test Cases ***
My Amazing Test
Set Suite Variable ${hello} Hello, world!
Do A Thing
Should Be Equal ${hello} Hello, world!
*** Keywords ***
Do A Thing
Set Suite Variable ${hello} Goodnight, moon!
Using the VAR-syntax:
*** Test Cases ***
My Amazing Test
VAR ${hello} Hello, world! scope=SUITE
Do A Thing
Should Be Equal ${hello} Hello, world!
*** Keywords ***
Do A Thing
VAR ${hello} Goodnight, moon! scope=SUITE
In some specific situations, suite variables are a great tool. But most of the time, it makes code needlessly hard to understand.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
no-test-variable / W0931¶
Added in v5.6.0
⦁ Supported RF versions: All
Message:
Don't use test/task variables
Documentation:
Using test/task variables in a test/keyword often leads to hard-to-understand code. In most cases, you’re better off using local variables.
Changes in test/task variables during a test are hard to track because you must remember what’s happening in multiple pieces of code at once. A line in a seemingly unrelated file can mess up your understanding of what the code should be doing.
Local variables don’t suffer from this issue because they are always created in the keyword/test you’re looking at.
In this example, the keyword changes the test/task variable. This will cause the test to fail. Looking at just the test, it’s unclear why the test fails. It only becomes clear if you also remember the seemingly unrelated keyword:
*** Test Cases ***
My Amazing Test
Set Test Variable ${hello} Hello, world!
Do A Thing
Should Be Equal ${hello} Hello, world!
*** Keywords ***
Do A Thing
Set Test Variable ${hello} Goodnight, moon!
Using the VAR-syntax:
*** Test Cases ***
My Amazing Test
VAR ${hello} Hello, world! scope=TEST
Do A Thing
Should Be Equal ${hello} Hello, world!
*** Keywords ***
Do A Thing
VAR ${hello} Goodnight, moon! scope=TEST
In some specific situations, test/task variables are a great tool. But most of the time, it makes code needlessly hard to understand.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
undefined-argument-default / E0932¶
Added in v5.7.0
⦁ Supported RF versions: All
Message:
Undefined argument default, use {{ arg_name }}=${EMPTY} instead
Documentation:
Keyword arguments can define a default value. Every time you call the keyword, you can optionally overwrite this default.
When you use an argument default, you should be as clear as possible. This improves the
readability of your code. The syntax ${argument}=
is unclear unless you happen to know
that it is technically equivalent to ${argument}=${EMPTY}
. To prevent people from
misreading your keyword arguments, explicitly state that the value is empty using the
built-in ${EMPTY}
variable.
Example of a rule violation:
*** Keywords ***
My Amazing Keyword
[Arguments] ${argument_name}=
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
undefined-argument-value / E0933¶
Added in v5.7.0
⦁ Supported RF versions: All
Message:
Undefined argument value, use {{ arg_name }}=${EMPTY} instead
Documentation:
When calling a keyword, it can accept named arguments.
When you call a keyword, you should be as clear as possible. This improves the
readability of your code. The syntax argument=
is unclear unless you happen to know
that it is technically equivalent to argument=${EMPTY}
. To prevent people from
misreading your keyword arguments, explicitly state that the value is empty using the
built-in ${EMPTY}
variable.
Example of a rule violation:
My Amazing Keyword argument_name=
Positional arguments that end with a =
character can be falsly flagged by this rule. You
can fix this by making the situation more explicit:
Escape the
=
character:Log value\=
Make it a named argument instead:
Log message=value=
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
Spacing¶
trailing-whitespace / W1001¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Trailing whitespace at the end of line
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
missing-trailing-blank-line / W1002¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Missing trailing blank line at the end of file
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
empty-lines-between-sections / W1003¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Invalid number of empty lines between sections ({{ empty_lines }}/{{ allowed_empty_lines }})
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of empty lines required between sections |
empty-lines-between-test-cases / W1004¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Invalid number of empty lines between test cases ({{ empty_lines }}/{{ allowed_empty_lines }})
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of empty lines required between test cases |
empty-lines-between-keywords / W1005¶
Added in v1.0.0
⦁ Supported RF versions: All
Message:
Invalid number of empty lines between keywords ({{ empty_lines }}/{{ allowed_empty_lines }})
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of empty lines required between keywords |
mixed-tabs-and-spaces / W1006¶
Added in v1.1.0
⦁ Supported RF versions: All
Message:
Inconsistent use of tabs and spaces in file
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
bad-indent / W1008¶
Added in v3.0.0
⦁ Supported RF versions: All
Message:
{{ bad_indent_msg }}
Documentation:
Line is misaligned or indent is invalid.
This rule reports warning if the line is misaligned in the current block. Example of rule violation:
*** Keywords ***
Keyword
Keyword Call
Misaligned Keyword Call # line is over-intended by one space
IF $condition RETURN
Keyword Call # line is under-intended by two spaces
The correct indentation is determined by the most common indentation in the current block. Although,
it allows for more flexible indentation by specifying the indent
parameter for checking if the
indentation is the multiple of indent
spaces (default -1, which makes this parameter being ignored).
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
Number of spaces per indentation level |
empty-line-after-section / W1009¶
Added in v1.2.0
⦁ Supported RF versions: All
Message:
Too many empty lines after '{{ section_name }}' section header ({{ empty_lines }}/{{ allowed_empty_lines }})
Documentation:
Empty lines after the section header are not allowed by default. Example of rule violation:
*** Test Cases ***
Resource file.resource
It can be configured using empty_lines
parameter.
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter empty_lines
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set empty_lines
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of empty lines allowed after section header |
too-many-trailing-blank-lines / W1010¶
Added in v1.4.0
⦁ Supported RF versions: All
Message:
Too many blank lines at the end of file
Documentation:
There should be exactly one blank line at the end of the file
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
misaligned-continuation / W1011¶
Added in v1.6.0
⦁ Supported RF versions: All
Message:
Continuation marker should be aligned with starting row
Documentation:
Example of rule violation:
Default Tags default tag 1 default tag 2 default tag 3
... default tag 4 default tag 5
*** Test Cases ***
Example
Do X first argument second argument third argument
... fourth argument fifth argument sixth argument
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
consecutive-empty-lines / W1012¶
Added in v1.8.0
⦁ Supported RF versions: All
Message:
Too many consecutive empty lines ({{ empty_lines }}/{{ allowed_empty_lines }})
Documentation:
Example of rule violation:
*** Variables ***
${VAR} value
${VAR2} value # previous line will be reported with 2/1 consecutive lines
*** Keywords ***
Keyword
Step 1
Step 2 # previous line will be reported with 2/1 consecutive lines
Severity thresholds
This rule supports dynamic severity configurable using thresholds (Severity threshold).
Parameter empty_lines
will be used to determine issue severity depending on the thresholds.
When configuring thresholds remember to also set empty_lines
- its value should be lower or
equal to the lowest value in the threshold.
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
number of allowed consecutive empty lines |
empty-lines-in-statement / W1013¶
Added in v1.8.0
⦁ Supported RF versions: All
Message:
Multi-line statement with empty lines
Documentation:
Example of rule violation:
Keyword
... 1
# empty line in-between multiline statement
... 2
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
variable-should-be-left-aligned / E1014¶
Added in v1.8.0
⦁ Supported RF versions: >=4.0
Message:
Variable in Variable section should be left aligned
Documentation:
Example of rule violation:
*** Variables ***
${VAR} 1
${VAR2} 2
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
misaligned-continuation-row / W1015¶
Added in v1.11.0
⦁ Supported RF versions: All
Message:
Each next continuation line should be aligned with the previous one
Documentation:
Example of rule violation:
*** Variable ***
${VAR} This is a long string.
... It has multiple sentences.
... And this line is misaligned with previous one.
*** Test Cases ***
My Test
My Keyword
... arg1
... arg2 # misaligned
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
|
|
|
Ignore documentation |
|
|
|
Ignore run keywords |
suite-setting-should-be-left-aligned / E1016¶
Added in v2.4.0
⦁ Supported RF versions: >=4.0
Message:
Setting in Settings section should be left aligned
Documentation:
Example of rule violation:
*** Settings ***
Library Collections
Resource data.resource
Variables vars.robot
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
bad-block-indent / E1017¶
Added in v3.0.0
⦁ Supported RF versions: All
Message:
Indent expected. Provide 2 or more spaces of indentation for statements inside block
Documentation:
If the indentation is less than two spaces than current block parent element
(such as FOR
/IF
/WHILE
/TRY
header) the indentation is invalid and the rule reports an error:
*** Keywords ***
Some Keyword
FOR ${elem} IN ${list}
Log ${elem} # this is fine
Log stuff # this is bad indent
# bad comment
END
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
first-argument-in-new-line / W1018¶
Added in v5.3.0
⦁ Supported RF versions: All
Message:
First argument: '{{ argument_name }}' should be placed on the same line as [Arguments] setting
Documentation:
Example of rule violation:
*** Keywords ***
Custom Keyword With Five Required Arguments
[Arguments]
... ${name}
... ${surname}
Configurable parameters:
Name |
Default value |
Type |
Description |
---|---|---|---|
|
|
|
Rule severity (E = Error, W = Warning, I = Info) |
|
|
|
Rule default enable status |
Comments¶
todo-in-comment / W0701¶
Added in
v1.0.0
⦁ Supported RF versions:All
Message:
Found a marker '{{ marker }}' in the comments
Documentation:
Report occurrences of the configured, case-insensitive marker in the comments. By default, it reports
TODO
andFIXME
markers.Example:
Configuration example:
robocop --configure "todo-in-comment:markers:todo,Remove me,Fix this!"
Configurable parameters:
Name
Default value
Type
Description
severity
W
severity
Rule severity (E = Error, W = Warning, I = Info)
enabled
True
bool
Rule default enable status
markers
todo,fixme
str
List of case-insensitive markers that violate the rule in comments.
missing-space-after-comment / W0702¶
Added in
v1.0.0
⦁ Supported RF versions:All
Message:
Missing blank space after comment character
Documentation:
Make sure to have one blank space after
#
comment character. Configured regex for block comment should take into account the first character is#
.Example:
Configuration example:
Configurable parameters:
Name
Default value
Type
Description
severity
W
severity
Rule severity (E = Error, W = Warning, I = Info)
enabled
True
bool
Rule default enable status
block
^###
regex
Block comment regex pattern.
invalid-comment / E0703¶
Added in
v1.0.0
⦁ Supported RF versions:<4.0
Message:
Invalid comment. '#' needs to be first character in the cell. For block comments you can use '*** Comments ***' section
Documentation:
In Robot Framework 3.2.2 comments that started from second character in the cell were not recognized as comments.
Example:
Configurable parameters:
Name
Default value
Type
Description
severity
E
severity
Rule severity (E = Error, W = Warning, I = Info)
enabled
True
bool
Rule default enable status
ignored-data / W0704¶
Added in
v1.3.0
⦁ Supported RF versions:All
Message:
Ignored data found in file
Documentation:
All lines before first test data section (ref) are ignored. It’s recommended to add
*** Comments ***
section header for lines that should be ignored.Missing section header:
Comment lines that should be inside
*** Comments ***
:Configurable parameters:
Name
Default value
Type
Description
severity
W
severity
Rule severity (E = Error, W = Warning, I = Info)
enabled
True
bool
Rule default enable status
bom-encoding-in-file / W0705¶
Added in
v1.7.0
⦁ Supported RF versions:All
Message:
This file contains BOM (Byte Order Mark) encoding not supported by Robot Framework
Documentation:
Some code editors can save Robot file using BOM encoding. Ensure that file is saved in UTF-8 encoding.
Configurable parameters:
Name
Default value
Type
Description
severity
W
severity
Rule severity (E = Error, W = Warning, I = Info)
enabled
True
bool
Rule default enable status