Rules#

Every issue is reported as robocop.rules.Message object. It can be later printed or used by post-run reports.

Output message format#

Output message of rules can be defined with -f / --format argument. Default value:

"{source}:{line}:{col} [{severity}] {rule_id} {desc} ({name})"
Available formats:
  • source: path to the file where the issue occurred

  • source_rel: path to the file where the issue occurred, relative to execution directory

  • line: line number where the issue starts

  • end_line: line number where the issue ends

  • col: column number where the issue starts

  • end_col: column number where the issue ends

  • severity: severity of the issue, value of robocop.rules.RuleSeverity enum

  • rule_id: rule id (e.g. 0501)

  • name: rule name (e.g. line-too-long)

  • desc: description of the rule

Robocop rules are internally grouped into checkers. Each checker can scan for multiple related issues (like LengthChecker checks both for minimum and maximum length of a keyword). You can refer to specific rule reported by checkers by its name or id (for example too-long-keyword or 0501).

Checker groups IDs:
Checkers are categorized into following groups:
  • 01: base

  • 02: documentation

  • 03: naming

  • 04: errors

  • 05: lengths

  • 06: tags

  • 07: comments

  • 08: duplications

  • 09: misc

  • 10: spacing

  • 11-50: not yet used: reserved for future internal checkers

  • 51-99: reserved for external checkers

Checker has two basic types:

  • VisitorChecker uses Robot Framework parsing API and Python ast module for traversing Robot code as nodes,

  • RawFileChecker simply reads Robot file as normal file and scans every line.

Every rule has a unique id made of 4 digits where first 2 are checker id while 2 latter are rule id. Unique id as well as rule name can be used to refer to the rule (e.g. in include/exclude statements, configurations etc.). You can optionally configure rule severity or other parameters.

class robocop.rules.RuleSeverity(value)#

Rule severity. It can be configured with --configure id_or_msg_name:severity:value where value can be first letter of severity value or whole name, case-insensitive. For example

-c line-too-long:severity:e

will change line-too-long rule severity to error.

You can filter out all rules below given severity value by using following option:

-t/--threshold <severity value>

To only report rules with severity W and above:

--threshold W

Documentation#

missing-doc-keyword#

Severity

Rule id

Robot Framework version

W

0201

All

Missing documentation in ‘{{ name }}’ keyword.

You can add documentation to keyword using following syntax:

Keyword
    [Documentation]  Keyword documentation
    Keyword Step
    Other Step
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

missing-doc-test-case#

Severity

Rule id

Robot Framework version

W

0202

All

Missing documentation in ‘{{ name }}’ test case.

You can add documentation to test case using following syntax:

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

ignore_templated

True

bool

whether templated tests should be documented or not

missing-doc-suite#

Severity

Rule id

Robot Framework version

W

0203

All

Missing documentation in suite.

You can add documentation to suite using following syntax:

*** Settings ***
Documentation    Suite documentation
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

Naming#

not-allowed-char-in-name#

Severity

Rule id

Robot Framework version

W

0301

All

Not allowed character ‘{{ character }}’ found in {{ block_name }} name.

