Several changes to our spacing and comments rules and also initial suppport for Robot Framework 5.1 features such as languages or AS markers.
Robot Framework 5.1 support
Language markers
Robocop now supports reading the Robot Framework files in different languages
using --language option. More details in our docs (#646).
WITH NAME deprecated in favour of AS
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).
Empty lines handling refactor (#708)
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.
Configurable todo-in-comment
New markers parameter in todo-in-comment rule that allows to define your own
markers that should be reported when found in the comment (#674).
Configurable block comments in missing-space-after-comment
New 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 run keywords are now parsed
Keywords inside keywords like Run Keywords or Run Keyword If are now recognized
and handled by keyword rules (#691, #520).
Fixes
too-few-calls-in-test-casenow properly count keywords inside templated tests.
It is now also possible to ignore templated tests intoo-few-calls-in-test-caserule
withignore_templatedparameter (#685)too-few-calls-in-test-caseandtoo-few-calls-in-keywordnow counts new RF 5.0 syntax (such as
RETURNorBREAKstatements). The code insideIF,FOR,WHILEandTRYblocks is now
also recognized by those rules (#704)- several naming rules now reports with more precise location (#290)
- duplicated import name now acknowledge the aliased name (#699)
- external rules are now properly loaded from installed Python module (#709)
- critical failures in Robot Framework that cause Robocop to stop working are now wrapped with more
user friendly message (#586)
Acknowledgements
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