Releases: MarketSquare/robotframework-robocop
1.11.1
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
1.10.0
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
New rules
- E0314 (empty-library-alias) checks if alias for library (after
WITH NAME
) is left empty: (#185)
Library Collections WITH NAME
- W0315 (duplicated-library-alias) if alias for library is the same as the library original name: (#185)
Library Collections WITH NAME Collections
- W0527 (too-many-test-cases) checks if the number of test cases does not exceed the configured number. (#112)
This can be easily set by configuring the rule, e.g.:
robocop -c too-many-test-cases:max_testcases:100 -c too-many-test-cases:max_templated_testcases:200 <path_to_tests>
Defaults are:- 50 test cases for a file (suite)
- 100 templated test cases for a file (suite)
- I0912 (empty-variable) detects variables without a value (#294)
- I0913 (can-be-resource-file) suggests to change file extension to
.resource
if there are no tests defined inside (#380) - I0316 (possible-variable-overwriting) detects possible overwriting of variables that are visually similar but are totally the same as read by Robot Framework parser (#120)
- I0317 (hyphen-in-variable-name) detects hyphens (
-
) in variable names when assigning values to prevent from accidental subtraction of values (#271)
Features
- Listing rules (with
--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).
- Added support for Robot Framework 4.1: (#433)
Fixes
- Fixed a lot of typos in code, output and documentation (#418, #419)
- semicolon
:
is now allowed to use when configuring rule, e.g.invalid-char-in-name
with configurableinvalid_chars
(#428) - Rule W1007 (uneven-indent) now properly parses indentation with templated test cases and comments (#375)
- Rule W1003 (empty-lines-between-sections) now supports comments between sections (#448)
- Rule W0301 (invalid-char-in-name) now doesn't break on embedded arguments (#421)
- Rules W0701 (todo-in-comment) and W0702 (missing-space-after-comment) now accept more cases when using comments (#447)
- Robocop disablers should now work properly (More info: #425)
Other
- Removed deprecation warnings for old rules that were renamed: (#418)
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-case
- Some refactor improving readability of the code and its performance (#418, #419)
- Bug template for GitHub issue is now improved (#426)
- Block disablers can now be indented (#431)
- Added
pyyaml
andtox
to dev dependencies in setup.py - With introduction of tox, when contributing to codebase, you can now quickly run all tests just by running
tox
command for both 3 and 4 versions of Robot Framework or you can choose specific one by typingtox -e rf3
ortox -e rf4
Acknowledgements
Thanks @MoreFamed, @haklir, @adrszad for reporting bugs and features.
Thanks @UliSei, @matusaurio for contributing with comments and suggestions.
1.9.0
Small improvements to file configurations handling and other fixes. You can now also import external rules from Python packages/modules:
robocop --ext-rules pythonmodule
Features
- External rules can be imported from external python packages. Read https://robocop.readthedocs.io/en/latest/external_rules.html for more details #404
- Comments are now supported in arguments files #406
section-out-of-order
rule can be now configured with custom order of sections #384
Fixes
Other
toml
module is now installed together with robocop for default support forpyproject.toml
file
Acknowledgements
Thanks for @fdaguin and @MoreFamed for reported issues and ideas
1.8.1
1.8.0
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.
Rule names changes
- Rename
missing-doc-testcase
tomissing-doc-test-case
- Rename
not-capitalized-keyword-name
towrong-case-in-keyword-name
- Rename
setting-name-not-capitalized
tosetting-name-not-in-title-case
Features
- New rule for empty keyword or test case name (
E0312 keyword-name-is-empty
andE0313 test-case-name-is-empty
) #337 - New rule
W1012 consecutive-empty-lines
checking for more thanconsecutive_empty_lines = 1
empty lines #365 - New rule
W1013 empty-lines-in-statement
checking for empty lines inside multi line statement #371 - Tag rules now also parse tags defined in last line of documentation #194
- New rule
E0403 missing-keyword-name
for calling variables without keyword name #386 - New rule
E1014 variable-should-left-aligned
for ensuring that variables in variables section are left aligned #293
Fixes
- Enforce utf-8 encoding when reading file for RawCheckers to fix problems with different encodings (such as inccorectly calculcated length of line) #356
- Fix invalid documentation regarding configuring format of the message #368
W1004 empty-lines-between-test-cases
should now ignore templated tests #367E0801 duplicated-test-case
should now work correctly with normalized names #376- Robocop will now not show
W1003 empty-lines-between-sections
after keyword section if the number of lines is correct #382 format
can be now used in.robocop
configuraton file #387
Other
- When using invalid rule name Robocop will now throw exception listing close matches (if any) #358 #361
- Allow to check only first word for capitalization in
W0302
(wrong-case-in-keyword-name
) #359 - Documentation improvements #385
Acknowledgements
Special thanks for:
- @rauttiz for reporting issues with line length checker
- @MoreFamed that provided enhancement idea for our error handling and idea for optional configuration for 0302 rule
- @bollwyvl for including our license inside our package
- @d-biehl that dicovered issues when parsing test cases and keywords without name and also reported & fixed #376
- @rdagum that reported issue invalid documentation for rule name inside format option and suggested ignoring some of the issues when parsing code with templated tests
- @kvo-harmoney for idea of rule checking for consecutive empty lines
- @yo-ga for adding parsing tags from last line of documentation and implementing rule for checking if variables inside variables section are left aligned
- @j3n5h for reporting & fixing issue with detecting number of empty lines after keyword section
- @Calletje234 for reporting issue with configuring format of output message in config file
1.7.1
This is mostly a bugfix release with minor changes to configurables and a big refactor in documentation.
Fixes
- Fixed typos and outdated parts in documentation, rephrased some parts #338
- Fixed typos in description of the rules #338
- Different line endings are now properly supported when using Robocop API #342
- Fixed issues with
line-too-long
(W0508) rule: #349
Other
- Better and more concise display of configurable parameters (now they also have some description and show the default value) #338 #350
- Removed 'checkers' section in documentation and moved some parts under 'rules' section #338
Acknowledgements
Thanks @d-biehl for resolving issue with line endings!
1.7.0
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! 👮🏻♂️
New rules
- W0909 (inconsistent-assignment) checks if all assignments in
*** Test Cases ***
and*** Keywords ***
sections are the same type #295 - W0910 (inconsistent-assignment-in-variables) checks if all assignments in
*** Variables ***
section are the same type #295
Note: 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).
- W0705 (bom-encoding-in-file) checks if robot file uses not supported BOM (Byte Order Mark) encoding #327
- W0911 (wrong-import-order) checks if builtin libraries are imported before any other library #313
Deprecated rules
- W0906 (redundant-equal-sign) - with the addition of W0909 and W0910 the W0906 is being deprecated. You can get the old W0906 behavior with W0909 and W0910 if you configure their parameter
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
Fixes
- W1002 (missing-trailing-blank-line) will not report each time when used with LSP #307
- Misaligned variables in
*** Variables ***
section should not cause fatal exception now #292 - Empty keyword names causing TypeError exception #318
- W0302 (not-capitalized-keyword-name) should have better support for local characters #314
- W0704 (ignored-data) now works with BOM encoded files #326
- Changed outdated data in documentation #335
- For loops and IFs inside test cases should be parsed by indent rules #331
- W1007 (uneven-indent) will now ignore comments between test cases and keywords #332
- Empty test case name will not throw IndexError from now #333
Other
- README has been rewritten to markdown and now includes nice FAQ section #335
- Video of our talk from RoboCon2021 is now included at the top of README file! #335
pyproject.toml
is now supported #301 See documentation for more info docs- Severity is not listed in every rule when using
--list-configurables
, instead it's listed only once #304 --list-configurables
now displays only rules that have configurable parameter #335- Prettified
--list-reports
output #335 severity
parameter in other CLI options is now case-insensitive (both e/w/i and E/W/I are accepted) #335- Rule name is now included in default issue output #310
- Added
-vv / --verbose
flag for more detailed output #72 #335 - Return status is now calculated on number of found issues that exceed quality gates limits #335
- Quality gates default values are now
{'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
#335 - Changed defaults for some lengths checkers: #335
testcase_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- Some command line options received short flag argument: #335
-nr
for--no-recursive
-lc
for--list-configurables
-lr
for--list-reports
-ft
for--filetypes
-g
for--ignore
Acknowledgements
1.6.1
Pack of fixes.
Fixes
- file_stats will acknowledge issues excluded by configuration #299
- W1007 (uneven-indent) should not report comments as rule volations #296
- W1007 (uneven-indent) should parse IFs #297
- Robocop API should load configuration file #302
- If there is invalid configuration while using Robocop API, it will throw InvalidArgumentError instead of SystemExit #303
1.6.0
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.
New rules
- W1011 (misaligned-continuation) checks if continuation marks
...
are aligned with starting row #285
Fixes
- W1007 (uneven-indent) should now work better with pipe style #284
Other
- Extended our API for easier integration with other tools #168