Community rules list

Community rules are optional rules that may handle specific issues or offer particular utility with certain limitations. All community rules are disabled by default and can be enabled by configuring enabled parameter:

robocop --configure sleep-keyword-used:enabled:True

or by including rule in --include:

robocop --include sleep-keyword-used

Keywords

sleep-keyword-used / W10001

Added in v5.0.0Supported RF versions: All

Message:

Sleep keyword with '{{ duration_time }}' sleep time found

Documentation:

Avoid using Sleep keyword in favour of polling.

For example:

*** Keywords ***
Add To Cart
    [Arguments]    ${item_name}
    Sleep    30s  # wait for page to load
    Element Should Be Visible    ${MAIN_HEADER}
    Click Element    //div[@name='${item_name}']/div[@id='add_to_cart']

Can be rewritten to:

*** Keywords ***
Add To Cart
    [Arguments]    ${item_name}
    Wait Until Element Is Visible    ${MAIN_HEADER}
    Click Element    //div[@name='${item_name}']/div[@id='add_to_cart']

It is also possible to report only if Sleep exceeds given time limit using max_time parameter:

robocop -c sleep-keyword-used:max_time:1min .

Configurable parameters:

Name

Default value

Type

Description

severity

W

severity

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

enabled

False

bool

Rule default enable status

max_time

0

timestr_to_secs

Maximum amount of time allowed in Sleep


not-allowed-keyword / W10002

Added in v5.1.0Supported RF versions: All

Message:

Keyword '{{ keyword }}' is not allowed

Documentation:

Reports usage of not allowed keywords.

Configure which keywords should be reported by using keywords parameter. Keyword names are normalized to match Robot Framework search behaviour (lower case, removed whitespace and underscores).

For example:

> robocop -i not-allowed-keyword -c not-allowed-keyword:keywords:click_using_javascript

*** Keywords ***
Keyword With Obsolete Implementation
    [Arguments]    ${locator}
    Click Using Javascript    ${locator}  # Robocop will report not allowed keyword

If keyword call contains possible library name (ie. Library.Keyword Name), Robocop checks if it matches the not allowed keywords and if not, it will remove library part and check again.

Configurable parameters:

Name

Default value

Type

Description

severity

W

severity

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

enabled

False

bool

Rule default enable status

keywords

None

comma_separated_list

Comma separated list of not allowed keywords