Skip to content

2.2.0

Compare
Choose a tag to compare
@bhirsz bhirsz released this 26 Apr 18:20
· 246 commits to main since this release
f5347c9

In this release we're adding feature allowing to disable robotidy from source code and option to run robotidy with target Robot Framework version. Read the below description for more information and list of other changes.

Disable formatting from source code

Previously the only option to disable formatting in part of the file was to use cumbersome
--startline and --endline markers. This release brings new feature - comment disablers.
You can disable formatting in Robot Framework statement or in span of lines using # robocop: off marker.

To skip the formatting for one statement:

Keyword That Is Longer Than Allowed Line Length  ${arg}  # robotidy: off

To skip multiple lines:

*** Test Cases ***
Test that will be formatted
    Step

# robotidy: off
Test that will not be formatted
    Step

# robotidy: on
Another test that will be formatted
    Step

# robotidy: on marker is used to enable the formatting again - but is not required. # robotidy: off will disable
the formatting to the end of the current block:

Keyword That Is Formatted
IF    $condition
    Formatted
ELSE
    Formatted
    # robotidy: off
    Not Formatted
    WHILE    $condition
        Not Formatted
    END
END
Formatted

It's possible to disable the formatting in whole file by putting # robotidy: off on first line:

# robotidy: off
*** Settings ***
Library    Collections

You can also disable the formatting in whole section if you put # robotidy: off in section header:

*** Test Cases ***
Formatted
    Step

*** Keywords ***  # robotidy: off
Not Formatted
    Step

Transformers

  • NormalizeNewLines now removes leading, trailing and consecutive empty lines in IF, FOR, WHILE, TRY EXCEPT blocks (#288)

Fixes

  • It's no longer possible to forcefully enable transformer not supported in installed Robot Framework version (#281, #283)

Other

  • You can now disable coloring the output with --no-color cli option or by setting $NO_COLOR environment variable (#268)
  • Added an option to set target version of Robot Framework when formatting the files:
    robotidy --target-version rf4 .
    
    It will disable all transformers that require Robot Framework greater than to run (even if you have Robot Framework greater than installed). (#253)

Acknowledgements

Thanks @DrVanScott, @Ga22be, @westadejl and @IlfirinPL for raising bug issues & feature requests!