Releases: MarketSquare/robotframework-robocop
Robocop 2.5.0
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-case
now properly count keywords inside templated tests.
It is now also possible to ignore templated tests intoo-few-calls-in-test-case
rule
withignore_templated
parameter (#685)too-few-calls-in-test-case
andtoo-few-calls-in-keyword
now counts new RF 5.0 syntax (such as
RETURN
orBREAK
statements). The code insideIF
,FOR
,WHILE
andTRY
blocks 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
Robocop 2.4.0
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 improvements & fixes
- Not all reports will be generated when using
--reports all
option. Some reports were internal only or produced files which may be not desired. Reports that are not enabled byall
and only with specific mention (ie--reports sarif
) are marked in our docs (reports docs) (#662) - It is possible now to change order of the reports in the output using
--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 reportx
and then reporty
will be generated. You can also combine it withall
if you only want one report at the top and rest in default order:--reports x,all
(#664) - Invalid report name will now fail and suggest alternative if you made a typo - previously invalid report name was silenty ignored. For example it was possible to configure
--reports timestamps
(instead oftimestamp
) and user was not aware of it (#665)
Sarif report
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)
Configurable rule severity
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
rule
New 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.
Other
- Replaced
toml
withtomli
library (for parsing our configuration files).tomli
library was selected to be part of Python vendored-in libraries in future Python release (#609) - Handle new reserved tags in Robot Framework 5.1 (#660)
- You can ignore documentation in
too-long-test-case
andtoo-long-keyword
rules with newignore_docs
parameter (False
by default) (#613) - Relative paths in the
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)
Acknowledgements
Big thanks to @ds-dustenharrison, @bollwyvl, @adrszad, @ZephyrusMB, @phermann-DGL, @rikerfi for raising the issues and providing the feedback.
Robocop 2.3.0
New report and small fix.
Timestamp report
Report that returns Robocop execution timestamp (#628 #637). Example:
Reported: 2022-07-10 21:25:00 +0300
Handle comments with separators inside
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.
Acknowledgements
Big thanks to @MoreFamed , @UliSei for raising the issues and @rikerfi for implementing the timestamp
report.
Robocop 2.2.0
Updates to rule severity and threshold handling.
- Fixed the bug where the overriden rule severity wasn't taken into account by reports (#623)
- Threshold severity can be now configured the same way the rule severity is configured (#624)
- Invalid threshold value now raises an error instead of silently using INFO severity (#624)
Other
Updated Robocop python requirements to ">=3.6". The requirement did not change but we were missing this data in our metadata (#621).
Acknowledgements 💪🏻
@UliSei for raising the issues regarding our rule & threshold severity
Robocop 2.1.0
This release is purely created by the community - big thanks!
Version Report
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
Naming rules changes
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 tonot-allowed-char-in-name
(which now covers test case and keyword names) andnot-allowed-char-in-filename
(which now covers suite names). Same as the original rule,not-allowed-char-in-filename
also acceptspatern
that defines which characters are not allowed in a name. This split allows you to configurepatern
separately for suite and test/keyword names.
Acknowledgements 💪🏻
Big thanks to everyone!
@jannek76 For improving our (not-so-simple) naming rules
@rikerfi For adding new report
2.0.2
Robocop 2.0.2
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!
Fixes 🐛
- Fixed rule W0319 (deprecated-statement) which reported deprecation on
[Return]
statement in RF4 (#589, #590) - Rule W0901 (keyword-after-return) no longer reports warning on
[Return]
not being the last statement when[Teardown]
is used at the end of the keyword (#588, #591) - Updated rule W0302 (wrong-case-in-keyword-name) to better handle parenthesis used in keyword and test case names (#558, #596)
- Updated rules W1004 (empty-lines-between-test-cases) and W1005 (empty-lines-between-keywords) to allow comments between keywords and test cases in corresponding sections (#513, #599)
- Fixed rule W0319 (deprecated-statement) to show deprecation message for
Run Keyword Unless
keyword only in RF5 (#593, #598) - Updated message for rule W0302 (wrong-case-in-keyword-name) to
"Keyword name '{{ keyword_name }}' does not follow case convention"
to properly reflect what's being checked (#548, #600) - Updated rule I0912 (empty-variable) to properly mark variable type in recommendations for empty values (#592, #597)
- Fixed rule W0202 (missing-doc-test-case) to not report on every test case when templated suite is used.
Also, a new parameterignore_templated
(set toTrue
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)
Other 📈
- Updated examples in documentation (README and User Guide) (#601)
- Added examples in reports documentation (#601)
- Robocop can now correctly say if a noun is plural or singular (e.g.
2 rules
instead of2 rule(s)
) (#601) - Fixed small typos in documentation, docstrings and sorted imports in code (#603)
- Removed repo visualization file (due to problems with related GitHub action) (#607)
Acknowledgements 💪🏻
Big thanks to a great community for finding and reporting bugs! You make the tool better and you rock 🤘 (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)
2.0.1
Fixes
- Comment section without
*** Comments ***
section should now not fail when reportingempty-line-after-section
(#582) - It is now safe to use Robocop 2.0 with Robot Framework 4.1.3 (without breaking on new syntax) (#583)
Other
- Our dependencies are sorted and normalized (#584)
Acknowledgements
Big thanks to @bollwyvl for improving how we define our dependencies and @oboehmer for finding the issue with sections rules.
2.0.0
Robocop 2.0
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.
Backward-incompatible changes
- The rules are now defined as class (instead of a tuple). (#516)
This makes the code a lot more readable and creation of new rules is a lot easier but... is also causes all
external rules created by the users not being compatible with RoboCop 2.0. They need to be migrated, so we
recommend reading the
"External Rules" chapter from our documentation to
better understand how it works now. All built-in rules in Robocop are already migrated, but if you have some custom
ones, you need to migrate them by yourself. In case of any questions or issues, ping as on our
#robocop-linter Slack channel. - Rule W0603 (tag-with-reserved) name has changed to
tag-with-reserved-word
(#573) - Rule E0902 (keyword-after-return-from) has been removed and replaced with W0901 (keyword-after-return) (#576)
Rules
- NEW: W0609 (duplicated-tags) notifies if the same tag was used several times (#542, #291)
- NEW: I0914 (if-can-be-merged) suggests merging several IF conditions into one, if they have identical
conditions (#543, #441) - NEW: E0915 (statement-outside-loop) checks if keywords like
Exit For Loop (If)
,Continue For Loop (If)
or statements likeBREAK
,CONTINUE
are used only inside the loop (#562, #477, #577) - NEW: W0608 (empty-tags) detects
[Tags]
setting in keywords and test cases that has no values (#508, #440) - NEW: W0813 (duplicated-setting) warns user about duplicated setting (e.g.
Force Tags
) (#572) - NEW: W0319 (deprecated-statement) reports when deprecated keyword is used depending on the RF version in use
(#565, #560, #576) - NEW: E0414 (return-in-test-case) detects RETURN statements used outside the keywords (#576)
- NEW: I0916 (inline-if-can-be-used) suggests whether to replace simple IF with new inline IF (#578, #546)
- UPDATE: E0303 (keyword-name-is-reserved-word) supports detecting reserved names introduced in RF 5.0 (#570, #568)
- UPDATE: E0401 (parsing-error) now also detects if positional argument is passed after named argument (#541, #474)
- UPDATE: E0412 (invalid-for-loop) now better detects any syntax errors in FOR loop (#572)
- UPDATE: W0603 (tag-with-reserved-word) is extended with another special tags with
robot:
prefix (#573, #559) - UPDATE: W0901 (keyword-after-return) replaces removed rule E0902 (keyword-after-return-from) (#576)
- REMOVED: E0902 (keyword-after-return-from) (#576)
Fixes
- Robocop now properly parses keywords that are preceded with a library name (e.g.
BuiltIn.Run Keyword If
) (#519) - Some rules now better point to the place where the issue occurred
- Many rules have more precise message (#533)
- Using Gherkin syntax (given, When, Then, And) now doesn't throw an exception (#549, #550)
Other
- The documentation has been significantly improved with a lot of good practices with real-life
examples about which code violates specific rule and why (#527, #468, #555) - (related to previous one)
Rule
class now acceptsdocs
argument which is dedicated for providing the extended
documentation for specific rule (#528) - (related to previous one) Jinja templating is now supported in rules' documentation, which means that instead of
mystical rule message like"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) - Robocop now skips reading paths defined in
.gitignore
file (#531, #476) - Exceptions handling has been significantly improved. Now all known issues or possible to catch errors should have
much better descriptions and additional warning messages. Only unexpected issues now display stacktrace (#521, #530) - Some rules that are available only in a specific version of Robot Framework will be properly marked when calling
robocop --list
(enabled/disabled) (#532, #507) - New CLI argument
-gd/--ignore-default
now supports excluding directories and files (and it already has some nice
default list of ignored paths) (#540, #475) - Robocop is now faster since it excludes some files and directories from parsing phase. Depending on the repository
size, the execution time can be reduced up to 20% (#540, #475) - The documentation theme has been changed to "furo" - more readable one which includes better navigation and supports
dropdowns (#567, #563) version
attribute can now be specified for each rule to define which Robot Framework version enables it (#545, #544)- Support for Robot Framework 5.0 including:
- Added performance tests that create JSON report with test results which later can be compared with previous
results. They can be run withpytest --benchmark-enable tests
. See
here for more details. (#495, #467) - Configuration file is now always loaded first by default and any CLI arguments append to it (#512)
- General code refactor, updated links in documentation, improved comments and print messages (#577)
- Added Python 3.10 support (#577)
- Removed deprecation warnings for the rules updated in the previous releases:
"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"
.
Acknowledgements
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:
- @MoreFamed for suggestion to improve messages of some rules (#500)
- @d-biehl for reporting a bug about Gherkin being not fully supported by Robocop (#549)
- @bithium for creating PR that improved how configuration is loaded (#512)
- @MalikMlitat for adding new W0319 rule that detects deprecated keywords (#565)
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! 🎉
1.12.0
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
.
Features
- always load configuration files (.robocop and .pyproject.toml) #511
Acknowledgements
Thanks @bithium for creating & implementing the issue.