Reports not allowed pattern found in Test Case or Keyword names. By default it’s 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 reports any occurrence of @[ characters.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

pattern

re.compile(‘[\.\?]’)

regex

pattern defining characters (not) allowed in a name

wrong-case-in-keyword-name#

Severity

Rule id

Robot Framework version

W

0302

All

Keyword name ‘{{ keyword_name }}’ does not follow case convention.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

convention

each_word_capitalized

str

possible values: ‘each_word_capitalized’ (default) or ‘first_word_capitalized’

pattern

re.compile(‘’)

regex

pattern for accepted words in keyword

keyword-name-is-reserved-word#

Severity

Rule id

Robot Framework version

E

0303

All

‘{{ keyword_name }}’ is a reserved keyword{{ error_msg }}.

Do not use reserved names for keyword names. Following names are reserved:

  • IF

  • ELSE IF

  • ELSE

  • FOR

  • END

  • WHILE

  • CONTINUE

  • RETURN

  • TRY

  • EXCEPT

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

underscore-in-keyword-name#

Severity

Rule id

Robot Framework version

W

0305

All

Underscores in keyword name ‘{{ keyword_name }}’ can be replaced with spaces.

Example:

# bad
keyword_with_underscores

# good
Keyword Without Underscores
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

setting-name-not-in-title-case#

Severity

Rule id

Robot Framework version

W

0306

All

Setting name ‘{{ setting_name }}’ should use title or upper case.

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

section-name-invalid#

Severity

Rule id

Robot Framework version

W

0307

All

Section name should be in format ‘{{ section_title_case }}’ or ‘{{ section_upper_case }}’.

Good:

*** SETTINGS ***
*** Keywords ***

Bad:

*** keywords ***
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

not-capitalized-test-case-title#

Severity

Rule id

Robot Framework version

W

0308

All

Test case ‘{{ test_name }}’ title should start with capital letter.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

section-variable-not-uppercase#

Severity

Rule id

Robot Framework version

W

0309

All

Section variable ‘{{ variable_name }}’ name should be uppercase.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

non-local-variables-should-be-uppercase#

Severity

Rule id

Robot Framework version

W

0310

All

Test, suite and global variables should be uppercase.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

else-not-upper-case#

Severity

Rule id

Robot Framework version

E

0311

All

ELSE and ELSE IF should be upper case.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

keyword-name-is-empty#

Severity

Rule id

Robot Framework version

E

0312

All

Keyword name should not be empty.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

test-case-name-is-empty#

Severity

Rule id

Robot Framework version

E

0313

All

Test case name should not be empty.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-library-alias#

Severity

Rule id

Robot Framework version

E

0314

All

Library alias should not be empty.

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-library-alias#

Severity

Rule id

Robot Framework version

W

0315

All

Library alias should not be the same as original name.

Example 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

possible-variable-overwriting#

Severity

Rule id

Robot Framework version

I

0316

All

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..

Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

hyphen-in-variable-name#

Severity

Rule id

Robot Framework version

I

0317

All

Use underscore in variable name ‘{{ variable_name }}’ instead of hyphens to avoid treating them like minus sign.

Robot Framework supports evaluation of Python code inside ${ } brackets. For example:

${var2}  Set Variable  ${${var}-${var2}}

That’s why there is possibility that hyphen in name is not recognized as part of name but as minus sign. Better to use underscore (if it’s intended):

${var2}  Set Variable  ${ ${var}_${var2}}
Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

bdd-without-keyword-call#

Severity

Rule id

Robot Framework version

W

0318

All

BDD reserved keyword ‘{{ keyword_name }}’ not followed by any keyword{{ error_msg }}.

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 keyword name.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

deprecated-statement#

Severity

Rule id

Robot Framework version

W

0319

All

‘{{ statement_name }}’ is deprecated since Robot Framework version {{ version }}, use ‘{{ alternative }}’ instead.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

not-allowed-char-in-filename#

Severity

Rule id

Robot Framework version

W

0320

All

Not allowed character ‘{{ character }}’ found in {{ block_name }} name.

Reports not allowed pattern found in Suite names. By default it’s dot (.). You can configure what characters are reported by calling:

robocop --configure not-allowed-char-in-filename:pattern:regex_pattern

regex_pattern should define regex pattern for characters not allowed in names. For example [@[] pattern reports any occurrence of @[ characters.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

pattern

re.compile(‘[\.\?]’)

regex

pattern defining characters (not) allowed in a name

deprecated-with-name#

Severity

Rule id

Robot Framework version

W

0321

>=6.0

‘WITH NAME’ alias marker is deprecated since Robot Framework 6.0 version and will be removed in the future release. Use ‘AS’ instead.

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

deprecated-singular-header#

Severity

Rule id

Robot Framework version

W

0322

>=6.0

‘{{ singular_header }}’ singular header form is deprecated since RF 6.0 and will be removed in the future releases. Use ‘{{ plurar_header }}’ instead.

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

Errors#

parsing-error#

Severity

Rule id

Robot Framework version

E

0401

All

Robot Framework syntax error: {{ error_msg }}.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

not-enough-whitespace-after-setting#

Severity

Rule id

Robot Framework version

E

0402

All

Provide at least two spaces after ‘{{ setting_name }}’ setting.

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

missing-keyword-name#

Severity

Rule id

Robot Framework version

E

0403

All

Missing keyword name when calling some values.

Example of rule violation:

*** Keywords ***
Keyword
    ${var}
    ${one}      ${two}
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

variables-import-with-args#

Severity

Rule id

Robot Framework version

E

0404

All

Robot and YAML variable files do not take arguments.

Example of rule violation:

*** Settings ***
Variables    vars.yaml    arg1
Variables    variables.robot    arg
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

invalid-continuation-mark#

Severity

Rule id

Robot Framework version

E

0405

All

Invalid continuation mark ‘{{ mark }}’. It should be ‘…’.

Example of rule violation:

Keyword
..  ${var}  # .. instead of ...
...  1
....  2  # .... instead of ...
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

not-enough-whitespace-after-newline-marker#

Severity

Rule id

Robot Framework version

E

0406

All

Provide at least two spaces after ‘…’ marker.

Example of rule violation:

@{LIST}  1
... 2  # not enough whitespace
...  3
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

invalid-argument#

Severity

Rule id

Robot Framework version

E

0407

>=4.0

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

non-existing-setting#

Severity

Rule id

Robot Framework version

E

0408

All

Non-existing setting can’t be used in the code.

Rule violation example:

*** Test Case ***
    [Not Existing]  arg
    [Arguments]  ${arg}
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

setting-not-supported#

Severity

Rule id

Robot Framework version

E

0409

All

Setting ‘[{{ setting_name }}]’ is not supported in {{ test_or_keyword }}. Allowed are: {{ allowed_settings }}.

Following settings are supported in Test Case:

[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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

not-enough-whitespace-after-variable#

Severity

Rule id

Robot Framework version

E

0410

>=4.0

Provide at least two spaces after ‘{{ variable_name }}’ variable name.

Example of rule violation:

${variable} 1  # not enough whitespace
${other_var}  2
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

not-enough-whitespace-after-suite-setting#

Severity

Rule id

Robot Framework version

E

0411

All

Provide at least two spaces after ‘{{ setting_name }}’ setting.

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

invalid-for-loop#

Severity

Rule id

Robot Framework version

E

0412

>=4.0

Invalid for loop syntax: {{ error_msg }}.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

invalid-if#

Severity

Rule id

Robot Framework version

E

0413

>=4.0

Invalid IF syntax: {{ error_msg }}.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

return-in-test-case#

Severity

Rule id

Robot Framework version

E

0414

>=5.0

RETURN can only be used inside a user keyword.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

Lengths#

too-long-keyword#

Severity

Rule id

Robot Framework version

W

0501

All

Keyword ‘{{ keyword_name }}’ is too long ({{ keyword_length }}/{{ allowed_length}}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_len

40

int

number of lines allowed in a keyword

ignore_docs

False

bool

Ignore documentation

too-few-calls-in-keyword#

Severity

Rule id

Robot Framework version

W

0502

All

Keyword ‘{{ keyword_name }}’ has too few keywords inside ({{ keyword_count }}/{{ min_allowed_count }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

min_calls

1

int

number of keyword calls required in a keyword

too-many-calls-in-keyword#

Severity

Rule id

Robot Framework version

W

0503

All

Keyword ‘{{ keyword_name }}’ has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_calls

10

int

number of keyword calls allowed in a keyword

too-long-test-case#

Severity

Rule id

Robot Framework version

W

0504

All

Test case ‘{{ test_name }}’ is too long ({{ test_length }}/{{ allowed_length }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_len

20

int

number of lines allowed in a test case

ignore_docs

False

bool

Ignore documentation

too-many-calls-in-test-case#

Severity

Rule id

Robot Framework version

W

0505

All

Test case ‘{{ test_name }}’ has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}). Redesign the test and move complex logic to separate keywords to increase readiblity.

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_calls

10

int

number of keyword calls allowed in a test case

ignore_templated

False

bool

Ignore templated tests

file-too-long#

Severity

Rule id

Robot Framework version

W

0506

All

File has too many lines ({{ lines_count }}/{{max_allowed_count }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_lines

400

int

number of lines allowed in a file

too-many-arguments#

Severity

Rule id

Robot Framework version

W

0507

All

Keyword ‘{{ keyword_name }}’ has too many arguments ({{ arguments_count }}/{{ max_allowed_count }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_args

5

int

number of lines allowed in a file

line-too-long#

Severity

Rule id

Robot Framework version

W

0508

All

Line is too long ({{ line_length }}/{{ allowed_length }}).

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 (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

line_length

120

int

number of characters allowed in line

ignore_pattern

re.compile(‘https?://\S+’)

regex

ignore lines that contain configured pattern

empty-section#

Severity

Rule id

Robot Framework version

W

0509

All

Section ‘{{ section_name }}’ is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

number-of-returned-values#

Severity

Rule id

Robot Framework version

W

0510

All

Too many return values ({{ return_count }}/{{ max_allowed_count }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_returns

4

int

allowed number of returned values from a keyword

empty-metadata#

Severity

Rule id

Robot Framework version

W

0511

All

Metadata settings does not have any value set.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-documentation#

Severity

Rule id

Robot Framework version

W

0512

All

Documentation of {{ block_name }} is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-force-tags#

Severity

Rule id

Robot Framework version

W

0513

All

Force Tags are empty.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-default-tags#

Severity

Rule id

Robot Framework version

W

0514

All

Default Tags are empty.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-variables-import#

Severity

Rule id

Robot Framework version

E

0515

All

Import variables path is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-resource-import#

Severity

Rule id

Robot Framework version

E

0516

All

Import resource path is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-library-import#

Severity

Rule id

Robot Framework version

E

0517

All

Import library path is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-setup#

Severity

Rule id

Robot Framework version

E

0518

All

Setup of {{ block_name }} does not have any keywords.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-suite-setup#

Severity

Rule id

Robot Framework version

E

0519

All

Suite Setup does not have any keywords.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-test-setup#

Severity

Rule id

Robot Framework version

E

0520

All

Test Setup does not have any keywords.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-teardown#

Severity

Rule id

Robot Framework version

E

0521

All

Teardown of {{ block_name }} does not have any keywords.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-suite-teardown#

Severity

Rule id

Robot Framework version

E

0522

All

Suite Teardown does not have any keywords.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-test-teardown#

Severity

Rule id

Robot Framework version

E

0523

All

Test Teardown does not have any keywords.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-timeout#

Severity

Rule id

Robot Framework version

W

0524

All

Timeout of {{ block_name }} is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-test-timeout#

Severity

Rule id

Robot Framework version

W

0525

All

Test Timeout is empty.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-arguments#

Severity

Rule id

Robot Framework version

E

0526

All

Arguments of {{ block_name }} are empty.

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

too-many-test-cases#

Severity

Rule id

Robot Framework version

W

0527

All

Too many test cases ({{ test_count }}/{{ max_allowed_count }}).

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

max_testcases

50

int

number of test cases allowed in a suite

max_templated_testcases

100

int

number of test cases allowed in a templated suite

too-few-calls-in-test-case#

Severity

Rule id

Robot Framework version

E

0528

All

Test case ‘{{ test_name }}’ has too few keywords inside ({{ keyword_count }}/{{ min_allowed_count }}).

Test without keywords will fail. Add more keywords or set results using Fail, Pass, Skip keywords:

*** Test Cases ***
Test case
    [Tags]    smoke
    Skip    Test case draft
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

min_calls

1

int

number of keyword calls required in a test case

ignore_templated

False

bool

Ignore templated tests

Tags#

tag-with-space#

Severity

Rule id

Robot Framework version

W

0601

All

Tag ‘{{ tag }}’ should not contain spaces.

Example of rule violation:

Test
    [Tags]  ${tag with space}
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

tag-with-or-and#

Severity

Rule id

Robot Framework version

I

0602

All

Tag ‘{{ tag }}’ with reserved word OR/AND. Hint: make sure to include this tag using lowercase name to avoid issues.

OR and AND words are used to combine tags when selecting tests to be run in Robot Framework. Using following configuration:

robot --include tagANDtag2

Robot Framework will only execute tests that contain tag and tag2. That’s why it’s best to avoid AND and OR in tag names. See docs for more information.

Tag matching is case-insensitive. If your tag contains OR or AND you can use lowercase to match it. For example, if your tag is PORT you can match it with port.

Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

tag-with-reserved-word#

Severity

Rule id

Robot Framework version

W

0603

All

Tag ‘{{ tag }}’ prefixed with reserved word robot:.

This prefix is used by Robot Framework special tags. More details here. Special tags currently in use:

  • robot:exit

  • robot:no-dry-run

  • robot:continue-on-failure

  • robot:recursive-continue-on-failure

  • robot:skip

  • robot:skip-on-failure

  • robot:stop-on-failure

  • robot:exclude

  • robot:private

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

could-be-test-tags#

Severity

Rule id

Robot Framework version

I

0605

All

All tests in suite share these tags: ‘{{ tags }}’. You can define them in ‘Test Tags’ in suite settings instead.

Example:

*** Test Cases ***
Test
    [Tag]  featureX  smoke
    Step

Test 2
    [Tag]  featureX
    Step

In this example all tests share one common tag featureX. It can be declared just once using Test Tags or Task Tags.

Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

tag-already-set-in-test-tags#

Severity

Rule id

Robot Framework version

I

0606

All

Tag ‘{{ tag }}’ is already set by {{ test_force_tags }} in suite settings.

Avoid repeating same tags in tests when the tag is already declared in Test Tags or Force Tags. Example of rule violation:

*** Setting ***
Test Tags  common-tag

*** Test Cases ***
Test
    [Tag]  sanity  common-tag
Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

unnecessary-default-tags#

Severity

Rule id

Robot Framework version

I

0607

All

Tags defined in Default Tags are always overwritten.

Example of rule violation:

*** Settings ***
Default Tags  tag1  tag2

*** Test Cases ***
Test
    [Tags]  tag3
    Step

Test 2
    [Tags]  tag4
    Step

Since Test and Test 2 have [Tags] section, Default Tags setting is never used.

Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-tags#

Severity

Rule id

Robot Framework version

W

0608

All

[Tags] setting without values{{ optional_warning }}.

If you want to use empty [Tags] (for example to overwrite Default Tags) then use NONE value to be explicit.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-tags#

Severity

Rule id

Robot Framework version

W

0609

All

Multiple tags with name ‘{{ name }}’ (first occurrence at line {{ line }} column {{ column }}).

Tags are free text, but they are normalized so that they are converted to lowercase and all spaces are removed. Only first tag is used, other occurrences are ignored.

Example of duplicated tags:

Test
    [Tags]    Tag    TAG    tag    t a g
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

Comments#

todo-in-comment#

Severity

Rule id

Robot Framework version

W

0701

All

Found a marker ‘{{ marker }}’ in the comments.

Report occurrences of the configured, case-insensitive marker in the comments. By default, it reports TODO and FIXME markers.

Example:

# TODO: Refactor this code
# fixme

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)

markers

todo,fixme

str

List of case-insensitive markers that violate the rule in comments.

missing-space-after-comment#

Severity

Rule id

Robot Framework version

W

0702

All

Missing blank space after comment character.

Make sure to have one blank space after ‘#’ comment character. Configured regex for block comment should take into account the first character is #.

Example:

#bad
# good
### good block

Configuration example:

robocop --configure missing-space-after-comment:block:^#[*]+

Allows commenting like:

    #*****
    #
    # Important topics here!
    #
    #*****
    or
    #* Headers *#
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

block

^###

regex

Block comment regex pattern.

invalid-comment#

Severity

Rule id

Robot Framework version

E

0703

<4.0

Invalid comment. ‘#’ needs to be first character in the cell. For block comments you can use ‘* Comments *’ section.

In Robot Framework 3.2.2 comments that started from second character in the cell were not recognized as comments.

Example:

# good
 # bad
  # third cell so it's good
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

ignored-data#

Severity

Rule id

Robot Framework version

W

0704

All

Ignored data found in file.

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:

Resource   file.resource  # it looks like *** Settings *** but section header is missing - line is ignored

*** Keywords ***
Keyword Name
   No Operation

Comment lines that should be inside *** Comments ***:

Deprecated Test
    Keyword
    Keyword 2

*** Test Cases ***
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

bom-encoding-in-file#

Severity

Rule id

Robot Framework version

W

0705

All

This file contains BOM (Byte Order Mark) encoding not supported by Robot Framework.

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)

Duplications#

duplicated-test-case#

Severity

Rule id

Robot Framework version

E

0801

All

Multiple test cases with name ‘{{ name }}’ (first occurrence in line {{ first_occurrence_line }}).

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-keyword#

Severity

Rule id

Robot Framework version

E

0802

All

Multiple keywords with name ‘{{ name }}’ (first occurrence in line {{ first_occurrence_line }}).

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-variable#

Severity

Rule id

Robot Framework version

E

0803

All

Multiple variables with name ‘{{ name }}’ in Variables section (first occurrence in line {{ first_occurrence_line }}). Note that Robot Framework is case-insensitive.

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-resource#

Severity

Rule id

Robot Framework version

W

0804

All

Multiple resource imports with path ‘{{ name }}’ (first occurrence in line {{ first_occurrence_line }}).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-library#

Severity

Rule id

Robot Framework version

W

0805

All

Multiple library imports with name ‘{{ name }}’ and identical arguments (first occurrence in line {{ first_occurrence_line }}).

If you need to reimport library use alias:

*** Settings ***
Library  RobotLibrary
Library  RobotLibrary  AS  OtherRobotLibrary
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-metadata#

Severity

Rule id

Robot Framework version

W

0806

All

Duplicated metadata ‘{{ name }}’ (first occurrence in line {{ first_occurrence_line }}).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-variables-import#

Severity

Rule id

Robot Framework version

W

0807

All

Duplicated variables import with path ‘{{ name }}’ (first occurrence in line {{ first_occurrence_line }}).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

section-already-defined#

Severity

Rule id

Robot Framework version

W

0808

All

‘{{ section_name }}’ section header already defined in file (first occurrence in line {{ first_occurrence_line }}).

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

section-out-of-order#

Severity

Rule id

Robot Framework version

W

0809

All

‘{{ section_name }}’ section header is defined in wrong order: {{ recommended_order }}.

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

sections_order

settings,variables,testcases,keywords

str

order of sections in comma-separated list

both-tests-and-tasks#

Severity

Rule id

Robot Framework version

E

0810

All

Both Task(s) and Test Case(s) section headers defined in file.

The file contains both Test Case and Task sections. Use only one of them.

*** Test Cases ***

*** Tasks ***
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-argument-name#

Severity

Rule id

Robot Framework version

E

0811

All

Argument name ‘{{ argument_name }}’ is already used.

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-assigned-var-name#

Severity

Rule id

Robot Framework version

I

0812

All

Assigned variable name ‘{{ variable_name }}’ is already used.

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
Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

duplicated-setting#

Severity

Rule id

Robot Framework version

W

0813

All

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

Misc#

keyword-after-return#

Severity

Rule id

Robot Framework version

W

0901

All

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-return#

Severity

Rule id

Robot Framework version

W

0903

All

[Return] is empty.

[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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

nested-for-loop#

Severity

Rule id

Robot Framework version

E

0907

<4.0

Nested for loops are not supported. You can use keyword with for loop instead.

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

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

if-can-be-used#

Severity

Rule id

Robot Framework version

I

0908

==4.*

‘{{ run_keyword }}’ can be replaced with IF block since Robot Framework 4.0.

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

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

inconsistent-assignment#

Severity

Rule id

Robot Framework version

W

0909

All

The assignment sign is not consistent within the file. Expected ‘{{ expected_sign }}’ but got ‘{{ actual_sign }}’ instead.

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

assignment_sign_type

autodetect

assignment sign type

possible values: ‘autodetect’ (default), ‘none’ (‘’), ‘equal_sign’ (‘=’) or space_and_equal_sign (’ =’)

inconsistent-assignment-in-variables#

Severity

Rule id

Robot Framework version

W

0910

All

The assignment sign is not consistent inside the variables section. Expected ‘{{ expected_sign }}’ but got ‘{{ actual_sign }}’ instead.

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 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

assignment_sign_type

autodetect

assignment sign type

possible values: ‘autodetect’ (default), ‘none’ (‘’), ‘equal_sign’ (‘=’) or space_and_equal_sign (’ =’)

wrong-import-order#

Severity

Rule id

Robot Framework version

W

0911

All

BuiltIn library import ‘{{ builtin_import }}’ should be placed before ‘{{ custom_import }}’.

Example of rule violation:

*** Settings ***
Library    Collections
Library    CustomLibrary
Library    OperatingSystem  # BuiltIn library defined after custom CustomLibrary
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-variable#

Severity

Rule id

Robot Framework version

I

0912

All

Use built-in variable {{ var_type }}{EMPTY} instead of leaving variable without value or using backslash.

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
Configurable parameters#

Name

Default value

Type

Description

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

can-be-resource-file#

Severity

Rule id

Robot Framework version

I

0913

All

No tests in ‘{{ file_name }}’ file, consider renaming to ‘{{ file_name_stem }}.resource’.

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

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

if-can-be-merged#

Severity

Rule id

Robot Framework version

I

0914

>=4.0

IF statement can be merged with previous IF (defined in line {{ line }}).

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

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

statement-outside-loop#

Severity

Rule id

Robot Framework version

E

0915

>=5.0

{{ name }} {{ statement_type }} used outside a loop.

Following keywords and statements should only be used inside loop (WHILE or FOR):
  • Exit For Loop,

  • Exit For Loop If,

  • Continue For Loop,

  • ``Continue For Loop If ``

  • CONTINUE,

  • BREAK

Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

inline-if-can-be-used#

Severity

Rule id

Robot Framework version

I

0916

>=5.0

IF can be replaced with inline IF.

Short and simple IFs 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 (Rule Severity Thresholds). 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

severity

I

severity

Rule severity (E = Error, W = Warning, I = Info)

max_width

80

int

maximum width of IF (in characters) below which it will be recommended to use inline IF

Spacing#

trailing-whitespace#

Severity

Rule id

Robot Framework version

W

1001

All

Trailing whitespace at the end of line.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

missing-trailing-blank-line#

Severity

Rule id

Robot Framework version

W

1002

All

Missing trailing blank line at the end of file.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty-lines-between-sections#

Severity

Rule id

Robot Framework version

W

1003

All

Invalid number of empty lines between sections ({{ empty_lines }}/{{ allowed_empty_lines }}).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty_lines

2

int

number of empty lines required between sections

empty-lines-between-test-cases#

Severity

Rule id

Robot Framework version

W

1004

All

Invalid number of empty lines between test cases ({{ empty_lines }}/{{ allowed_empty_lines }}).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty_lines

1

int

number of empty lines required between test cases

empty-lines-between-keywords#

Severity

Rule id

Robot Framework version

W

1005

All

Invalid number of empty lines between keywords ({{ empty_lines }}/{{ allowed_empty_lines }}).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty_lines

1

int

number of empty lines required between keywords

mixed-tabs-and-spaces#

Severity

Rule id

Robot Framework version

W

1006

All

Inconsistent use of tabs and spaces in file.

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

bad-indent#

Severity

Rule id

Robot Framework version

W

1008

All

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

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 ***
Keyword
     FOR  ${elem}  IN  ${list}
    Log  stuff  # content of FOR blocks should use bigger indentation than FOR header
     END

To report only invalid indent and do not report misaligned lines, configure ignore_uneven parameter to True.

The correct indentation is determined by most common indentation in the current block. It allows more flexible indentation. It’s possible to use strict (default False) mode for checking if the indentation is the multiple of indent spaces (default 4).

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

strict

False

str2bool

Strict checking of the indentation

indent

4

int

Number of spaces per indentation level

ignore_uneven

False

str2bool

Ignore uneven indent and report only invalid indent

empty-line-after-section#

Severity

Rule id

Robot Framework version

W

1009

All

Too many empty lines after ‘{{ section_name }}’ section header ({{ empty_lines }}/{{ allowed_empty_lines }}).

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 (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty_lines

0

int

number of empty lines allowed after section header

too-many-trailing-blank-lines#

Severity

Rule id

Robot Framework version

W

1010

All

Too many blank lines at the end of file. There should be exactly one blank line at the end of the file

Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

misaligned-continuation#

Severity

Rule id

Robot Framework version

W

1011

All

Continuation marker should be aligned with starting row.

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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

consecutive-empty-lines#

Severity

Rule id

Robot Framework version

W

1012

All

Too many consecutive empty lines ({{ empty_lines }}/{{ allowed_empty_lines }}).

Example of rule violation:

Keyword
    Step 1


    Step 2

Severity thresholds

This rule supports dynamic severity configurable using thresholds (Rule Severity Thresholds). 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

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

empty_lines

1

int

number of allowed consecutive empty lines

empty-lines-in-statement#

Severity

Rule id

Robot Framework version

W

1013

All

Multi-line statement with empty lines.

Example of rule violation:

Keyword
...  1
# empty line in-between multiline statement
...  2
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

variable-should-be-left-aligned#

Severity

Rule id

Robot Framework version

E

1014

>=4.0

Variable in Variable section should be left aligned.

Example of rule violation:

*** Variables ***
 ${VAR}  1
  ${VAR2}  2
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)

misaligned-continuation-row#

Severity

Rule id

Robot Framework version

W

1015

All

Each next continuation line should be aligned with the previous one.

Example of rule violation:

*** Settings ***
Documentation      Here we have documentation for this suite.
...                Documentation is often quite long.
...
...            It can also contain multiple paragraphs.  # misaligned

*** Test Cases ***
Test
[Tags]    you    probably    do    not    have    this    many
...      tags    in    real    life  # misaligned
Configurable parameters#

Name

Default value

Type

Description

severity

W

severity

Rule severity (E = Error, W = Warning, I = Info)

suite-setting-should-be-left-aligned#

Severity

Rule id

Robot Framework version

E

1016

>=4.0

Setting in Settings section should be left aligned.

Example of rule violation:

*** Settings ***
    Library  Collections
    Resource  data.resource
    Variables  vars.robot
Configurable parameters#

Name

Default value

Type

Description

severity

E

severity

Rule severity (E = Error, W = Warning, I = Info)