github MarketSquare/robotframework-robocop 2.0.0

latest releases: v8.2.4, v8.2.3, v8.2.2...
4 years ago

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
  • Rules
  • Fixes
  • Other
  • Acknowledgements

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 like BREAK, 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 accepts docs 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:
    • IF, ELSE & ELSE IF conditions support (#551)
    • Updated rule W0603 (more info in Rules section above) (#559)
    • Updated many tests to cover support for RF 5.0 syntax (#574)
    • New rule W0319 (more info in Rules section above) (#565)
    • New rule I0916 (more info in Rules section above) (#546)
  • Added performance tests that create JSON report with test results which later can be compared with previous
    results. They can be run with pytest --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! 🎉

Don't miss a new robotframework-robocop release

NewReleases is sending notifications on new releases.