NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #3855 most downloaded on PyPI
Static code analysis tool (linter) and code formatter for Robot Framework
Last release 9 days ago
25 Sep 2026
Ships fairly regularly
a new release about every 2 weeks
Nearly every release is documented
notes for 59 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
6 years old
130 releases · first in 2020
One column per quarter.
Nearly all core functionality has been rewritten, refactored, or replaced. Please make sure to review all the breaking changes, as most of the previou…
Robocop 6.0 is a major release of both Robocop and Robotidy (!) tools.
Although this is the 6th major version of Robocop, the scope of changes is larger than ever before. Nearly all core functionality has been rewritten, refactored, or replaced. Please make sure to review all the breaking changes, as most of the previous commands or configuration files will be compatible with this release.
See full release notes at release notes.
For quick overview of how to use current robocop, see below examples:
# lint files
robocop check
# format files
robocop format
# migrate old configuration
robocop migrate <config_path>
# lint with only one rule
robocop check --select variable-not-left-aligned
# lint selected paths
robocop check tests/
# format with only one formatter
robocop format --select NormalizeSeparators
Robocop 6.0 is major release of both Robocop and Robotidy (!) tools.
Although this is the 6th major version of Robocop, the scope of changes is larger than ever before. Nearly all core functionality has been rewritten, refactored, or replaced. Please make sure to review all the breaking changes, as most of the previous commands or configuration files will be compatible with this release.
We have decided to merge both Robocop and Robotidy tools. This challenging decision was made for the following reasons:
It's more efficient to maintain a single tool rather than two, as there was some code overlap between them
Robotidy was developed after Robocop and used entirely different libraries and architecture for CLI and configuration management. Implementing the same feature in both tools resulted in duplicate effort
This migration requires us to rewrite much of the code, providing a opportunity to redefine some of our core architecture
We believe the merged tool will offer a significantly better user experience
Merging the tools means that:
Robotidy is no longer developed and will now exist as 'Formatter' part of the Robocop
Robocop is now split into two modes, 'Formatter' and 'Linter'
The basic usage is:
robocop check robocop format
There are several breaking changes to the configurations. You can migrate old toml configuration files with the following command:
robocop migrate <config_path>
It will create new file named <config_path>_migrated.toml with translated option names and their structure. Rule ids are also converted to new format, but patterns are not migrated (such as 02*).
Most of the options were renamed to normalize naming between two tools or to make it more user friendly. Some of the old options (like --exclude) are now used for something else.
Rule selection options are now renamed:
-i/--include became -s/--select
-e/--exclude became -i/--ignore
---
File inclusion changes:
Previously, Robocop used paths argument and Robotidy src for selecting paths. It was then additionally configured using options for filtering based on directory names or file types.
Now the role of paths was taken by include and --default--include (*.robot and .resource) options. It is recommended to use cli for selecting directory and leave it to robocop to find and filter out files. If nothing is configured (we only run robocop check / robocop format) then it will start from the current directory. List of new or deprecated options:
paths became --include
-ft/--filetypes is now deprecated in favour of using --include or --default-include option
-g/--ignore became -e/--exclude (additionally excluded paths)
-gd/--ignore-default became --default-exclude (paths excluded by default)
More on how to configure file paths in the file discovery section in the documentation.
---
--list options were overhauled and became commands:
Robocop --list used to list available rules became list rules command:
robocop list rules
Robocop -lr/--list-reports used to list available reports became ``list reports command:
robocop list reports
Robocop -lc / --list-configurables was overhauled and was incorporated to docs command:
robocop docs line-too-long
This command will print rule documentation and possible parameters.
Robotidy --list used to list available formatters became list formatters command:
robocop list formatters
Describe options (--desc) are now replaced by docs command which can print rule, report or formatter documentation.
---
Issue format --format is now renamed to --issue-format.
Formatting options from Robotidy:
--lineseparator became --line-ending
--spacecount became --space-count
-sl/--startline became --start-line
-el/--endline became --end-line
-rules / --ext-rules can be now only used under --custom-rules name.
--load-transformers / --custom-transformers is now renamed to --custom-formatters.
---
-nr / --no-recursive is now deprecated. Similar behaviour can be attained by passing file paths to robocop or configuring --exclude option.
--transform option used to select formatters is now deprecated. It has been replaced by --select which function in a similar way but has one key difference: it does not support configuration. Configuration can be now passed only to dedicated --configure option.
Previous command:
robotidy --transform YourTransformer:parameter=value --configure DefaultTransformer:other_parameter=value
Can be now achieved by:
robocop format --select YourTransformer --configure YourTransformer.parameter=value --configure DefaultTransformer.other_parameter=value
All other transform mentions were also deprecated, for example:
TRANSFORMERS list inside custom formatters to indicate order of the formatting should be now named FORMATTERS
Transformer class was renamed to Formatter
Linter alternative configuration file format - --argumentfile / .robocop file is now deprecated. From now on we will only support one configuration file format (toml based).
More information on current configuration file syntax at file discovery.
Robocop used two : to separate param and value in --config option. Robotidy used : and =. New Robocop now uses . and =. Previous configuration changed from:
robocop --configure rule_or_report:param:value robotidy --configure transformer:param=value
to:
robocop check --configure rule_or_report.param=value robocop format --configure formatter.param=value
---
It is also no longer possible to chain multiple configurations in one configure call. Following example:
robotidy --configure formatter:param=value:param2=value
For readability reasons it can be now done only using separate options:
robocop format --configure formatter:param=value --configure formatter:param2=value
---
Passing configuration through file names that contains formatter is also deprecated:
robotidy --configure MyFormatter.py:param=2
Use implicit name of the formatter instead:
robocop format --configure MyFormatter.param=2
Due to merge of the tool, syntax of the configuration file has changed. Most of the changes originate from the changes to option names etc. Some of the changes are however dictated by the merge itself.
General settings are now available under tool.robocop section:
[tool.robocop] exclude = ["excluded_dir/"]
Linter or formatter specific settings are avaiable under lint or format sections:
[tool.robocop.lint]
configure = [
"line-too-long.line_length=110"
]
[tool.robocop.format]
skip = ["documentation"]
configure = [
"NormalizeSeparators.skip_documentation=False"
]
Documentation describes with examples where particular options should be configured.
Formatter --target-version can now only accept numbers. Previous configuration such as --target-version RF5 should be now --target-version 5.
Relative path to source is now used by default when printing the linter issues.
Previous output, if run from robot_project directory:
D:/code/robot_project/tests/test.robot:19:59 [W] 0601 Tag '${var} space' should not contain spaces (tag-with-space)
New output:
robot_project/tests/test.robot:19:59 [W] 0601 Tag '${var} space' should not contain spaces (tag-with-space)
Previous issue format keyword source_rel is deprecated and source is used instead. It is still possible to use absolute paths in output by configuring issue format to source_abs:
robocop check --issue-format "{source_abs}:{line}:{col} [{severity}] {rule_id} {desc} ({name})"
As part of the improved and safer design, linter option --output is now deprecated.
Instead, text_file report can be used:
robocop check --reports text_file --configure text_file.output_path=output/robocop.txt
text_file report supports only simple issue output format.
Robotidy offered multiple options to skip formatting of different statement types, if the formatter allows it:
--skip-documentation --skip-return-values --skip-keyword-call --skip-keyword-call-pattern --skip-settings --skip-arguments --skip-setup --skip-teardown --skip-timeout --skip-template --skip-return --skip-tags --skip-comments --skip-block-comments --skip-sections
Several options were combined under single option named skip:
--skip documentation --skip return-values --skip settings --skip arguments --skip setup --skip teardown --skip timeout --skip template --skip return --skip tags --skip comments --skip block-comments --skip-sections --skip-keyword-call --skip-keyword-call-pattern
skip accept multiple values from the cli or the configuration files.
Overriding skip on the formatter level still uses previous syntax:
robocop format --configure AlignKeywordsSection.skip_arguments=True
Return status (exit code) of Robocop depended on internal, always enabled return_status report. It was calculated based on parameter quality_gate. Default configuration:
quality_gate = {
'E': 0,
'W': 0,
'I': -1
}
It means that any error or warning will count towards exit code. Information messages by default were not counted towards exit code. Actual exit code is number of issues over set limit, up to 255 (for example with 'W': 100 and 105 warnings, exit code will be 5).
This behaviour wasn't clear to most, and makes Robocop unpredictable when run in CI/CD pipelines. That's why we are now making return_status report optional. It means that now exit code follows different logic:
0, if no rule violations were found
1, if violations were found
2, if Robocop terminated abnormally
It is possible to always return 0, ignoring any violations, with new --exit-zero flag. The previous behaviour can be reproduced by simply enabling return_status report again:
robocop check --reports return_status
compare_runs was special report that had to be enabled in order to compare reports results from current run with previous runs. It was bit of a workaround, that's why it was removed.
To compare results, use --compare flag:
robocop check --compare
Remember that you still need results from previous run (saved with --persistent) and comparison is done on results from the reports. Full example:
robocop check --persistent --compare --reports all
We have introduced non-default, 'community' rules in effort to increase contributions from the community. However we noticed that it does not make sense to split our rules into 'internal' and 'community' ones - the rules contributed from the users are often added as the default rules. For rules that should be optional it is enough to set them as non-default rules.
For that reason we are deprecating term 'community' rules and all options related to it, such as filtering list of rules by community rules.
Robocop previously allowed to select / ignore / configure rules using rule id with rule severity. For example:
robocop check --select W1010 --select 1011
Since rule severity is configurable, it could be potentially confusing. Additionally it caused unindented issues when using rule id with non-numeric characters (for example ERR001 could be interpreted as RR001 instead). For those reasons it's not possible anymore to refer to rule using rule id with its severity. Use rule id without severity or rule name instead:
robocop check --select DOC01 --select missing-doc-test-case
We have reviewed all the rules to improve rule ids, names, documentation, messages and overall design. It would be too much to list of all the changes, but we will list all changes that have impact on the users.
Renamed messages
Multiple rules messages were updated to avoid words such as should be or suggestions for fixes and to simply state what's the actual issue. For example bad-block-indent message:
Indent expected. Provide 2 or more spaces of indentation for statements inside block
became:
Not enough indentation inside block
The goal was to have clear and shorter messages. Actual issue is well described thanks to the rule documentation and new output format (which displays source around the issue).
Rule id changes
Previous rule ids consisted of group id and unique rule number. For example 0201 - 02 was documentation group id while 01 was unique rule number. This naming scheme wasn't clear and made it harder to categorize rule on first glance. That's why we have switched to alphanumeric group names (for example DOC instead of 02). Various groups are also additionally split into smaller sub-groups. This change leads to backward incompatible changes to all rule ids.
Documentation rules are now grouped under 'DOC' group:
0201 became DOC01 (missing-doc-keyword)
0202 became DOC02 (missing-doc-test-case)
0203 became DOC03 (missing-doc-suite)
0204 became DOC04 (missing-doc-resource-file)
Tags rules are now grouped under 'TAG' group:
0601 became TAG01 (tag-with-space)
0602 became TAG02 (tag-with-or-and)
0603 became TAG03 (tag-with-reserved-word)
0605 became TAG05 (could-be-test-tags)
0606 became TAG06 (tag-already-set-in-test-tags)
0607 became TAG07 (unnecessary-default-tags)
0608 became TAG08 (empty-tags)
0609 became TAG09 (duplicated-tags)
0610 became TAG10 (could-be-keyword-tags)
0611 became TAG11 (tag-already-set-in-keyword-tags)
Comments rules are now grouped under 'COM' group:
0701 became COM01 (todo-in-comment)
0702 became COM02 (missing-space-after-comment)
0703 became COM03 (invalid-comment)
0704 became COM04 (ignored-data)
0705 became COM05 (bom-encoding-in-file)
Import related rules are now grouped under 'IMP' group:
0911 became IMP01 (wrong-import-order)
0926 became IMP02 (builtin-imports-not-sorted)
10101 became IMP03 (non-builtin-imports-not-sorted)
10102 became IMP04 (resources-imports-not-sorted)
Spacing and whitespace related rules are now grouped under 'SPC' group:
1001 became SPC01 (trailing-whitespace)
1002 became SPC02 (missing-trailing-blank-line)
1003 became SPC03 (empty-lines-between-sections)
1004 became SPC04 (empty-lines-between-test-cases)
1005 became SPC05 (empty-lines-between-keywords)
1006 became SPC06 (mixed-tabs-and-spaces)
1008 became SPC08 (bad-indent)
1009 became SPC09 (empty-line-after-section)
1010 became SPC10 (too-many-trailing-blank-lines)
1011 became SPC11 (misaligned-continuation)
1012 became SPC12 (consecutive-empty-lines)
1013 became SPC13 (empty-lines-in-statement)
1014 became SPC14 (variable-should-be-left-aligned -> variable-not-left-aligned)
1015 became SPC15 (misaligned-continuation-row)
1016 became SPC16 (suite-setting-should-be-left-aligned -> suite-setting-not-left-aligned)
1017 became SPC17 (bad-block-indent)
1018 became SPC18 (first-argument-in-new-line)
0402 became SPC19 (not-enough-whitespace-after-setting)
0406 became SPC20 (not-enough-whitespace-after-newline-marker)
0410 became SPC21 (not-enough-whitespace-after-variable)
0411 became SPC22 (not-enough-whitespace-after-suite-setting)
Duplications related rules are now grouped under 'DUP' group:
0801 became DUP01 (duplicated-test-case")
0802 became DUP02 (duplicated-keyword)
0803 became DUP03 (duplicated-variable)
0804 became DUP04 (duplicated-resource)
0805 became DUP05 (duplicated-library)
0806 became DUP06 (duplicated-metadata)
0807 became DUP07 (duplicated-variables-import)
0808 became DUP08 (section-already-defined)
0810 became DUP09 (both-tests-and-tasks)
0813 became DUP10 (duplicated-setting)
Length related rules are now grouped under 'LEN' group:
0501 became LEN01 (too-long-keyword)
0502 became LEN02 (too-few-calls-in-keyword)
0503 became LEN03 (too-many-calls-in-keyword)
0504 became LEN04 (too-long-test-case)
0528 became LEN05 (too-few-calls-in-test-case)
0505 became LEN06 (too-many-calls-in-test-case)
0507 became LEN07 (too-many-arguments)
0508 became LEN08 (line-too-long)
0509 became LEN09 (empty-section)
0510 became LEN10 (number-of-returned-values)
0511 became LEN11 (empty-metadata)
0512 became LEN12 (empty-documentation)
0513 became LEN13 (empty-force-tags)
0514 became LEN14 (empty-default-tags)
0515 became LEN15 (empty-variables-import)
0516 became LEN16 (empty-resource-import)
0517 became LEN17 (empty-library-import)
0518 became LEN18 (empty-setup)
0519 became LEN19 (empty-suite-setup)
0520 became LEN20 (empty-test-setup)
0521 became LEN21 (empty-teardown)
0522 became LEN22 (empty-suite-teardown)
0523 became LEN23 (empty-test-teardown)
0524 became LEN24 (empty-timeout)
0525 became LEN25 (empty-test-timeout)
0526 became LEN26 (empty-arguments)
0527 became LEN27 (too-many-test-cases)
0506 became LEN28 (file-too-long)
0529 became LEN29 (empty-test-template)
0530 became LEN30 (empty-template)
0531 became LEN31 (empty-keyword-tags)
Variable related rules are now grouped under 'VAR' group:
0912 became VAR01 (empty-variable)
0920 became VAR02 (unused-variable)
0922 became VAR03 (variable-overwritten-before-usage)
0929 became VAR04 (no-global-variable)
0930 became VAR05 (no-suite-variable)
0931 became VAR06 (no-test-variable)
0310 became VAR07 (non-local-variables-should-be-uppercase)
0316 became VAR08 (possible-variable-overwriting)
0317 became VAR09 (hyphen-in-variable-name)
0323 became VAR10 (inconsistent-variable-name)
0324 became VAR11 (overwriting-reserved-variable)
0812 became VAR12 (duplicated-assigned-var-name)
Argument related rules are now grouped under 'ARG' group:
0919 became ARG01 (unused-argument)
0921 became ARG02 (argument-overwritten-before-usage)
0932 became ARG03 (undefined-argument-default)
0933 became ARG04 (undefined-argument-value)
0407 became ARG05 (invalid-argument)
0811 became ARG06 (duplicated-argument-name)
0532 became ARG07 (arguments-per-line)
Deprecated syntax or code replacement recommendations are now grouped under 'DEPR' group:
0908 became DEPR01 (if-can-be-used)
0319 became DEPR02 (deprecated-statement)
0321 became DEPR03 (deprecated-with-name)
0322 became DEPR04 (deprecated-singular-header)
0327 became DEPR05 (replace-set-variable-with-var)
0328 became DEPR06 (replace-create-with-var)
Naming rules are now grouped under 'NAME' group:
0301 became NAME01 (not-allowed-char-in-name)
0302 became NAME02 (wrong-case-in-keyword-name)
0303 became NAME03 (keyword-name-is-reserved-word)
0305 became NAME04 (underscore-in-keyword-name)
0306 became NAME05 (setting-name-not-in-title-case)
0307 became NAME06 (section-name-invalid)
0308 became NAME07 (not-capitalized-test-case-title)
0309 became NAME08 (section-variable-not-uppercase)
0311 became NAME09 (else-not-upper-case)
0312 became NAME10 (keyword-name-is-empty)
0313 became NAME11 (test-case-name-is-empty)
0314 became NAME12 (empty-library-alias)
0315 became NAME13 (duplicated-library-alias)
0318 became NAME14 (bdd-without-keyword-call)
0320 became NAME15 (not-allowed-char-in-filename)
0325 became NAME16 (invalid-section)
0326 became NAME17 (mixed-task-test-settings)
Other rules are now grouped under 'MISC' group:
0901 became MISC01 (keyword-after-return)
0903 became MISC02 (empty-return)
0907 became MISC03 (nested-for-loop)
0909 became MISC04 (inconsistent-assignment)
0910 became MISC05 (inconsistent-assignment-in-variables)
0913 became MISC06 (can-be-resource-file)
0914 became MISC07 (if-can-be-merged)
0915 became MISC08 (statement-outside-loop)
0916 became MISC09 (inline-if-can-be-used)
0917 became MISC10 (unreachable-code)
0918 became MISC11 (multiline-inline-if)
0923 became MISC12 (unnecessary-string-conversion)
0924 became MISC13 (expression-can-be-simplified)
0925 became MISC14 (misplaced-negative-condition)
Miscellaneous keyword related rules are now grouped under 'KW' group:
10001 became KW01 (sleep-keyword-used)
10002 became KW02 (not-allowed-keyword)
10003 became KW03 (no-embedded-keyword-arguments)
10101 became KW04 (unused-keyword)
Order related rules (except imports) are now grouped under 'ORD' group:
0927 became ORD01 (test-case-section-out-of-order)
0928 became ORD02 (keyword-section-out-of-order)
Previous rule design is deprecated in favour of new, more OOP-like design.
Example of the old syntax:
from robocop.checkers import VisitorChecker
from robocop.rules import Rule, RuleSeverity
rules = {
"1101": Rule(rule_id="1101", name="smth", msg="Keyword call after [Return] statement", severity=RuleSeverity.ERROR)
}
class SmthChecker(VisitorChecker):
"""Checker for keyword calls after [Return] statement."""
reports = ("smth",)
def visit_Keyword(self, node): # noqa: N802
(...)
self.report("smth", node=node)
Rules are no longer defined in a global dictionaries. Each rule should be defined in their own class:
from robocop.linter.rules import Rule, RuleSeverity, VisitorChecker
class ExternalRule(Rule):
"""
Keyword call after ``[Return]`` statement.
``[Return]`` setting does not return from keyword and only set which variables will be returned.
To avoid confusion it is better to define it at the end of keyword.
"""
name = "smth"
rule_id = "EXT01"
message = "Keyword call after [Return] statement"
severity = RuleSeverity.ERROR
class SmthChecker(VisitorChecker):
"""Checker for keyword calls after [Return] statement."""
smth: ExternalRule
def visit_Keyword(self, node): # noqa: N802
(...)
self.report(self.smth, node=node)
Rules can be 'attached' to checkers that will be using them by using class attribute together with type hint:
smth: ExternalRule
Robocop will find and instantiate such attributes.
Rule params should use now refer directly to such attribute instead of previous self.param("rule_name", "param_name") calls:
self.rule_name.param_name
Thanks for this design it's also possible to move part of the implementation inside rule class, with less rule-specific code in the visitor.
Note that various import paths also changed - for example from:
from robocop.checkers import VisitorChecker from robocop.rules import Rule, RuleSeverity
to:
from robocop.linter.rules import Rule, RuleSeverity, VisitorChecker
We have normalized Robocop and Robotidy disablers several releases ago, but old syntax was still allowed. We are now deprecating it for good. Due to merge and deprecation of Robotidy, we also deprecate robotidy directive.
Currently supported syntax for linter:
# noqa # robocop: off # robocop: on
And formatter:
# fmt: off # fmt: on # robocop: fmt: off # robocop: fmt: on
Deprecated syntax:
# robotidy: on # robotidy: off # robocop: enable # robocop: disable
New syntax still supports disabling selected rules or formatters (# robocop: off=rule_name).
Rule messages used Jinja templates:
"Keyword argument '{{ name }}' is not used"
It was unnecessary complex as we only used it for value substitution - there is no need for using any other Jinja features. It is now replaced with Python format syntax:
"Keyword argument '{name}' is not used"
It's important only for users who have custom rules using templates in messages.
Since Robocop supported Robot Framework >=3.2.2 and Robotidy >=4.0 we had to use 4.0 as baseline version. However Robocop can still be used to lint code written for RF 3 - but you need environment with at least RF 4 to run Robocop.
Python 3.8 is no longer supported by Python foundation - we are also dropping support for it.
In this release we have added several new reports, that are file-based (such as gitlab, sonarqube etc reports). To make it simpler and more logical, I have standardized how the output path can be configured for such reports.
Following configuration parameters are now deprecated in json and sarif reports:
output_dir
report_filename
Instead, we can use output_path to configure both directory and filename:
robocop check --reports sarif --configure sarif.output_path=reports/sarif.json robocop check --reports gitlab --configure gitlab.output_path=reports/gitlab.json
Robocop can now use multiple configuration files. With the following example:
project/
file1.robot
pyproject.toml # config1
subdir/
file1.robot
file2.robot
pyproject.toml # config2, excludes file1.robot
We will end up with the following files:
project/file1.robot, using config1 configuration
project/file2.robot, using config2 configuration
This feature allow to apply different configuration (for example exclude specific rules in the directory) for all directories in your project.
Note that settings that affect whole run (reports or flags such as --persistent or --exit-zero) are only loaded from the file which is closest to the current working directory or from the cli. Multiple configuration files are usually best to use for rules and formatters configuration.
Reporting linter issues is now handled by print_issues report. It's an internal report, enabled by default. Thanks for this change it is easier to handle different types of outputs or even completely silence linter output.
There are 3 different output formats supported by print_issues:
extended, new default. It prints source code alongside the issue:
test.robot:10:10 ARG03 Undefined argument default, use ${baz}=${EMPTY} instead
|
8 | ... ${foo}
9 | ... ${bar}=123
10 | ... ${baz}=
| ^^^^^^^ ARG03
11 | ... ${lorum}=${ipsum}
12 | No Operation
|
grouped. It groups issues for each source file:
tests\linter\rules\tags\unnecessary_default_tags\test.robot: 3:1 0607 Tags defined in Default Tags are always overwritten (unnecessary-default-tags) 4:1 1003 Invalid number of empty lines between sections (1/2) (empty-lines-between-sections) tests\linter\rules\tags\tag_already_set_in_test_tags\keyword_tag.robot: 3:1 0319 'Force Tags' is deprecated since Robot Framework version 6.0, use 'Test Tags' instead (deprecated-statement)
simple, previous default. It print issue location and message in one line:
test.robot:3:30 [E] ARG03 Undefined argument default, use ${bar}=${EMPTY} instead
test.robot:10:10 [E] ARG03 Undefined argument default, use ${baz}=${EMPTY} instead
You can change output format by configuring print_issues report:
robocop check --configure print_issues.output_format=grouped
Support for Robot Framework official style guide: https://docs.robotframework.org/docs/style_guide .
It includes updating our rules and formatters to align with recommendations from the style guide, cross referencing between Robocop and Style Guide documentation and adding missing rules.
You can list all rules that refer to official style guide rule:
robocop list rules --filter STYLE_GUIDE
It is ongoing process and there will be more updates in upcoming versions of Robocop.
Robocop could be already integrated with some CI/CD platforms. We made an active effort of documenting existing integrations and implementing it for missing, popular platforms such as Gitlab or Sonar Qube.
We are now supporting following integrations:
Gitlab Code Quality (with gitlab report) (#1116)
SonarQube (with sonarqube report) (#759)
pre-commit
... and more - see the Integrations documentation
Note that due to changes to how Robocop is used, previous pre-commit configuration will not work. For Robocop 6.0+ use configuration proposed in the documentation.
We have growing number of non-default (disabled by default) rules. This requires period checking of the release notes if there is new rule that may be worth to be enabled. If you want instead to always enable all rules and chose what to disable (rather than selecting all rules that you want to enable one by one) you can now use special keyword ALL:
robocop check --select ALL
[tool.robocop.lint]
select = [
"ALL"
]
ignore = [
"rules-you-want-to-disable"
]
You can now use shell autocompletion by installing it for the current shell:
robocop --install-completion
You can now filter out rules using --target-version same as formatter (robotidy) previously.
With following command:
robocop check --target-version 5
Only rules compatible with Robot Framework 5 or lower will be enabled.
Since target version is now shared option, it needs to be configured in common section:
[tool.robocop] target_version = 5 [tool.robocop.lint] [tool.robocop.format] # previously it could be only configured in format
Robocop and Robotidy followed different recommended order of keyword and test case settings. Adjusted formatted to follow Robocop order, which is also recommended order by the Robot Framework Style Guide:
*** Test Cases ***
Test Case
[Documentation]
[Tags]
[Timeout]
[Setup]
[Template]
Static Variable Assignments
Keyword Calls
Verification Keyword Call
[Teardown]
*** Keywords ***
Keyword
[Documentation]
[Tags]
[Arguments]
[Timeout]
[Setup]
Static Variable Assignments
Keyword Calls
[Teardown]
TAG05 could-be-test-tags and TAG10 could-be-keyword-tags will now ignore builtin tags. Following code will not warn anymore that builtin tag (robot:private) should be set in Keyword or Test Tags:
*** Keywords ***
Keyword
[Tags] robot:flatten robot:private
No Operation
Keyword 2
[Tags] robot:flatten robot:private
No Operation
Project-level checks are temporarily disabled. It will be later migrated to separate command that will scan whole project.
Using stdin (robocop check -) is temporarily disabled for linting and formating. It will be enabled again in the future releases.
Missing condition caused Robocop to throw an exception when expression_can_be_simplified rule was enabled.
Example of code that is now properly handled:
*** Keywords ***
Keyword
${variable} Set Variable If
IF
END
Following code will now report invalid [Metadata] setting use:
*** Keywords ***
[Invalid] reported before
[Metadata] not reported
Keyword
Following code will now report invalid-setting instead off not-enough-whitespace-after-suite-setting:
*** Test Cases ***
Keyword
[Doc Umentation]
VAR09 hyphen-in-variable-name is now reported also inside *** Variables *** sections and settings.
Following code will now not report ARG02 argument-overwritten-before-usage:
Argument Conditionally Overwritten
[Documentation] It should be ignored as it's not always overwritten.
[Arguments] ${to_print} ${another_arg}
IF ${another_arg} != "KEEP"
VAR ${to_print} "overwrite"
END
Log To Console ${to_print}
ARG01 unused-argument and VAR02 unused-variable rules will now properly detect usage of variables in following cases:
*** Keywords ***
Extended Variable Syntax
[Arguments] ${arg1} ${arg2} ${arg3} ${arg4} ${arg5} ${arg6}
Log ${arg1 + "test"}
Log ${arg2 * 3}
Log ${arg3[1]}
Log ${arg4 == "test"}
Log ${arg5 == arg6}
${var1} ${var2} ${var3} ${var4} ${var5} ${var6} ${var7} ${vaR8} ${var9} Keyword Call
Log ${var1 + "test"}
Log ${var2 * 3}
Log ${var3[1]}
Log ${var4 == "test"}
Log ${var5 == var6}
Log ${VAR7[1]}
Log ${var5 == var8}
Log ${var9.attribute}
ARG01 unused-argument and VAR02 unused-variable rules will now properly detect usage of variables in EXCEPT branch:
Used in EXCEPT branch
[Arguments] ${arg1} ${arg2} ${arg3} ${arg4} ${arg5} ${arg6} ${arg7}
TRY
May Fail ${arg1}
EXCEPT ${arg2}
No Operation
EXCEPT ${arg3} ${arg4}
No Operation
EXCEPT Error AS ${arg5} # used variable, overwrites, should raise overwrite of unused
Use ${arg5}
EXCEPT Error AS ${arg6} # unused variable, overwrites, should raise overwrite of unused
No Operation
END
TRY
Some Keyword
EXCEPT ValueError: .* type=${arg7}
No Operation
END
If the variable was declared inside IF branch and the same variable name was used as the IF header, it would be marked as used. Similarly if any of the IF branches used variable, all instances of this variable inside IF were marked as used.
Following code will now properly raise issues:
*** Keywords ***
Used in one branch and header
IF condition
${var} Keyword # not used
ELSE IF ${var}
${var} Keyword
Log ${var}
END
IF condition
${var2} Keyword
Log ${var2}
ELSE IF ${var2}
${var2} Keyword # not used
END
If FOR/WHILE loop contained another loop, variables used before it were not marked as used.
Following code will now not raise an issue:
*** Keywords ***
Double FOR loops
VAR ${continuation_token} value
FOR ${i} IN RANGE ${{ int($retries)+1 }}
${response} Get Events ${continuation_token}
FOR ${_} IN @{response}[events]
No Operation
END
VAR ${continuation_token} ${response}[continuationToken]
END
If non-local variable used another variable as name, it was incorrectly reported as non-local.
Following code will now not raise an issue:
*** Keywords ***
${name} "MY UPPERCASE VARIABLE NAME"
Set Global Variable ${${name}} "My variable value"
Set Global Variable ${${name}_VAR} "My variable value" # non variable parts still needs to be upper case
Since we don't track variable values in linting, we do not check if ${name} use upper case or not - such cases are ignored.
Templated suites (with the use of Test Template setting) allows to use different styles of alignment. It doesn't work well with bad-indent rule and caused false positive warnings. It is now disabled for templated suites. Instead we will implement separate rule for templated suites alignment.
RenameVariables formatter from now on will rename arguments in [Template] to lower-case instead of upper-case:
Template arguments are local scope
[Template] My Keyword ${embedded_arg}
value1
value2
RenameVariables will no longer ignore variables in TRY EXCEPT header and WHILE limit option:
EXCEPT With Dynamic Error
[Arguments] ${expected_error}
TRY
No Operation
EXCEPT ${expected_error}
No Operation
END
WHILE With Limit
[Arguments] ${limit}
WHILE ${CONDITION} limit=${limit}
No Operation
END
When merging duplicated sections, formatter uses header of the first encountered header. In case of comments section it led to removing header from sections that had it. It should be fixed now.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Fixes/warns about false positives for E0932 undefined-argument-value rule (#1160 #1161)
Fixes/warns about false positives for E0932 undefined-argument-value rule (#1160 #1161)
If the keyword call contains = character but is not keyword argument, it may trigger E0932 rule:
Push Buttons C${expression}=
Get Text xpath=(//h4)[5] *= min
Get Text xpath=(//h4)[5] == min
After the fix we are ignoring some of the cases (such as names that would be invalid argument name).
Thanks to @Lakitna for providing fix.
Update Robocop rules with GROUP support from Robot Framework 7.2.
Update Robocop rules with GROUP support from Robot Framework 7.2.
Release notes at release notes.
Update Robocop rules with GROUP support from Robot Framework 7.2.
Following rules are updated & tested with GROUPs:
invalid-if
missing-keyword-name
parsing-error
return-in-test-case
too-many-calls-in-keyword
too-many-calls-in-test-case
possible-variable-overwriting
bad-indent
bad-block-indent
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
2 new rules (undefined-argument-default and undefined-argument-value) and fix for custom rules importing mechanism.
2 new rules (undefined-argument-default and undefined-argument-value) and fix for custom rules importing mechanism.
Release notes at release notes.
Thanks to @Lakitna for adding new rules and providing fixes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.7.0
New rule E0932 undefined-argument-default.
It is technically possible to define keyword argument default with empty string:
*** Keywords ***
My Keyword
[Arguments] ${argument_name}=
This syntax is unclear and it is better to explicitly state that the value is empty using built-in variable:
*** Keywords ***
My Keyword
[Arguments] ${argument_name}=${EMPTY}
New rule catches all occurrences where argument have empty default value and reports it.
New rule E0933 undefined-argument-value.
Similarly to undefined-argument-default, it is possible to pass value to argument with empty string:
Keyword Call argument_name=
It is recommended to use explicit value instead:
Keyword Call argument_name=${EMPTY}
Custom rules directory is now automatically added to python path. It allows to use relative imports inside custom rules module.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
New 3 rules for global variables usage & allow to overwrite rules help url with new argument.
New 3 rules for global variables usage & allow to overwrite rules help url with new argument.
Release notes at release notes.
Thanks to @Lakitna for adding new rules and enhancing Robocop in the process.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.6.0
New rules that prohibits usage of variable setters with global scopes:
W0929 no-global-variable
W0930 no-suite-variable
W0931 no-test-variable
Using global variables might be necessary in some cases; however, they often result in code that is difficult to understand. It's generally better to avoid them and instead use local variables.
Robocop rules pointed to default rules documentation webpage (https://robocop.readthedocs.io/en/stable/rules_list.html). Because of that, any custom rule incorrectly pointed out to the robocop rules page.
With this change, it's now possible to overwrite default rules documentation page using help_url argument:
(...) "0601": Rule( rule_id="0601", name="custom-rule", msg="Custom message", severity=RuleSeverity.WARNING, help_url="https://www.your_company.com/robocop/rules/custom_rule" ),
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
New W10003 no-embedded-keyword-arguments rule that prohibits use of embedded keyword arguments. It is community rule disabled by default. For more inf
New W10003 no-embedded-keyword-arguments rule that prohibits use of embedded keyword arguments.
It is community rule disabled by default. For more information see
https://robocop.readthedocs.io/en/stable/community_rules.html .
Release notes at release notes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.5.0
New W10003 no-embedded-keyword-arguments rule that prohibits use of embedded keyword arguments. It is community rule disabled by default. For more information see https://robocop.readthedocs.io/en/stable/community_rules.html .
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
This release fixes two bugs for W0326 mixed-task-test-settings and I0920 unused-variable rules. W1015 misaligned-continuation-row was also extended wi
This release fixes two bugs for W0326 mixed-task-test-settings and I0920 unused-variable rules. W1015 misaligned-continuation-row was also extended with ignore_run_keywords option (default True).
Release notes at release notes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.4.0
W1015 misaligned-continuation-row detects if statements have misaligned rows:
*** Keywords ***
Misaligned example
Keyword Call
... first argument
... second argument # should be executed
This rules contradicts with how Robotidy aligns nested keywords with IndentNestedKeywords transformer to provide extra alignment for readability purposes:
SSH Wait For Device To Close SSH
[Documentation] Wait until SSH connection is closed by device.
Wait Until Keyword Succeeds 2min 2s
... Run Keyword And Expect Error SSHException: SSH session not active
... SSH Log FW Version level=DEBUG
It is now possible to ignore run keywords by setting ignore_run_keywords to True:
robocop -c misaligned-continuation-row:ignore_run_keywords:True src
By default it is disabled and run keywords are not ignored.
Fixes the issue where all task settings (such as Task Tags) were reported as W0326 mixed-task-test-settings violation in files without Test or Task section.
If the variable was defined in the IF block, I0920 unused-variable was not reported even if variable was not used anywhere:
*** Test Cases ***
Useless variable definition
IF True
${not_used} Keyword Call
END
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
This release brings 4 new rules:
This release brings 4 new rules:
unused-keyword community rulefirst-argument-in-new-line ruletest-case-section-out-of-ordekeyword-section-out-of-orderRule I0912 empty-variable was also adjusted to allow to configure whether variables in *** Variables *** section or VAR variables should be detected.
Thanks to @szymonslodkowski for contributing 3 new rules.
Release notes at release notes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.3.0
New I10101 unused-keyword community rule. This optional rule finds not used keywords defined in suites (robot files with tests/tasks) or private keywords (keywords with robot:private tag).
For example:
*** Test Cases ***
Test that only non used keywords are reported
Used Keyword
*** Keywords ***
Not Used Keyword # this keyword will be reported as not used
[Arguments] ${arg}
Should Be True ${arg}>50
This rule will be developed in the future releases to cover other sources like resource files.
I0912 empty-variable received new parameter variable_source which allows to enable the rule either only for variables from `*** Variables ***` section or only VAR statements. By default it works on both.
New W1018 first-argument-in-new-line rule that checks if first argument is placed in the same line as [Argument] setting.
This rule covers Robot Framework Style Guide recommendation:
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
This release brings three new rules for order of the imports. Big thanks for @szymonslodkowski contribution with the new rules.
This release brings three new rules for order of the imports. Big thanks for @szymonslodkowski contribution with the new rules.
Release notes at release notes.
This release brings three new rules for order of the imports. Big thanks for @szymonslodkowski contribution with the new rules.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.2.0
New community (optional) rule W10101 non-builtin-imports-not-sorted.
Example of rule violation:
*** Settings *** Library Collections Library CustomLibrary Library AnotherCustomLibrary # AnotherCustomLibrary library defined after custom CustomLibrary
New community (optional) rule W10102 resources-imports-not-sorted.
Example of rule violation:
*** Settings *** Resource CustomResource.resource Resource AnotherFile.resource
New rule W0926 builtin-imports-not-sorted.
Example of rule violation:
*** Settings *** Library OperatingSystem Library Collections # BuiltIn libraries imported not in alphabetical order
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Release notes at release notes.
Release notes at release notes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.1.0
New community (optional) rule W10002 not-allowed-keyword. You can use this rule to find keywords that should not be used in your project.
For example with following configuration:
> > robocop -i not-allowed-keyword -c not-allowed-keyword:keywords:click_using_javascript,click_with_sleep
It will find and raise issues in the following code:
*** Test Cases ***
Test with obsolete keyword
[Setup] Click With Sleep 1 min # Robocop will report not allowed keyword
Test Step
*** Keywords ***
Keyword With Obsolete Implementation
[Arguments] ${locator}
Click Using Javascript ${locator} # Robocop will report not allowed keyword
If last section of the file wasn't Tasks section, Robocop assumed that file contains only Test Cases section. This caused W0326 mixed-task-test-settings to be issued with incorrect message.
Thanks @MrBIN89 for finding the issue.
Variables in FOR option should be now recognized by W0919 unused-argument:
*** Keywords ***
Keyword With For
[Arguments] ${argument}
# ${argument} will no longer issue unused-argument
FOR ${index} ${value} IN ENUMERATE @{LIST} start=${argument}
Log ${value}
END
I0920 unused-variable was incorrectly raised even if variable was used in Test Case / Keyword [Tags] or [Documentation]. Following code should not raise any issue anymore:
*** Variables ***
${VAR_DOCUMENTATION} Documentation value
${VAR_TAG} Tag value
*** Test Cases ***
Test variable in documentation
[Documentation] ${VAR_DOCUMENTATION}
No Operation
Test variable in tags
[Documentation] Documentation in test about variable in tags
[Tags] ${VAR_TAG}
No Operation
Following code will not raise W0704 ignored-data anymore since comments section contains only robocop disabler and empty lines:
# robocop: off=0701
*** Test Cases ***
First Test Case
[Documentation] Doc
No Operation
Additionally robotidy disablers (# robotidy: off) are now recognized as well.
Relative paths in argument files will be now resolved correctly. For example, using following command:
robocop -A tests/args.txt
And tests/args.txt file:
--ext-rules rules/robocop_rules.py
--ext-rules rules/robocop_rules.py will be resolved to --ext-rules tests/rules/robocop_rules.py. This behaviour already worked for toml configuration files and wasn't working correctly for argument files.
It was possible to disable Robocop for selected or all rules in the given file. However such disablers had to be defined in the the first line of the file:
# robocop: off
*** Test Cases ***
Test
Step
It is now also possible to define file-level disablers anywhere in the first comment section:
# robocop: off=onerule
# explanation why the rule is disabled
# robocop: off=onerule2
*** Test Cases ***
Test
Step
It is now possible to disable all reports with special keyword None:
robocop --reports all,None
It is useful when Robocop joins configuration from multiple sources (configuration files or cli) but user want to override any configured report and do not run any report.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Release notes at release notes.
Release notes at release notes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.0.4
I0920 unused-variable was incorrectly reported if the variable was declared in the *** Variables *** section and used in [Setup], [Teardown] or [Timeout].
Using VAR to elevate scope of the variable should not longer report I0316 possible-variable-overwriting:
*** Test Cases ***
${date} Get Invoice Date
VAR ${DATE} ${date} scope=SUITE
Variables in tags are now not checked by tag rules but variable rules only.
For example:
*** Test Cases ***
Test with dynamic tag
[Tags] tag${GLOBAL VARIABLE}
Step
Will now not raise W0601 tag-with-space since the space is inside variable name.
Keyword tags can be specified on the last line of the documentation with Tags: prefix. It was handled by Robocop already but not all tags were parsed correctly. For example:
*** Keywords ***
Already working
[Documentation] Tags: tag
Step
Multiple tags not supported before
[Documentation] Tags: tag1, tag2
Step
Multiple spaces not supported before
[Documentation] Tags: tag1, tag2
Step
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Fixed W0204 missing-doc-resource-file not raised if the file contained * Settings * section (#1046).
Fixed W0204 missing-doc-resource-file not raised if the file contained *** Settings *** section (#1046).
Read more in full release notes.
Fixed W0204 missing-doc-resource-file not raised if the file contained *** Settings *** section (#1046).
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.0.3
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Fix for 0920 unused-variable not recognizing variables from * Variables * section used in * Settings * and keyword arguments default values (#1049).
Fix for 0920 unused-variable not recognizing variables from *** Variables *** section used in *** Settings *** and keyword arguments default values (#1049).
Read more in full release notes.
Fix for 0920 unused-variable not recognizing variables from *** Variables *** section used in *** Settings *** and keyword arguments default values (#1049).
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.0.2
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
This release fixes W0301 non-local-variables-should-be-uppercase incorrectly raised on VAR variables (#1045).
This release fixes W0301 non-local-variables-should-be-uppercase incorrectly raised on VAR variables (#1045).
Read more in full release notes.
This release fixes W0301 non-local-variables-should-be-uppercase incorrectly raised on VAR variables (#1045).
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.0.1
Thanks @Shutgun for contributing bug report and raising PR with fix for it.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Additional support for RF 7.0, community rules and several new rules.
Additional support for RF 7.0, community rules and several new rules.
Read more in full release notes.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==5.0.0
Robocop now contains new type of rules: community rules. To put it simply, community rule is just rule disabled by default. However it allows us to add rules that handle specific problems or have certain limitations. Such rules will not be enabled by default and users will be able to choose to run them or not.
Community rule name originates from our purpose behind this feature - we want users (our community) to more actively contribute to Robocop rules. If you developed rule for your company that may benefit more people but is not fit for everyone feel free to add it in our repository.
Existing community rules can be listed with COMMUNITY or ALL filters:
> robocop --list COMMUNITY
Rule - 10001 [W]: sleep-keyword-used: Sleep keyword with '{{ duration_time }}' sleep time found (disabled)
Those rules 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
Community rules - or in other words rules disabled by default - are now part of our core code. It is now also possible to create custom disabled by default rule. If you want to contribute new community rule or create your own custom rule then <check out this doc page>. # TODO
https://robocop.readthedocs.io/en/stable/external_rules.html#rules-disabled-by-default
Following rules now support VAR syntax:
W0310 non-local-variables-should-be-uppercase
I0316 possible-variable-overwriting
I0317 hyphen-in-variable-name
W0323 inconsistent-variable-name
W0324 overwriting-reserved-variable
W0501 too-long-keyword
W0502 too-few-calls-in-keyword
W0503 too-many-calls-in-keyword
W0504 too-long-test-case
W0505 too-many-calls-in-test-case
I0912 empty-variable
W0919 unused-argument
I0920 unused-variable
W0921 argument-overwritten-before-usage
W0922 variable-overwritten-before-usage
Keywords used in Pabot run keywords such as Run Setup Only Once are now recognized as keywords by Robocop rules:
*** Keywords ***
Keyword Run In Parallel
Run Only Once keyword # should raise wrong-case-in-keyword-name
Rule I0923 unnecessary-string-conversion is now deprecated. It reported multiple false positive issues that lead to users breaking the code. If the rule was useful in your project and you know its limitations (coming from not knowing the exact type of the variable in the IF condition) you can reimplement this rule as custom rule in your project.
Variables defined in *** Variables *** section in test/task file and not used within the file are now reported with I0920 unused-variable rule:"
* Variables * ${GLOBAL_USED} value ${GLOBAL_NOT_USED} value # will be reported in Robocop ${GLOBAL_USED_IN_SECTION} value ${GLOBAL_USED2} value with ${GLOBAL_USED_IN_SECTION}
* Test Cases ** Test
[Documentation] Use one global variable and call keyword that uses second. Log ${GLOBAL_USED} Keyword
* Keywords * Keyword
[Documentation] Use second global variable. Log ${GLOBAL_USED2}
Added new I0327 replace-set-variable-with-var rule.
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. Starting from RF 7.0 Robocop will report new issue when Set Variable type of keyword is used.
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
Added new I0328 replace-create-with-var rule.
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. Starting from RF 7.0 Robocop will report new issue when Create Dictionary or Create List keyword is used.
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
Added new I0532 arguments-per-line rule.
If the keyword's [Arguments] are split into multiple lines, it is recommended to put only one argument per every line.
Example of rule violation:
*** Keywords ***
Keyword With Multiple Arguments
[Arguments] ${first_arg}
... ${second_arg} ${third_arg}=default
[Return] setting is now visibly deprecated. The internal Robot Framework model also changed and several Robocop rules had to be updated:
W0306 setting-name-not-in-title-case
W0319 deprecated-statement
W0510 number-of-returned-values
W0903 empty-return
W0919 unused-argument
I0920 unused-variable
Following rules check the keyword naming in [Template] and Test Template:
W0302 wrong-case-in-keyword-name
E0303 keyword-name-is-reserved-word
W0305 underscore-in-keyword-name
W0319 deprecated-statement
Robocop dropped support for Python 3.7 as it is no longer officially supported. See more details at https://endoflife.date/python .
Robot Framework development version (for example 7.0rc1) is considered as final version (for example 7.0) in our version matcher. Thanks to this change it is easier to test rules with not released version - it's not required to define exact version specifier anymore (for example '==7.0rc1').
It's internal change but can have effect on your custom rules if you have rule version specifier using development version:
"XYZ": Rule(
rule_id="XYZ",
name="custom-rule",
msg="custom-message",
severity=RuleSeverity.WARNING,
version=">=4.0alpha", # it is not allowed anymore, use >=4.0 instead
)
Some of our rules were deprecated and then removed in the past. It could lead to issues when jumping from older Robocop versions. Because of that we have introduced mechanism to deprecate the rules. It can be also used in custom rules:
rules = {
"1102": Rule(rule_id="1102", name="custom-rule", msg="Example rule", deprecated=True, severity=RuleSeverity.ERROR),
}
Deprecated rule implementation can be removed and only rule definition can stay. If the rule is used in --include, --exclude or --configure warning will be printed:
Rule W1102 deprecated is deprecated. Remove it from your configuration.
Deprecated rules can be now listed with DEPRECATED filter:
robocop --list DEPRECATED
When defining a rule it was possible to define Robot Framework version for which rule was enabled. Is is now also possible to define range of versions using ; as separator:
rules = {
"1105": Rule(
rule_id="1105",
name="range-5-and-6",
msg="Rule that is only enabled for RF version higher than 5 and lower or equal to 6",
severity=RuleSeverity.INFO,
version=">5;<=6",
),
}
Robocop supported two type of checkers: VisitorChecker and RawFileChecker. We have added new type of checker - ProjectChecker. It extends the VisitorChecker but contains special scan_project method, that can be overriden, which is called at the end of Robocop run. Typical usage of this checker would be collecting information about our project using visitors and then performing checks and report issues in scan_project method. Example custom rule with ProjectChecker:
from typing import List
from robocop.checkers import ProjectChecker
from robocop.rules import Message, Rule, RuleSeverity
rules = {
"9901": Rule(
rule_id="9901",
name="test-total-count",
msg="There is total of {{ tests_count }} tests in the project.",
severity=RuleSeverity.INFO,
),
}
class MyProjectChecker(ProjectChecker):
"""Checker for total tests count."""
reports = ("test-total-count",)
def __init__(self):
self.test_count = 0
super().__init__()
def visit_TestCase(self, node): # noqa: N802
self.test_count += 1
def scan_project(self) -> List[Message]:
# self.report is append issues to self.issues -> clearing it at the start of scan_project
self.issues = []
# Default issue format print file path with the issue - in this case we replace it with our custom string
self.report("test-total-count", source="Project-name", tests_count=self.test_count)
return self.issues
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Fixes for Robot Framework 7.0 critical issues and Python 3.12 support.
Fixes for Robot Framework 7.0 critical issues and Python 3.12 support.
Read more in full release notes.
Fixes for Robot Framework 7.0 critical issues and Python 3.12 support.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.2.2
Inline If with assign variables handling variables in invalid order (#987)
Robot Framework 7.0 backward incompatible changes: VariableIterator refactor (#991)
Robot Framework 7.0 backward incompatible changes: empty-library-alias and WITH NAME
Robot Framework 7.0 backward incompatible changes: Deprecation warnings in Robocop output (#993)
Python 3.12 support: invalid escape sequence warnings (#1003)
"Inline If" did not properly recognize that variables were used inside "if statement" before assigning return value. Following code:
*** Keywords ***
Keyword With Argument
[Arguments] ${arg}
${arg} IF ${VALUE} Use ${arg}
Keyword With Local Variable
${var} Set Variable default value
${var} IF ${VALUE} Use ${var}
Will no longer raise W0921 argument-overwritten-before-usage and W0922 variable-overwritten-before-usage.
And following code:
*** Keywords ***
Inline If - Overwritten Variable
${var} Set Variable default
${var} IF condition Use ${var}
InlineIf - Assign With The Same Name As Arg
${assign} IF condition Do Nothing ELSE Use ${assign}
Should now raise I0920 unused-variable for ${var} and ${assign} variables.
Robocop variables handling relied upon VariableIterator class imported from Robot Framework package. It caused ImportError which should be now fixed.
Rule E0314 empty-library-alias should now work with Robot Framework 7.0 and WITH NAME keyword.
Several rules started to issue additional deprecation warnings such as 'For.variables' is deprecated and will be removed in Robot Framework 8.0. Use 'For.assign' instead. Those warnings were for Robocop code only and should not appear anymore.
SyntaxWarning: invalid escape sequence 'S' warnings should not appear anymore when importing Robocop with Python 3.12.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Read more in full release notes.
Fixes to variable rules.
Read more in full release notes.
Fixes to variable rules.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.2.1
String literals will no longer be detected as variables by variables rules such as W0919 unused-argument or I0920 unused-variable:
Used In String Literal
[Arguments] ${used} ${unused}
Log ${used} unused # unused is just a string, not a variable
The variable rules (such as W0919 unused-argument or I0920 unused-variable) were not aware of the recursive nature of the loops. For example if variable was used before it was declared in the loop (original value could originate from global variable), it was marked as unused. Following code should not report unused variables anymore:
Loop With Global Count
FOR ${item} IN @{LIST}
Set To Dictionary ${item} displayOrder=${count}
${count} Evaluate ${count} + 1
END
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
It's truly a bug season! Thankfully we managed to catch and properly discipline most of the bugs - the old crickets and freshly hatched flies. Togethe
It's truly a bug season! Thankfully we managed to catch and properly discipline most of the bugs - the old crickets
and freshly hatched flies. Together with 12 fixed bugs we also made Robocop disabler more consistent with Robocop
and added --ignore-git-dir option for handling configuration in multi repos.
Read more in full release notes.
It's truly a bug season! Thankfully we managed to catch and properly discipline most of the bugs - the old crickets and freshly hatched flies. Together with 12 fixed bugs we also made Robocop disabler more consistent with Robocop and added --ignore-git-dir option for handling configuration in multi repos.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.2.0
${_} should be ignored by duplicated-assigned-var-name (#954)
variable-overwritten-before-usage should not be raised if overridden in an IF block (#950)
unnecessary-string-conversion should not be raised for environment variables (#952)
inline-if-can-be-used should not suggest using invalid syntax (#951)
not-capitalized-test-case-title should ignore non letters (#948)
if-can-be-used and deprecated-statement double reporting on Run Keyword Unless (#945)
duplicated-assigned-var-name now allows to use ${_} as replacement for duplicated assignments:
${_} ${middle} ${_} Unpack Variable ${variable}
duplicated-assigned-var-name is now parsing assignment sign (=) correctly:
${duplicate} ${duplicate}= Set Variables
robot:recursive-stop-on-failure was missing from W0603 tag-with-reserved-word rule.
W0922 variable-overwritten-before-usage warns if the variable was overwritten before first use. It should now ignore cases where the variable was initiated and then conditionally overriden in a IF block:
Conditionally Overriden Variable
${output} Set Variable default_value
IF os.path.isdir("/special_dir")
${output} Set Variable special_value # it will not be reported from now on
END
RETURN ${output}
Such cases could be also handled better by using IF with ELSE branch or Set Variable If. However, in more complicated case this rule produced lot of additional unnecessary reports and this fix should help with it.
I0923 unnecessary-string-conversion was raised for all types of variables including environment variables (%{ENV_VAR}). Such variables are always strings and there is no unnecessary string conversion. For that reason this rule will now ignore environment variables.
I0916 inline-if-can-be-used recommended to convert short IF to inline IF even if it was not possible without adding additional code. See example:
*** Keywords ***
Set Variable On Flag Value
[Arguments] ${flag}
# ${var} value will be set to `1` only if ${flag} is True
IF $flag
${var} Set Variable 1
END
# ${var} will be `1` if ${flag} is True and `None` otherwise - which may be unexpected
${var} IF $flag Set Variable 1
# previous example 'fixed' to work the same as IF block
${var} IF $flag Set Variable 1 ELSE Set Variable ${var}
Because of that inline-if-can-be-used will no longer recommend to convert IF blocks with assignments to Inline IF.
W0308 not-capitalized-test-case-title was also reporting if the test case started with character other than letter:
15 - Test case with test identifier
Prepare
Run
Assert
It should now properly check if first letter found in the test case name (ignoring other characters) is capitalized.
Fixed typos in file_stats report output with compare_runs enabled.
I0908 if-can-be-used was introduced in Robot Framework 4.0 to suggest replacing Run Keyword If and Run Keyword Unless keywords by IF. Since Robot Framework 5.0 W0319 deprecated-statement started to warn on the use of those keywords. Because of that there were 2 issues reported starting from Robot Framework 5.0.
if-can-be-used was updated to only report for Robot Framework 4.0 code. Starting from RF version 5.0 only deprecated-statement will be reported.
Fixes related to Python 3.12 support:
escaped variables and special variable syntax (such as $variable) should now work with Python 3.12 and variable rules like unused-variable or unused-argument
Robocop should not print code warnings from not properly escaped docstrings anymore
Arguments and variables could be reported as unused with W0919 unused-argument or I0920 unused-variable if they were used with attribute access:
*** Keywords ***
Use Item With Attribute
${item} Prepare Item
Log ${item.x}
Update Item With Attribute
${item} Get Item
${item.x} Set Variable abc # overwriting attribute should also count as using the variable
Use Item With Method
${string} Set Variable string
${lower_string} Set Variable ${string.lower()}
Log ${lower_string}
It should now be fixed. However our variable with attributes handling will be soon refactored to avoid similar cases in the future - please report any false positive errors you may encounter.
If the loop variable originated from the keyword arguments, it was not marked as used:
*** Keywords ***
Unused Variable Rule Validation
[Documentation] doc
[Arguments] ${counter}
WHILE ${counter} < 10
Log To Console ${counter}
${counter} Evaluate ${counter} + 1
END
Disabling the line from the linting can be done using disabler comment:
# robocop:disable=rule_name
Robotidy also supports disablers but using different keywords:
# robotidy:off
We have decided to make it more consistent and use on and off markers (mimicking [Robotidy tool](https://github.com/MarketSquare/robotframework-tidy)) instead of enable and disable. Both types of the markers are supported but on and off are now recommended.
When searching for the default configuration file, Robocop stop searching if .git directory is found. It is now possible to disable this behaviour using --ignore-git-dir flag.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Fixes to links generated by Robocop after recent documentation refactor.
Fixes to links generated by Robocop after recent documentation refactor.
Read more in full release notes.
Fixes to links generated by Robocop after recent documentation refactor.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.1.1
Fixed links to our rules after recent documentation refactor:
issues_to_lsp_diagnostic API method should now point to rules_list.html instead of rules.html
SARIF reports should now point to rules_list.html instead of rules.html
rule description now points to valid url
Also, the SARIF reports will now contain explicit Robocop version in the rules url to decrease number of backward incompatibility issues when using reports from previous versions.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
This release fixes issues with if-can-be-used, variable-overwritten-before-usage and argument-overwritten-before-usage rules. Also, rule severity thre
This release fixes issues with if-can-be-used, variable-overwritten-before-usage and argument-overwritten-before-usage rules. Also, rule severity threshold now properly respects threshold filter.
Read more in full release notes.
This release fixes issues with if-can-be-used, variable-overwritten-before-usage and argument-overwritten-before-usage rules. Also, rule severity threshold now properly respects threshold filter.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.1.0
Our external documentation (https://robocop.readthedocs.io/) got a makeover that hugely improves navigating and readability of the documentation. It now has a better structure, proper formatting, more clear sentences, some new articles describing how Robocop works, rewritten rules explanation and emojis!
I0908 if-can-be-used was incorrectly enabled only for Robot Framework 4.*. It should now work for all >=4 versions.
Robocop no longer reports a problem when loading the external rules from a directory that also contains non-Python files.
variable-overwritten-before-usage will no longer be raised if the same variable names are used in different branches of the TRY/EXCEPT block:
*** Test Cases ***
Example Test
TRY
${value} Possibly Failing Keyword
EXCEPT
${value} Set Variable Keyword failed # each TRY/EXCEPT/ELSE/FINALLY branch is now separate scope
END
Log To Console ${value}
Rule that uses configured severity threshold (which can dynamically set rule severity) will no longer be filtered out by global threshold -t/--threshold if rule default severity is lower than configured threshold.
For example, given rule file-too-long which has default Warning severity and following configuration:
robocop -c file-too-long:severity_threshold:warning=600:error=700 -t E .
If file has more than 700 lines it should be reported as Error and not be filtered out by --threshold.
argument-overwritten-before-usage should now clear arguments after keyword definition and it will not be raised on the next test case using the same variable names.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
This release fixes the issue with handling different assignment signs in possible-variable-overwriting rule.
This release fixes the issue with handling different assignment signs in possible-variable-overwriting rule.
Read more in full release notes.
This release fixes the issue with possible-variable-overwriting rule.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.0.1
Variables using assignments signs were not parsed correctly and raised false positive I0316 possible-variable-overwriting.
For example, following code will not be reported by Robocop with the fixed version:
*** Test Cases ***
Test
[Documentation] doc
${v} = No Operation
Log ${v}
${v} = No Operation
Log ${v}
Also, possible-variable-overwriting now supports item assignments introduced in Robot Framework 6.1.
Thanks to @KotlinIsland for bug reports that helped improve our tool!
This release brings a handful of long-awaited features requested by our users and a few improvements we were keeping in our heads for some time.
This release brings a handful of long-awaited features requested by our users and a few improvements we were keeping in our heads for some time.
Besides the 9 new rules, Robocop is now able to compare results between runs and see the difference in the report.
Moreover, the disablers are now smarter and they become context-aware, meaning that they disable the rules in the whole related code block.
Another improvement is the severity thresholds for the rules, which are now dynamically referenced in the rule messages.
We also added a possibility to create rules that are disabled by default, and this is a first step we made towards Community Rules, which is a huge feature we are working on, and we plan to add it in the next major release.
The results from the Robocop execution can also be exported to a JSON file with our new json_report.
Another updates are:
Backward-incompatible changes relate to rule severity thresholds and rule disablers (described below in details).
Read more in full release notes.
This release brings a handful of long-awaited features requested by our users and a few improvements we were keeping in our heads for some time.
Besides the 9 new rules, Robocop is now able to compare results between runs and see the difference in the report.
Moreover, the disablers are now smarter and they become context-aware, meaning that they disable the rules in the whole related code block.
Another improvement is the severity thresholds for the rules, which are now dynamically referenced in the rule messages.
We also added a possibility to create rules that are disabled by default, and this is a first step we made towards Community Rules, which is a huge feature we are working on, and we plan to add it in the next major release.
The results from the Robocop execution can also be exported to a JSON file with our new json_report.
Another updates are:
a new way of importing custom rules thanks to refactored mechanism of importing rules and checkers
better readability and formatting of the documentation
internal refactor of the reports to make it easier to maintain and extend they functionality
Backward-incompatible changes relate to rule severity thresholds and rule disablers (described below in details).
Sit down, grab a popcorn 🍿, relax and enjoy our release notes!
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==4.0.0
New rule for detecting not supported settings in resource files (#827)
New rule that suggests using task- or test-related settings for corresponding sections (#522)
New rule for discovering unsupported setting in initialization file (#498)
New rule for unnecessary string conversion in evaluated conditions (#442)
According to the official RF User Guide:
"Setting section in resource files can contain only import settings (Library, Resource, Variables) and Documentation. The Variable section and Keyword section are used exactly the same way as in test case files."
New E0416 invalid-setting-in-resource rule detects unsupported settings in the resource files.
If the file contains *** Task *** section, it is recommended to use 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.
A new rule W0326 mixed-task-test-settings is introduced to cover these cases.
There are 3 new rules added to support new (in RF 6.0) Keyword Tags.
empty-keyword-tags rule (W0531) checks for the situation where Keyword Tags in *** Settings *** section does not have any value provided:
*** Settings *** Keyword Tags
could-be-keyword-tags rule (I0610) checks if all keywords in a file share the same tag. In that case, it can be simply added to Keyword Tags setting, which the rule suggests.
tag-already-set-in-keyword-tags rule (I0611) detects a situation where all keywords share the same tag which is already added to the Keyword Tags setting. In such case, the tags in keywords may be removed.
According to RF User Guide, Default Tags and Test Template settings are not allowed in suite initialization files, and this is covered by a new unsupported-setting-in-init-file rule (E0417).
Unnecessary string conversion is now detected and I0923 unnecessary-string-conversion is raised. Following code:
WHILE "${status}" == "200"
${status} Get Health Status ${service_name}
END
Can be rewritten to:
WHILE $status == 200
${status} Get Health Status ${service_name}
END
Added new rule I0924 expression-can-be-simplified that checks if the evaluated condition can be simplified. For example:
IF ${session_created} == ${FALSE} Create Session
Skip If ${rows} == []
Can be rewritten to:
IF not ${session_created} Create Session
Skip If not ${rows}
Added new rule I0925 misplaced-negative-condition that checks if the evaluated condition contains not operator that can be moved 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
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
END
Robot Framework 6.1 makes it possible to assign return values from keywords to list and dictionary items ( User Guide , in Assigning variables with item values section):
*** Keywords ***
Item Assignments
${list}[0] = Keyword
${dict}[key] = Keyword
${result}[users][0] = Keyword
It should be now properly handled by unused-variable, variable-overwritten-before-usage, hyphen-in-variable-name and inconsistent-assignment rules.
We have implemented a way to compare reports output with the previous run. It's done thanks to special, non-default report compare_runs. You need to first run Robocop with a --persistent flag to save the results of the current run, and then run it with the compare_runs report (and other chosen reports) to see the differences between the runs:
robocop --persistent . robocop --reports rules_by_error_type,rules_by_id,compare_runs .
Example output:
Found 18 (-3) issues: 13 (-4) INFOs, 5 (+1) WARNINGs. Issues by ID: I0923 (unnecessary-string-conversion) : 10 (+0) W0922 (variable-overwritten-before-usage) : 2 (+1) I0920 (unused-variable) : 2 (-4) W0301 (not-allowed-char-in-name) : 2 (+0) W0324 (overwriting-reserved-variable) : 1 (+0) I0605 (could-be-test-tags) : 1 (+0)
Added new json_report report that produces file with issues in JSON format. It's a non-default report which needs to be called explicitly by name (it will not be loaded with --reports all):
robocop --reports json_report .
It will save the results to a JSON file in the current working directory under robocop_output.json filename. Output directory and filename can be configured with:
robocop --configure json_report:output_dir:output --configure json_report:report_filename:issues.json --reports json_report .
Note
json_report was created from the old, internal-only report with the same name. The previous report is renamed to internal_json_report. If you are using Robocop programmatically and you were using json_report, rename it to internal_json_report.
Complete refactor of how Robocop imports rules and checkers internally. Our import mechanism is now more uniform. Additionally, it is now possible to load external rules from the modules imported inside Python file.
Let's assume we have the following code with loading external rules:
import custom_rules.naming import custom_rules.errors from custom_rules.lengths import rules, CustomChecker
before the change, only CustomChecker would be loaded by Robocop, while the content of the custom_rules.naming and custom_rules.errors would be ignored. Now, such imports will be parsed and external Robocop rules defined inside them will be loaded as well.
Disablers module was rewritten in Robocop in order to improve how rule disablers are handled. Previously, disablers were parsed as lines only and were not aware of the Robot Framework code.
For example, with the following code:
*** Keywords ***
Read Data From Database
[Arguments] ${query}
# robocop: disable=missing-doc-keyword
Connect To Database ${CONNECTION_STRING}
Query Database ${query}
RETURN ${query}
Validate Data Is Not Empty
[Arguments] ${data}
Should Be True len(${data}) != 0
# robocop: disable=missing-doc-keyword disabler is called in Read Data From Database. In the old implementation such disabler would ignore all matching rules till it was enabled again or end of the file is met. Now, the disabler is aware of the context where it was called, and it will be enabled again at the end of the keyword. The disablers support also other code blocks, such as test cases, "for" and "while" loops and "if" statements.
Our internal reports structure was refactored to make it easier to maintain and develop it in the future. Now, each report is stored in a separate file in Robocop project. From the user's perspective, reports should work the same as before.
Previously, all defined rules were enabled by default and could be disabled using --exclude option (or by using --include if not listed with the option). It is now possible to create a rule disabled by default using new parameter, enabled:
rules = {
"1155": Rule(
rule_id="1155",
name="custom-rule",
msg="Custom rule message",
severity=RuleSeverity.INFO,
enabled=False,
docs="""
Custom rule description.
""",
)
}
Such rules can be enabled when called explicitly with --include option:
robocop --include custom-rule .
Or by configuring enabled parameter directly:
robocop --ext-rules custom_rules.py -c custom-rule:enabled:True .
Rule severity threshold allows to change rule severity depending on the threshold value and configured severities. In fact, it was confusing to see the reports for the same rule with different severities but the same limit value. We changed this behavior to log the actual value that met the severity threshold.
As for example, you can configure too-many-calls-in-test-case to report warning on 10 keywords and error on 30 keywords. With such configuration you will get following reports:
test.robot:33:1 [W] 0505 Test case 'Test case 1' has too many keywords inside (24/10) (too-many-calls-in-test-case) test.robot:62:1 [E] 0505 Test case 'Test case 2' has too many keywords inside (30/30) (too-many-calls-in-test-case)
Previously, if the rule severity threshold was configured but the rule value didn't met any conditions it was reported with default severity. Now if the value don't pass any configured severity threshold, the issue is ignored.
For example, let's assume that line-too-long (with default severity W) is configured to have severity E when the number of the lines is higher than 150:
robocop -c line-too-long:severity_threshold:error=150
With above configuration, line-too-long will only be reported if number of the lines is higher than 150. The rule will display the WARNING message only if it is explicitly configured:
robocop -c line-too-long:severity_threshold:warning=120:error=150
which is how it used to work before this release - the thresholds were added to the default ones, and now they are overwritten.
Note
If your configuration contains any changes to the rule severity threshold, make sure to update it after bumping the Robocop version to 3.3.0+, otherwise it may provide results other than expected.
Our documentation has improved with better formatting of the rules. They now have a better structure and feature a syntax highlighting for all examples. There's also a copy button now next to the code snippets.
We plan to improve the examples with the ones that are inspired by the real-world examples soon.
Thanks to Jyrki (@jyrlindr) and Sayed (@sayedtenkanen) for bug reports and feature requests that helped improve our tool!
This release fixes the issues with new variable rules.
This release fixes the issues with new variable rules.
Read more in full release notes.
This release fixes the issues with new variable rules.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==3.2.1
Following code should not report not used variable anymore:
Keyword
${counter} Set Variable 1
WHILE ${counter} < 10
Log To Console ${counter}
${counter} Evaluate ${counter} + 1 # used in loop
END
Following code should not report not used variable anymore:
Simple Operations
${sum} Calculate ${random}
${var} Set Variable ${sum%11}
${var} Set Variable ${sum + 11}
${var} Set Variable ${sum - 11}
${var} Set Variable ${sum * 11}
Log ${var}
Previously, the comments between sections were ignored and each empty line was counted towards the 2 space requirement. That means that this code:
* Variables * ${VAR} value
# Comment
* Test Cases * Some Test Case No Operation
reported no issue, because of 2 empty lines between sections.
When one empty lines was added before the Test Cases section, it was considered a violation, while it still looked fine. We decided to simplify the rule, and now it only counts empty lines after the last piece of text in the section, comments included.
Thanks to Emile for bug reports that helped improve our tool!
This release brings several new variable related rules! We have also fixed several issues that appeared after Robot Framework 6.1 release.
This release brings several new variable related rules! We have also fixed several issues that appeared after Robot Framework 6.1 release.
Read more in full release notes.
This release brings several new variable related rules! We have also fixed several issues that appeared after Robot Framework 6.1 release.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==3.2.0
Added new rule W0919 unused-argument for detecting not used keyword arguments. For example:
*** Keywords ***
Keyword
[Arguments] ${used} ${not_used}
Log ${used}
IF $used
Log Escaped syntax is supported.
END
Keyword with ${embedded} and ${not_used} # will report ${not_used}
Log ${embedded}
Added new rule I0920 unused-variable for detecting not used variables. For example:
*** Keywords ***
Keyword
${var} ${var2} Calculate Cutoff # ${var2} is not used
Log ${var}
Added new rules W0921 argument-overwritten-before-usage and W0922 variable-overwritten-before-usage for arguments or variables overwritten before first use:
*** Keywords ***
Overwritten Argument
[Arguments] ${overwritten} # we do not call ${overwritten} value at all
${overwritten} Set Variable value # we only overwrite it
Overwritten Variable
${var1} ${var2} Assign Variables
Log ${var2} # this variable is used
${var1} Overwrite Variable # this one is only overwritten
Added new rule W0323 inconsistent-variable-name which reports variables with inconsistent naming. Since Robot Framework ignore underscores and spaces in variable names, and also normalizes them to lowercase, this code should report new rule violations:
*** Keywords ***
Inconsistent variables
${variable} Keyword
Keyword ${variablE} # matches ${variable} but is not consistent
IF ${var_iable} < 10 # matches ${variable} but is not consistent
Log ${varia ble} # matches ${variable} but is not consistent
END
Added new rule W0324 overwriting-reserved-variable which reports overwriting reserved Robot Framework variables. There are variables used by Robot Framework itself which should not be overwritten. See the list at Robot Framework User Guide.
Added new rule E0325 invalid-section. It reports any unrecognized sections, for example if you are using translated headers but did not configure the language.
The I0316 possible-variable-overwriting now detects issues in IF assignments, embedded variables and variable with default values.
Several rules stopped working after Robot Framework 6.1 release. Following rules should now work:
E0401 parsing-error
E0403 missing-keyword-name
E0414 return-in-test-case
E0415 invalid-section-in-resource
W1003 empty-lines-between-sections rule should now work with empty sections
W0511 empty-metadata
E0915 statement-outside-loop
Previously, Robocop only supported TOML configuration file by loading it automatically if pyproject.toml file existed in the root directory. Now, it is possible to load it from any path using --config option:
robocop --config path/to/config_file.toml
List reports command (--list-reports) previously only listed enabled reports. Now, the option lists all reports together with their enabled/disabled status. Also, internal reports are now omitted:
> robocop --list-reports Available reports: file_stats - Prints overall statistics about number of processed files (disabled) rules_by_error_type - Prints total number of issues grouped by severity (disabled) rules_by_id - Groups detected issues by rule id and prints it ordered by most common (disabled) sarif - Generate SARIF output file (disabled - non-default) scan_timer - Returns Robocop execution time (disabled) timestamp - Returns Robocop execution timestamp. (disabled) version - Returns Robocop version (disabled) Enable report by passing its name using ``--reports`` option. Use ``all`` to enable all default reports. Non-default reports (like ``sarif``) can be only enabled using their name explicitly.
Same as --list rules option, --list-reports now supports optional ENABLED / DISABLED argument to filter out reports by their status:
> robocop --reports version --list-reports ENABLED Available reports: version - Returns Robocop version (enabled) > robocop --reports all --list-reports DISABLED Available reports: sarif - Generate SARIF output file (disabled - non-default)
Fix issues with variable naming rules causing Robocop to crash on escaped or invalid variable definition.
Fix issues with variable naming rules causing Robocop to crash on escaped or invalid variable definition.
Read more in full release notes.
Fix issues with variable naming rules causing Robocop to crash on escaped or invalid variable definition.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==3.1.1
The escaped variables syntax like $escaped or \${escaped caused fatal exception with variable naming rules.
The invalid variable syntax caused fatal exception with section-variable-not-uppercase rule. Now following code should work with Robocop:
*** Variables ***
${not closed
Note that this code is not valid and Robocop raises parsing-error for this. This fix only addressed issue with crashing when parsing such code.
Thanks to @Loch64 for bug reports that helped improve our tool!
This release also contains fixes for W1015 misaligned-continuation-row rule, deprecating warning not appearing for rules from --configure option. Also…
Several new rules for detecting unreachable code, multiline IFs, empty templates and invalid sections in resource file.
The variable naming rules (W0310 non-local-variables-should-be-uppercase and W0309
section-variable-not-uppercase) were also updated to support nested variables.
This release also contains fixes for W1015 misaligned-continuation-row rule, deprecating warning not appearing for
rules from --configure option. Also, the W0704 ignored-data rule provides better support for language headers.
Read more in full release notes.
Several new rules for detecting unreachable code, multiline IFs, empty templates and invalid sections in resource file. The variable naming rules (W0310 non-local-variables-should-be-uppercase and W0309 section-variable-not-uppercase) were also updated to support nested variables.
This release also contains fixes for W1015 misaligned-continuation-row rule, deprecating warning not appearing for rules from --configure option. Also, the W0704 ignored-data rule provides better support for language headers.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==3.1.0
Rules W0310 non-local-variables-should-be-uppercase and W0309 section-variable-not-uppercase were previously reporting when the variable had another nested variable with lowercase name, e.g. ${EXAMPLE_${lowercase}}. Now, the nested variable names passed as an argument to one of the keywords Set Test Variable, Set Suite Variable or Set Global Variable are ignored and if the rest of the name is uppercase, the rules will not report the issue anymore. For variables in Variables section, the name still needs to be all uppercase (including nested variable), because all nested variables in this section need to be global anyway.
Added new rule W0917 unreachable-code for detecting if there is a code after RETURN, BREAK or CONTINUE statements, on the same scope level.
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
Also, old W0901 keyword-after-return rule no longer detects RETURN statements, only the keywords after Return From Keyword and when there is code after [Return].
New W0918 multiline-inline-if rule that detects when inline IF is split into multiple lines. It's allowed, but it should be avoided, since it decreases readability. It recommends to use normal IF/ELSE instead.
New E0415 invalid-section-in-resource rule that reports invalid section used in the resource file. Resource file cannot contain *** Test Cases *** or *** Tasks *** sections.
Added new W0530 empty-template rule that reports [Template] setting without value. There is also new E0529 empty-test-template that reports empty Test Template.
Fixed a case (#821) where rule W1015 misaligned-continuation-row was failing due to the continuation of the keyword starting with a comment at the beginning of the line:
*** Test Cases ***
Robocop Crash Example
Run Keywords
... Log Message 1 AND
# ... Log Message 2 AND
... Log Message 3
Another bug (#818) was reported for the case when there was a properly indented comment in between the statements, like this:
*** Test Cases ***
My Keyword
${arf} Create List 1 2 3
# ... 4
... 5
Which cause the rule to be incorrectly reported in the last line of the example above even though it's aligned properly. It is now fixed and the rule does not report in such case.
When a deprecated rule was configured using a --configure CLI option, the deprecation warning was not displayed. This is now fixed, and the warning appears for all rules explicitly configured, included or excluded through a command line options.
Language headers at the beginning of the file (Language: de) were reported by ignored-data rule if they were not lowercase. Now the rule properly recognizes all language headers.
Thanks to @hrsc-viessmann and @MoreFamed for bug reports that helped improve our tool!
This version hugely improves the experience of using Robocop within the IDEs by fixing the locations of rule violations in code, which in turn results
This version hugely improves the experience of using Robocop within the IDEs by fixing the locations of rule violations in code, which in turn results in correct underlining of the issues. Try it out and let us know what you think!
There are backward-incompatible changes to the W1008 bad-indent rule
and its parameters (described in details in the release notes).
This release also drops the support for Python 3.6, and the minimum required version now is Python 3.7+.
Read more in full release notes.
This version of Robocop hugely improves the experience of using Robocop within the IDEs by fixing the locations of rule violations in code, which in turn results in correct underlining of the issues.
There are backward-incompatible changes to the W1008 bad-indent rule and its parameters (described below in details).
This release also drops the support for Python 3.6, and the minimum required version now is Python 3.7+.
Additionally, we bumped the versions of the dependencies up.
You can install the latest available version by running
pip install --upgrade robotframework-robocop
or to install exactly this version
pip install robotframework-robocop==3.0.0
The main improvement focused around adjusting the locations where the rules are violated in the code. More specifically, it improves where the rule violation starts and ends, meaning that the precise position is now defined correctly. Thanks to that, the LSP will correctly pass that information to the IDE you're using and will underline every place that needs your attention.
Changes to the locations of the issues may affect the locally used disablers, and in result may require doing reviewing them and updating. That's why we decided to release new major version.
Python 3.6 is not supported anymore since Dec 23, 2021, it's been already quite a long time we kept it supported for Robocop. Due to that, we could not benefit from the features of newer versions of Python and it started becoming undesired. Also, taking security risk seriously, we need to be mindful about possible vulnerabilities in our software that are out of our control, and that may affect us if we use outdated dependencies.
From Robocop 3.0.0 we are dropping the support for Python 3.6, and we plan to also drop Python 3.7 in the near future, since the scheduled security support for this version ends on Jun 27, 2023.
Right now, minimum required version for Robocop is Python 3.7+.
There is a new ignore_docs parameter added to 1015 misaligned-continuation-row rule set to True by default, which means that any violation of this rule within the Documentation will be ignored. If you want to detect the violations in the Documentation setting or section, configure this rule with -c 1015:ignore_docs:False.
Old bad-indent rule has been split into two:
The old one W1008 bad-indent stays, but it will only detect under- or over-indented code. The ignore_uneven and strict are no longer available, but indent parameter remains the same, with a new default value of -1, which makes it being ignored by default.
Using bad-indent rule now prints a deprecation warning in the console that suggests to replace old parameters with new E1017 rule. The parameters are still accepted, but they no longer control the behavior of W1008 rule. The warning will disappear in the next major release.
The new rule is described below.
The new E1017 bad-block-indent rule that detects invalid indentation inside code block like FOR loops or TRY-EXCEPT statements.
The rule now reports only when the line is under- or over-indented.
There was a bug (#793) that prevented the severity of the old bad-indent rule from being configured. It is fixed now.
From now on, bad-indent also properly supports data-driven tests in templated suites. If you encounter any issues, please report them back to us.
A couple of new GitHub Actions have been added to our GitHub CI. New Black action now scans Robocop code to ensure code quality. There is also new pre-commit job and additional unit tests.
The bug report template is now extended to make it easier for the users to report bugs and for us to reproduce them.
There were some compatibility issues due to outdated packages. Now, all of them are updated.
packaging dependency brings a lot of other dependencies and often causes compatibility issues for us. We only used it for its versioning module for deciding if the Robocop rule should be enabled for given Robot Framework version. That's why we have decided to remove the dependency and rewrite version handling in the Robocop.
Thanks to the whole community for submitting bug reports and feature requests. Without you, Robocop wouldn't be in the place where it is now. All the feedback is essential to drive the tool towards higher quality and better user experience.
If you want to help us more, consider contributing to the project directly. We can offer our constant support to make the work fun and effective. We do our best to create a supportive and welcoming environment for everyone. Feel free to ping us on our official #robocop-linter Slack channel anytime.
Recent update to configuration argument files in Robocop 2.8.0 introduced a bug where option values were appended by a path to the argument file direc
Recent update to configuration argument files in Robocop 2.8.0 introduced a bug where option values were appended by a path to the argument file directory. It should be fixed with this release.
Read more in full release notes.
Recent update to configuration argument files introduces a bug where option values were appended by a path to the argument file directory. It should be fixed with this release.
You can install the latest available version by running:
pip install --upgrade robotframework-robocop
or to install exactly this version:
pip install robotframework-robocop==2.8.1
New release with addition of nested argument configuration files, --list option with filtering by enabled/disabled rule status and new rule missing-do
New release with addition of nested argument configuration files, --list option with filtering by enabled/disabled rule status and new rule missing-doc-resource-file.
Read more in full release notes.
You can install the latest available version by running:
pip install --upgrade robotframework-robocop
or to install exactly this version:
pip install robotframework-robocop==2.8.0
New W0204 missing-doc-resource-file rule that checks if documentation is missing in a resource file. (#776)
Nesting argument files was not allowed before. Now it is possible to import other argument file in the argument file:
--include some-rule --argumentfile base_argument_file.txt
Argument files now support relative paths. The support was added for the pyproject.toml files before but it was missing from the argument files.
It means that argument file can have paths relative to the argument file location:
content of config/argumentfile.txt: --output robocop_output.txt # it will now refer to config/robocop_output.txt --ext-rules robocop/rules.py # it will now refer to config/robocop/rules.py
Robocop can list all rules with --list option (or --list-configurables to only list rules that can be configured). Our every growing list of rules made the output of this command hard to read. That's why it is now possible to filter rules with ENABLED or DISABLED special patterns:
robocop --list ENABLED robocop -i *doc* -i line-too-long --list ENABLED robocop --exclude empty-lines-between-test-cases --list DISABLED robocop --list-configurables ENABLED
The new feature still coexist with existing feature that allows to filter list output using pattern:
robocop --list *line*
However ENABLED/DISABLED patterns are more useful when you want to list only the rules that are enabled using your configuration.
Robot Framework 6.0 introduces some minor changes that affected our rules:
not supported settings uses different error message in Robot Framework now. That's why setting-not-supported failed to catch those errors and they were reported as parsing-error instead
Task header now uses distinct token type internally. This causes Robocop to not recognize both-tests-and-tasks issues
Nothing published for this version
Fixes and improvements to the robocop file configuration, language header support and pre-commit configuration file.
Fixes and improvements to the robocop file configuration, language header support and pre-commit configuration file.
Read more in full release notes.
You can install the latest available version by running:
pip install --upgrade robotframework-robocop
or to install exactly this version:
pip install robotframework-robocop==2.7.0
We addressed several smaller issues and incoherence with Robocop file configuration.
When you're using Robocop from the command line it reads both the cli arguments and default configuration file (found in the disk). The default configuration file (either .robocop or pyproject.toml file) is used as a base that can be overridden by the cli arguments. The problem with the previous implementation was that when user specified path to argument file in the cli:
robocop --argumentfile myconfig.txt
Robocop would read both default configuration file and configuration file from --argumentfile. Now it will read default configuration file only if -A / --argumentfile options are not used.
Robot Framework 6.0 allows to set source language using language headers at the beginning of the file:
language: de *** Einstellungen ***
Following changes focus on improving support for the language header.
Also, ignored-data rule now properly ignores language header if it's in the first line of the file.
Starting from this release it is possible to use Robocop in precommit using Robocop version instead of the repository url:
repos:
- repo: https://github.com/MarketSquare/robotframework-robocop
rev: 2.7.0
hooks:
- id: robocop
name: robocop
This release focuses on better support for Robot Framework 6.0 and improvements to our documentation and spacing rules.
This release focuses on better support for Robot Framework 6.0 and improvements to our documentation and spacing rules.
Several other changes are listed in full release notes.
This release focuses on better support for Robot Framework 6.0 and improvements to our documentation and spacing rules.
You can install the latest available version by running:
pip install --upgrade robotframework-robocop
or to install exactly this version:
pip install robotframework-robocop==2.6.0
Robot Framework 6.0 starts deprecating the singular header forms (such as *** Setting *** or *** Test Case ***). Such headers will raise deprecation warning and eventually will not be supported in the future Robot Framework versions. deprecated-singular-header warns you if you use singular header form.
We completely redesigned our indentation rules. Due to this the uneven-indent was merged into bad-indent (configuration using uneven-indent will print deprecation message and use bad-indent instead) (#504).
bad-indent rule now covers uneven indent (which will result in the warning message) or invalid indent (resulting in the error message). It is now also possible to use strict (default False) mode to enforce indentation to be the multiple of indent space (default 4).
The Force Tags setting has been renamed to Test Tags. To support this change, Robocop renamed could-be-forced-tags rule to could-be-test-tags and tag-already-set-in-force-tags to tag-already-set-in-test-tags. Usage of Force Tags will result in deprecation warning from deprecated-statement rule.
Robot Framework 6.0 also added Keyword Tags which is supported by Robocop with this release (#641).
Our test framework now supports custom format of the issue - which should help with enhancing the precision of the reported issues. For now, the invalid-argument rule has improved precision (properly reporting the beginning and the end of the rule) but expect more in the upcoming releases!
improved the documentation generation for rules parameters. It will now show more user-friendly types (such as "bool") instead of name of the parser method (#732).
do not use rule message as the first line in our documentation if the rule message is only templated variable (#733)
updated sarif config example to use colon delimiters (#747)
unrecognized header is now only reported by parsing-error and not by duplicated-setting (#683)
empty lines and standalone comments are now not counted towards keyword/test length in too-long-test-case and too-long-keyword rules (#671)
comments in the last line of the last keyword / test in the file will not be reported with uneven-indent rule if their indent is correct (#675)
external rules documentation should now display templated rule messages properly (#745)
deprecated-statement should now work for RF 6.0+
we normalized keyword-name-is-reserved-word error messages across different Robot Framework versions and prepared it to support RF 6.0.
Alias for library import can be now defined using AS marker (same as in Python). WITH NAME will be gradually deprecated in the future Robot Framework…
Several changes to our spacing and comments rules and also initial suppport for Robot Framework 5.1 features such as languages or AS markers.
Robocop now supports reading the Robot Framework files in different languages
using --language option. More details in our docs (#646).
Alias for library import can be now defined using AS marker (same as in Python).
WITH NAME will be gradually deprecated in the future Robot Framework versions.
That's why we added support for AS marker to existing rules and created new
rule deprecated-with-name which will warn on WITH NAME usage starting from RF 5.1 (#642).
We changed how we're recognizing the empty lines in spacing rules.
Previously consecutive-empty-lines, empty-lines-between-keywords and empty-lines-between-test-cases
rules ignored comments. This lead to suprising behaviours, for example following code reported three empty lines
between keywords:
*** Keywords ***
Keyword
Pass
# comment 1
# comment 2
Second Keyword
Pass
Detecting end of the keyword / test was also not working correctly (in above example # comment 1 should belong
to Keyword and do not count towards empty lines between keywords).
consecutive-empty-lines now also works inside IF, FOR, WHILE and TRY blocks.
todo-in-commentNew markers parameter in todo-in-comment rule that allows to define your own
markers that should be reported when found in the comment (#674).
missing-space-after-commentNew block parameter in missing-space-after-comment rule that allows to define
pattern for block comments that should be ignored by the rule (#689)
Keywords inside keywords like Run Keywords or Run Keyword If are now recognized
and handled by keyword rules (#691, #520).
too-few-calls-in-test-case now properly count keywords inside templated tests.
It is now also possible to ignore templated tests in too-few-calls-in-test-case rule
with ignore_templated parameter (#685)too-few-calls-in-test-case and too-few-calls-in-keyword now counts new RF 5.0 syntax (such as
RETURN or BREAK statements). The code inside IF, FOR, WHILE and TRY blocks is now
also recognized by those rules (#704)Big thanks to everyone: @ger-kil, @Lucas-C, @antonpaa and @UliSei for raising issues and helping to improve our documentation. @rikerfi for extending our comment rules
Several improvements and fixes for Robocop reports & first updates for upcoming Robot Framework 5.1 release. Rule severity can be also be dynamic depe
Several improvements and fixes for Robocop reports & first updates for upcoming Robot Framework 5.1 release. Rule severity can be also be dynamic depending on the rule other parameters.
--reports all option. Some reports were internal only or produced files which may be not desired. Reports that are not enabled by all and only with specific mention (ie --reports sarif) are marked in our docs (reports docs) (#662)--reports option. Before this release reports were generated in order they are implemented in Robocop code. Now if typu configure --reports x,y then first report x and then report y will be generated. You can also combine it with all if you only want one report at the top and rest in default order: --reports x,all (#664)--reports timestamps (instead of timestamp) and user was not aware of it (#665)Robocop can now generate report in sarif format. This format is accepted by various CI platforms as result of code scanning and can be used to integrate into Github CI (more details in our docs) (#638)
It is now possible to configure rule to report with different rule severity depending if the rule exceed given thresholds (#614).
For example if you want line-too-long rule to issue warning on lines above 120 characters long and error on lines longer than 200 character you can configure it using severity_threshold:
robocop -c line-too-long:line_length=120 -c line-too-long:severity_threshold:warning=120:error=200
More on the feature in our docs.
too-few-calls-in-test-case ruleNew rule too-few-calls-in-test-case. If the test case have less that allowed number of keyword calls (1 by default) it will report an error.
toml with tomli library (for parsing our configuration files). tomli library was selected to be part of Python vendored-in libraries in future Python release (#609)too-long-test-case and too-long-keyword rules with new ignore_docs parameter (False by default) (#613)pyproject.toml configuration file are now resolved using configuration file parent directory as parent (and not using tool current working directory which lead to unexpected behaviour) (#612)Big thanks to @ds-dustenharrison, @bollwyvl, @adrszad, @ZephyrusMB, @phermann-DGL, @rikerfi for raising the issues and providing the feedback.
Report that returns Robocop execution timestamp (#628 #637). Example:
New report and small fix.
Report that returns Robocop execution timestamp (#628 #637). Example:
Reported: 2022-07-10 21:25:00 +0300
When comment in Robot Framework contains more than one space of separator inside, it is recognized as two separate comments under the hood. It lead to a few small bugs when processing such comments - it is now resolved (#634).
Additionally block comments (starting with ###) are now ignored by missing-space-after-comment rule.
Big thanks to @MoreFamed , @UliSei for raising the issues and @rikerfi for implementing the timestamp report.
Updates to rule severity and threshold handling.
Updates to rule severity and threshold handling.
Updated Robocop python requirements to ">=3.6". The requirement did not change but we were missing this data in our metadata (#621).
@UliSei for raising the issues regarding our rule & threshold severity
This release is purely created by the community - big thanks!
This release is purely created by the community - big thanks!
New report added by @rikerfi (#616). It will print Robocop version at the end of the scan:
Report generated by Robocop version: 2.1.0
You can configure it using "all" or "version":
robocop --reports version src
Update to some of our naming rules done by @jannek76 (#615).
wrong-case-in-keyword-name rule received a new parameter: pattern. It allows you to define pattern that will be ignored from the keyword name. It's useful when Robocop doesn't detect the name of the keyword correctly (it works as a workaround for #595).
not-allowed-char-in-name split to not-allowed-char-in-name (which now covers test case and keyword names) and not-allowed-char-in-filename (which now covers suite names). Same as the original rule, not-allowed-char-in-filename also accepts patern that defines which characters are not allowed in a name. This split allows you to configure patern separately for suite and test/keyword names.
Big thanks to everyone! @jannek76 For improving our (not-so-simple) naming rules @rikerfi For adding new report
Fixed rule W0319 (deprecated-statement) which reported deprecation on [Return] statement in RF4 (#589, #590)
This 2.0.2 release 🎉 includes fixes for various parts of Robocop 🤖 and improves documentation 📖. Thanks everyone for finding the issues 🐞 and reporting them back to us!
[Return] statement in RF4 (#589, #590)[Return] not being the last statement when [Teardown] is used at the end of the keyword (#588, #591)Run Keyword Unless keyword only in RF5 (#593, #598)"Keyword name '{{ keyword_name }}' does not follow case convention" to properly reflect what's being checked (#548, #600)ignore_templated (set to True by default) is introduced to configure whether the rule should report on missing documentation for each templated test case or not (possible values are: Yes / 1 / True (default) or No / False / 0) (#526, #602)2 rules instead of 2 rule(s)) (#601)Big thanks to a great community for finding and reporting bugs! You make the tool better and you rock :metal: (random order) @rousku for reporting bug on W0319 (#589) @IlfirinPL for reporting bugs on W0901 (#588) and I0912 (#592) @rikerfi for reporting bug on W0302 (#558) @polewczakp for reporting bug on W1004 (#513) @MoreFamed for reporting bug on W0319 (#593) @KUGA2 for reporting issue with W0302 rule's message (#548) @Leemur89 for reporting bug on W0202 (#526)
Comment section without * Comments * section should now not fail when reporting empty-line-after-section
*** Comments *** section should now not fail when reporting empty-line-after-section (#582)Big thanks to @bollwyvl for improving how we define our dependencies and @oboehmer for finding the issue with sections rules.
*NEW*: W0319 (deprecated-statement) reports when deprecated keyword is used depending on the RF version in use (#565, #560, #576)
1.5 year of Robocop's devoted service has passed this month but we already made him older with the version 2.0!
The release includes support for Robot Framework 5.0 but the most important thing is that any custom user-created rules are not compatible with this version and need to be migrated (more about that below). Moreover, we improved our documentation with the examples for nearly every rule and the layout of the documentation also changed to a better one! There are 8 new rules, some others are improved, few fixes, performance enhancements and better exception handling. Please read the complete release notes to familiarize with what Robocop 2.0 has now to offer.
We would also like to apologize that some bugs waited so long to be fixed. Our plan for the next release is to fix all bugs that are left in the backlog and add any missing support for RF 5.0. Next, we want to focus on any other features that we want Robocop to have.
tag-with-reserved-word (#573)Exit For Loop (If), Continue For Loop (If) or statements like BREAK, CONTINUE are used only inside the loop (#562, #477, #577)[Tags] setting in keywords and test cases that has no values (#508, #440)Force Tags) (#572)robot: prefix (#573, #559)BuiltIn.Run Keyword If) (#519)Rule class now accepts docs argument which is dedicated for providing the extended
documentation for specific rule (#528)"Section name should be in format '%s' or '%s'", it can now be defined as
"Section name should be in format '{capitalized}' or '{uppercase}'" (#534, #535).gitignore file (#531, #476)robocop --list (enabled/disabled) (#532, #507)-gd/--ignore-default now supports excluding directories and files (and it already has some nice
default list of ignored paths) (#540, #475)version attribute can now be specified for each rule to define which Robot Framework version enables it (#545, #544)pytest --benchmark-enable tests. See
here for more details. (#495, #467)"missing-whitespace-after-setting" which is now "not-enough-whitespace-after-setting","variable-should-left-aligned" which is now "variable-should-be-left-aligned","0304" which is now "0406","invalid-char-in-name" which is now "not-allowed-char-in-name".Thanks to our community for staying with us this whole time and for contribution to make Robocop even better! Special thanks to users that helped with this release:
And I (@mnojek) would like to dedicate a huge thank you to @bhirsz who is constantly working on making the tool better. You are awesome! :tada:
This small but impactful release addresses the way Robocop deals with the configuration files. And it was fully implemented by our community! After th
This small but impactful release addresses the way Robocop deals with the configuration files. And it was fully implemented by our community! After this change all configuration files will be loaded by default (and not only when calling robocop without any options or paths). Configuration from command line will extend loaded configuration. This will allow to have configuration file with all configuration (excluded, included, format etc.) and still being able to run robocop on single source with robocop test.robot.
Thanks @bithium for creating & implementing the issue.
Fix for parsing configuration files with non-ASCII characters.
Fix for parsing configuration files with non-ASCII characters.
Fix for parsing invalid keyword call syntax inside if statement.
Fix for parsing invalid keyword call syntax inside if statement.
Yet another big release in a row 🚀. This time around we bring you 14 new rules - and we finally reached over 100 rules! Most of them try to analyze po
Yet another big release in a row 🚀. This time around we bring you 14 new rules - and we finally reached over 100 rules! Most of them try to analyze possible syntax errors and hint you what you possibly did wrong - e.g. if you forgot to put at least 2 spaces after setting. We also included various fixes and improvements for issue reporting.
Unfortunately, there are backward-incompatible changes - E0304, missing-whitespace-after-setting, variable-should-left-aligned and invalid-char-in-name were renamed (details in the release notes).
BTW This week is Robocop's first anniversary 🎂! What a journey it was - nearly 500 issues on GitHub, 20 releases, over 100 implemented rules, over 340 tests and thousands lines of code. Let the Robocop's watch never ends 👮♂️!
Given # throws warning
Given Some Keyword # throws warning. Popular mistake - separating action keyword from BDD keyword
Given Some Keyword
*** Keywords ***
Keyword
[Arguments] ${var} ${var}
Log ${var}
${var} ${var} ${Var} My Keyword
*** Settings ***
Variables other.py arg1 # it's fine
Variables variables.robot arg # not allowed
Keyword Call
... ${correct}
... ${incorrect}
.. value or .... value) (#483 #439)[Arguments] 1 string instead of variable name) (#483 #439)[Idontexist]) (#483 #439)[Arguments] in Test Case or [Template] in keyword) (#483 #439)${variable} 1 (which will not be recognized as proper variable by Robot) instead of ${variable} 1 (#483 #439)Library BuiltIn (not recognized by Robot) instead of Library BuiltIn (#463)*** Settings ***
Library Collections
E0304 rule id to E0406 (name not-enough-whitespace-after-newline-marker did not change). Additionally, this rule catches a lot more instances of this issuemissing-whitespace-after-setting to not-enough-whitespace-after-settingvariable-should-left-aligned to variable-should-be-left-aligned (#478)invalid-char-in-name is renamed to not-allowed-char-in-name. It now accepts a regex pattern as value of configurable (which is renamed from invalid_chars to pattern) and it checks if the name of keyword/test case/suite complies with the regex. (#466) Example of usage:robocop -c not-allowed-char-in-name:pattern:[.?%] # reports when one of `.`, `?` or `%` character is found in the name
robocop -c not-allowed-char-in-name:pattern:[^a-zA-Z] # reports when there are characters different then provided in the regex (note the `^` that negates the match)
*** Settings ***
Variables vars.py arg1
Variables vars.py arg2 # it's not considered duplicate now
...) is now ignored by other rules such as duplicated-variable (#460)Loaded configuration from will not be printed if the configuration is empty (#446)robocop -c line-too-long:ignore_pattern:your\s+regex\s+pattern <path_to_tests>Multiple keywords with name "Duplicated Keyword" (first occurrence in line 15)Thanks @MoreFamed for bug issues
Removed deprecation warnings for old rules that were renamed:
This huge release introduces 7 new rules and fixes other. Robot Framework 4.1 🤖 is now supported. Some great features for developers ⌨️ like tox are also something new. It also improves the quality of the code 💻 and documentation 📄. Thanks to all the contributors for their work! 🤝 Take a look at the details below and have fun using Robocop! 👮🏻♂️
Remember to upgrade your Robocop with:
pip install -U robotframework-robocop
WITH NAME) is left empty: (#185)Library Collections WITH NAME
Library Collections WITH NAME Collections
robocop -c too-many-test-cases:max_testcases:100 -c too-many-test-cases:max_templated_testcases:200 <path_to_tests>
Defaults are:
.resource if there are no tests defined inside (#380)-) in variable names when assigning values to prevent from accidental subtraction of values (#271)--list or --list-configurables options) now also displays a nice summary with amount of rules for each severity: (#416)(...)
Altogether 6 rule(s) with following severity:
1 error rule(s),
2 warning rule(s),
3 info rule(s).
${var}['key']['key2'] (#451): is now allowed to use when configuring rule, e.g. invalid-char-in-name with configurable invalid_chars (#428)setting-name-not-capitalized -> setting-name-not-in-title-case,not-capitalized-keyword-name -> wrong-case-in-keyword-name,missing-doc-testcase -> missing-doc-test-casepyyaml and tox to dev dependencies in setup.pytox command for both 3 and 4 versions of Robot Framework or you can choose specific one by typing tox -e rf3 or tox -e rf4Thanks @MoreFamed, @haklir, @adrszad for reporting bugs and features. Thanks @UliSei, @matusaurio for contributing with comments and suggestions.
Small improvements to file configurations handling and other fixes. You can now also import external rules from Python packages/modules: ` robocop --e
Small improvements to file configurations handling and other fixes. You can now also import external rules from Python packages/modules:
robocop --ext-rules pythonmodule
section-out-of-order rule can be now configured with custom order of sections #384toml module is now installed together with robocop for default support for pyproject.toml fileThanks for @fdaguin and @MoreFamed for reported issues and ideas
Nothing published for this version
Release fixing issue with parsing configuration files.
Release fixing issue with parsing configuration files.
A lot of new rules and changes - with huge number of contributions from others! 🚀 Some of the rules change names - see next section for more details.
A lot of new rules and changes - with huge number of contributions from others! 🚀 Some of the rules change names - see next section for more details.
missing-doc-testcase to missing-doc-test-casenot-capitalized-keyword-name to wrong-case-in-keyword-namesetting-name-not-capitalized to setting-name-not-in-title-caseE0312 keyword-name-is-empty and E0313 test-case-name-is-empty) #337W1012 consecutive-empty-lines checking for more than consecutive_empty_lines = 1 empty lines #365W1013 empty-lines-in-statement checking for empty lines inside multi line statement #371E0403 missing-keyword-name for calling variables without keyword name #386E1014 variable-should-left-aligned for ensuring that variables in variables section are left aligned #293W1004 empty-lines-between-test-cases should now ignore templated tests #367E0801 duplicated-test-case should now work correctly with normalized names #376W1003 empty-lines-between-sections after keyword section if the number of lines is correct #382format can be now used in .robocop configuraton file #387W0302 (wrong-case-in-keyword-name) #359Special thanks for:
This is mostly a bugfix release with minor changes to configurables and a big refactor in documentation.
This is mostly a bugfix release with minor changes to configurables and a big refactor in documentation.
line-too-long (W0508) rule: #349
Thanks @d-biehl for resolving issue with line endings!
Some defaults has changed, some documentation has been updated. We made couple of fixes also and deprecated rule W0906 that is now exchanged with two…
This release is mostly a big refactoring with parts of the code not touched since the very first commits. Some defaults has changed, some documentation has been updated. We made couple of fixes also and deprecated rule W0906 that is now exchanged with two new ones: W0909 and W0910. README is now written in markdown and it has a new expandable FAQ section at the bottom. There is also a new verbose mode and pyproject.toml is now supported for tool configuration. These and many more are described in detail below. Enjoy! 👮🏻♂️
*** Test Cases *** and *** Keywords *** sections are the same type #295*** Variables *** section are the same type #295Note: Possible values for W0909 and W0910 assignment_sign_type parameter are: none (without equal sign), equal_sign ('='), space_and_equal_sign (' ='), autodetect (detects the most common option and looks for inconsistencies in the code).
assignment_sign_type with one of: equal_sign ('='), none (''), space_and_equal_sign (' ='). W0906 will be deleted in next bigger release (1.8.0) or in the following (1.9.0) if it will be too early. #321*** Variables *** section should not cause fatal exception now #292pyproject.toml is now supported #301 See documentation for more info docs--list-configurables, instead it's listed only once #304--list-configurables now displays only rules that have configurable parameter #335--list-reports output #335severity parameter in other CLI options is now case-insensitive (both e/w/i and E/W/I are accepted) #335-vv / --verbose flag for more detailed output #72 #335{'E': 0, 'W': 0, 'I': -1} which means that any error or warning will make Robocop return non-zero status. -1 value means that issues with INFO severity will not affect return code. This can be configured by --configure return_status:quality_gate:E=<value>:W=<value>:I=<value #335testcase_max_calls: 8 → 10 (maximum amount of keyword calls inside test case)keyword_max_calls: 8 → 10 (maximum amount of keyword calls inside keyword)keyword_min_calls: 2 → 1 (minimum amount of keyword calls inside keyword)--ext_rules option is now --ext-rules option (changed underscore _ to hyphen -) #335-nr for --no-recursive-lc for --list-configurables-lr for --list-reports-ft for --filetypes-g for --ignorefile_stats will acknowledge issues excluded by configuration #299
Pack of fixes.
This release introduce initial support for integration with LSP. It makes possible to integrate Robocop with IDEs like Intellij and should enable us t
This release introduce initial support for integration with LSP. It makes possible to integrate Robocop with IDEs like Intellij and should enable us to add Robocop to other tools or plugins.
... are aligned with starting row #285This release brings few small improvements and fixes critical issues that occur when using Robot Framework 4.0.
This release brings few small improvements and fixes critical issues that occur when using Robot Framework 4.0.
file_stats can display overall statistics about number of processed files #262# noqa as alternative to # robocop: disable #269Your coding agent can read these notes before it upgrades. Set up the MCP server →