1.11.0
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 👮♂️!
New rules
- W0318 (bdd-without-keyword-call) checks if BDD-reserved keyword was used (Given, When, And, Then, But) with no keyword following it (#159)
Given # throws warning
Given Some Keyword # throws warning. Popular mistake - separating action keyword from BDD keyword
Given Some Keyword
- E0811 (duplicated-argument-name) for duplicated argument names. This type of error is silently ignored during execution but leads to unexpected results (#401)
*** Keywords ***
Keyword
[Arguments] ${var} ${var}
Log ${var}
- I0812 (duplicated-assigned-var-name) looks for duplicated names of assigned variables (#480)
${var} ${var} ${Var} My Keyword
- E0404 (variables-import-with-args) is reported when using variable imports with arguments when resource extension does not allow it (#435)
*** Settings ***
Variables other.py arg1 # it's fine
Variables variables.robot arg # not allowed
- W1015 (misaligned-continuation-row) for alignment of multiline statements (#438)
Keyword Call
... ${correct}
... ${incorrect}
- E0412 (invalid-for-loop) for invalid FOR loop syntax (#445)
- E0413 (invalid-if) for invalid IF statement syntax (#483 #439)
- E0405 (invalid-continuation-mark) for invalid syntax of continuation line (
.. value
or.... value
) (#483 #439) - E0407 (invalid-argument) for invalid syntax of argument (for example
[Arguments] 1
string instead of variable name) (#483 #439) - E0408 (not-existing-setting) when trying to use setting with not recognized name (
[Idontexist]
) (#483 #439) - E0409 (setting-not-supported) when using setting not available in given type of body - for example
[Arguments]
in Test Case or[Template]
in keyword) (#483 #439) - E0410 (not-enough-whitespace-after-variable) for example
${variable} 1
(which will not be recognized as proper variable by Robot) instead of${variable} 1
(#483 #439) - E0411 (not-enough-whitespace-after-suite-setting) for example
Library BuiltIn
(not recognized by Robot) instead ofLibrary BuiltIn
(#463) - E1016 (suite-setting-should-be-left-aligned) because settings are not recognized if they are not left aligned (#462)
*** Settings ***
Library Collections
Backward-incompatible changes
- Renamed
E0304
rule id toE0406
(namenot-enough-whitespace-after-newline-marker
did not change). Additionally, this rule catches a lot more instances of this issue - Renamed
missing-whitespace-after-setting
tonot-enough-whitespace-after-setting
- Renamed
variable-should-left-aligned
tovariable-should-be-left-aligned
(#478) - Rule
invalid-char-in-name
is renamed tonot-allowed-char-in-name
. It now accepts a regex pattern as value of configurable (which is renamed frominvalid_chars
topattern
) 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)
Fixes
- Rule W0807 (duplicated-variables-import) now correctly recognizes arguments passed to variable import (#434)
*** Settings ***
Variables vars.py arg1
Variables vars.py arg2 # it's not considered duplicate now
- Rule W0301 (invalid-char-in-name) now correctly ignores all type of variables in keyword name (including patterns in embedded vars) (#457)
- Files using different encoding (such as Czech or Slovak language) should be now correctly parsed by Robocop (#455)
- Variable definition with not enough whitespace after variable name will now be properly recognized and will not be reported as other issues (#464)
- Not enough whitespace after new line mark (
...
) is now ignored by other rules such as duplicated-variable (#460) - All possible parsing errors should now be reported (#461)
Loaded configuration from
will not be printed if the configuration is empty (#446)
Other
- Rule W0508 (line-too-long) now ignores lines matching configured pattern. Default pattern is http(s) links (#348)
It can be configured:
robocop -c line-too-long:ignore_pattern:your\s+regex\s+pattern <path_to_tests>
- Robocop now parses Robot Framework DataError instead of reporting it directly as parsing-error. It allows us to give more detailed information about errors (for example when missing whitespace after setting) (#439)
- Revised and improved reported issue position (line and column) for all rules. Now it's consistent and also more precise for some of the issues (#289)
- Changed how duplication rules are reported - instead of reporting on each duplicated line, it now reports on original (but it points to original in duplicated message) (#482)
Multiple keywords with name "Duplicated Keyword" (first occurrence in line 15)
- Robocop source code is now formatted with black (#485)
Acknowledgements
Thanks @MoreFamed for bug issues