Tool for static code analysis of Robot Framework language
APACHE-2.0 License
Bot releases are hidden (Show)
Published by bhirsz over 1 year ago
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.
Published by bhirsz over 1 year ago
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.
Published by bhirsz over 1 year ago
Fixes and improvements to the robocop file configuration, language header support and pre-commit configuration file.
Read more in full release notes.
Published by bhirsz almost 2 years ago
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.
Published by bhirsz about 2 years ago
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-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).
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 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.too-few-calls-in-test-case
ruleignore_templated
parameter (#685)too-few-calls-in-test-case
and too-few-calls-in-keyword
now counts new RF 5.0 syntax (such asRETURN
or BREAK
statements). The code inside IF
, FOR
, WHILE
and TRY
blocks is nowBig 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
Published by bhirsz about 2 years ago
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.
Published by bhirsz about 2 years ago
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.
Published by bhirsz over 2 years ago
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
Published by bhirsz over 2 years ago
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
Published by mnojek over 2 years ago
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 ๐ค (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)
Published by bhirsz over 2 years ago
*** 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.
Published by mnojek over 2 years ago
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"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 niceversion
attribute can now be specified for each rule to define which Robot Framework version enables it (#545, #544)pytest --benchmark-enable tests
. See"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! ๐
Published by bhirsz almost 3 years ago
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.
Published by bhirsz about 3 years ago
Fix for parsing configuration files with non-ASCII characters.
Published by bhirsz about 3 years ago
Fix for parsing invalid keyword call syntax inside if statement.
Published by bhirsz about 3 years ago
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-setting
variable-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
Published by mnojek about 3 years ago
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>
.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-case
pyyaml
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 rf4
Thanks @MoreFamed, @haklir, @adrszad for reporting bugs and features.
Thanks @UliSei, @matusaurio for contributing with comments and suggestions.
Published by bhirsz about 3 years ago
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
Published by bhirsz about 3 years ago
Release fixing issue with parsing configuration files.
Published by bhirsz over 3 years ago
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-case
not-capitalized-keyword-name
to wrong-case-in-keyword-name
setting-name-not-capitalized
to setting-name-not-in-title-case
E0312 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: