From Robotidy 3.0 see release notes in docs/releasenote directory.
- Robotidy transformers now inherits from
Transformercore class (instead ofModelTransformer).ModelTransformerwill be still supported in external transformers, however theTransformerwill provide more utility over the time.
The order of the transformers changed - now IndentNestedKeyword runs before AlignSettingsSection. Thanks for
this change settings will be properly indented by other transformers after IndentNestedKeyword splits the keywords (#318):
*** Settings ***
Suite Setup Run Keywords
... No Operation
... No Operation- Extended encoding (such as characters like ÁáÉéĚěÍíÓóÚúÝýŮůŘřŤťŠšĎČčŇň) is now supported in
--diffmode (#324) indentparameter is now taken into account byNormalizeTagstransformer (#323)spacecountparameter is now taken into account in inline IFs by NormalizeSeparators transformer (#322)
New IndentNestedKeywords transformer for formatting whitespace in run keywords variants such as Run Keywords or
Run Keyword And Continue On Failure. It will result in transforming following code:
Run Keyword Run Keyword If ${True} Run keywords Log foo AND Log bar ELSE Log bazto:
Run Keyword
... Run Keyword If ${True}
... Run keywords
... Log foo
... AND
... Log bar
... ELSE
... Log bazNormalizeNewLines transformer now removes empty lines inside multiline statements:
*** Keywords ***
Keyword
Keyword With
... Multiline arguments
... With empty lineswill be formatted to:
*** Keywords ***
Keyword
Keyword With
... Multiline arguments
... With empty linesFix for SplitTooLongLine transformer breaking keywords with veeery long names (#314)
Robotidy normalizes all whitespaces using the same fixed amount of spaces (configurable via --spacecount).
It's then optionally modified by various transformers such as AlignSettingsSection.
This release add additional option --indent that allows to configure indentation separately (#293).
It's now possible to have for example indentation of 4, but separator between the tokens (spacecount) equal to 2 spaces:
robotidy --indent 4 --spacecount 2
Keyword
FOR ${index} ${item} IN ENUMERATE @{LIST}
My Keyword ${index} ${item}
END
It is now possible to skip formatting suite, test case and keyword documentation with NormalizeSeparator transformer
by using skip_documentation parameter (#300):
robotidy --configure NormalizeSeparators:skip_documentation=True src
- Added
--skip-gitignoreflag to ignore.gitignorefiles and parse files listed there (#299).
Tidied out and colorized the console output of the Robotidy such as help messages, transformer docstrings and errors (#298).
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 # robotidy: off marker.
To skip the formatting for one statement:
Keyword That Is Longer Than Allowed Line Length ${arg} # robotidy: offTo 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
FormattedIt's possible to disable the formatting in whole file by putting # robotidy: off on first line:
# robotidy: off
*** Settings ***
Library CollectionsYou 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- NormalizeNewLines now removes leading, trailing and consecutive empty lines in IF, FOR, WHILE, TRY EXCEPT blocks (#288)
- It's no longer possible to forcefully enable transformer not supported in installed Robot Framework version (#281, #283)
- You can now disable coloring the output with
--no-colorcli option or by setting$NO_COLORenvironment variable (#268) - Added an option to set target version of Robot Framework when formatting the files:
It will disable all transformers that require Robot Framework greater than to run (even if you have Robot Framework greater than installed). (#253)
robotidy --target-version rf4 .
*** Tasks ***will no longer be renamed to*** Test Cases ***by NormalizeSectionHeaderName (#279).
-
Updated
NormalizeNewLinesto separate sections by two empty lines (instead of one). It's effort of normalizing Robocop output (which suggest to use 2 empty lines) and Robotidy (which previously transformed with 1 empty line) (#536).Previously:
*** Settings *** Force Tags tag *** Test Cases *** Test No OperationNow:
*** Settings *** Force Tags tag *** Test Cases *** Test No Operation
- Add missing packaging dependency (#275)
- New
ReplaceReturnstransformer that replaces return statements (such as[Return]setting orReturn From Keywordkeyword) withRETURNstatement (#231) - New
ReplaceBreakContinuetransformer that replacesContinue For LoopandExit For Loopkeyword variants with CONTINUE and BREAK statements (#241) - New
InlineIftransformer that replaces IF blocks with inline IF (#230) - Add
min_widthparameter toAlignSettingsSectiontransformer. It allows to set minimal width of data column (#242) - Add
min_widthparameter toAlignVariablesSectiontransformer. It allows to set minimal width of data column (#242) - Add
min_widthparameter toAlignTestCasestransformer. It allows to set minimal width of data column (#242) - Changed behaviour of
DiscardEmptySectionstransformer. Now by default section with only comments are not considered empty. Configureallow_only_commentstoFalseif you want to remove those sections (#235) - Add
skip_typesparameter toAlignVariablesSectionwhich allows to not align variables of particular type (#225) - Library names are now ignored by default by
RenameKeywordstransformer. Previously, it could result in an unexpected behaviour (#269). If you want to transform library names, passignore_library=Falseto the transformer.
-
Change exceptions to be more user-friendly. Robotidy will try to recognize common mistakes. For unknown issues there is extra message with link to our bug board (#250)
-
Refactored Robotidy acceptance tests (#248)
-
It is now possible to force overwrite with
--checkand--overwriteflags (#239). Going over possible options:Transform the files and return 0 even if there were files transformed.
robotidy srcDon't transform the files and return 0 even if there would be files transformed
robotidy --no-overwrite srcDon't transform the files and return 1 if there would be files transformed
robotidy --check srcTransform the files and return 1 if there are files transformed
robotidy --check --overwrite src
- Unmodified files are now not saved to the disk (#237)
AddMissingEndtransformer now properly handles IFs without indented block of code (#226)- Paths passed from command line are now checked against excluded paths (previously it was only checked when iterating over directories) (#227)
- Trailing whitespace is no longer added to blank lines in multiline statements when using align transformers (#219)
*** Tasks ***is no longer converted to*** Test Cases ***by NormalizeSectionHeaderName (#218)
-
New non default transformer
RenameTestCases. It capitalizes first letter of the test case name, removes trailing dot and can replace provided regex pattern with substitute string (#183) -
New non default transformer
RenameKeywords. It applies Title Case to keyword name and replace underscores by spaces and can replace provided regex pattern with substitute string (#183) -
Added
AlignTestCasestransformer for aligning templated test cases in column. Because it's in experimental mode it will be non default for now (see docs for information how to run it) (#185) -
Missing ENDs in for loop and if statements will be added by new
AddMissingEndtransformer (#91) -
NormalizeAssignmentsnow recognizes assignments from*** Variables ***section separately. It allows you to configure different assignment sign type for keyword calls and for variables section (#159)With this change following command will change all assignments signs to
=for keyword calls and remove them in*** Variables ***sections.robotidy -c NormalizeAssignments:equal_sign_type=equal_sign -c NormalizeAssignments:equal_sign_type_variables=remove <src> -
New
OrderTags(non default) transformer. It orders tags in lexicographic order (#205) -
New
NormalizeTags(non default) transformer. It normalizes tag name case and removes duplicates (#212)
- It is now possible to provide source paths in configuration file (#154)
- Non default transformers can be enabled using
enabled=Trueparameter (#182) - Semicolon in parameter value can now be escaped with
\:(#190) - Default separator can be changed from space to tabular with new
--separatoroption (#184) --lineseparatoroption now acceptsautovalue for preserving line endings found in the file (#209)
- Robotidy will not print "Loaded configuration from ... " if the configuration is empty (#193)
- no source path provided error now exits with code 1 instead of 0 (#208)
- ReplaceRunKeywordIf now removes ELSE branch if it is unnecessary (#192)
- Robotidy will now not crash on directory path #177
- Ignore paths from .gitignore and
--excludeoption, allow to ignore paths through using--extend-exclude#110 - Add extra indent for arguments in Suite Setup/Teardown, Test Setup/Teardown in AlignSettingsSection #155
- OrderSettingsSection will now preserve order of imports. It can be configured to work as before and other settings order can be also preserved #167
- When ordering imports with OrderSettingsSection, Remote library will not be grouped with other standard libs #175
- Allow to disable selected transformers #170
- Do not count documentation length when aligning all columns in settings section #156
- Acknowledge
--lineseparatoroption #163 - Do not print empty line for file without changes with
--diffoption #160
- Allow to use spaces in pyproject.toml configuration file #148
- Invalid option names in pyproject.toml file will now stop Robotidy (with optional hint message) #150
- Fixed spelling issues in source code and docs #146
AssignmentNormalizerwas renamed toNormalizeAssignmentfor consistent naming with other transformers #115- It is now possible to select what sections are normalized in
NormalizeSeparatorstransformer withsectionsparam #116 OrderSettingsnow puts settings before comments and empty lines at the end of keyword/test case body #118, #125
- New option
--outputoption for saving transformed file to provided path instead of overwriting source file #108 --descnow acceptsallfor printing out description of all transformers #105- Robotidy will now suggest similar names for invalid transformer names used with
--transformor--descoptions #107 --listnow prints transformers in alphabetical order #141
- Renamed short version of
--lineseparatorto-lsto avoid collision with--list\-l - Description for disabled transformers can be now displayed & disabled transformers are in
--listoutput #114 - Robotidy should now correctly load configuration files from path when using
--config#138 - ReplaceRunKeywordIf will now set variable values to
Noneif there is no ELSE branch #140 - Transformers should always use the same order. If you need to use custom order, provide --force-order flag #142
- Removed
'--describe-transformerand--list-transformersaliases for--listand--desc - Added
-halias for--helpcommand - Warn user instead of doing nothing when invoking robotidy without any arguments #106
- AlignVariablesSection now supports
--startlineand--endlineoptions for aligning only part of*** Variables ***section #62 - AlignVariablesSection now supports
up_to_columnparameter so it is possible to chose how much column are width aligned - AlignVariablesSection and AlignSettingsSection change
up_to_columndefault value from 0 (meaning all columns) to 2 (only first two columns are width aligned, rest use fixed length) # - New AlignSettingsSection for aligning
*** Settings ***section into columns #60 - New NormalizeSeparators for normalizing all separators and indents to fixed length (according to global
--spacecountoption) #32 - New RemoveEmptySettings transformer for removing empty settings such like
Suite Setupor[Arguments]. Settings that are overwriting suite settings (like empty[Tags]overwritingDefault Tags) are preserved. See the docs for config options #78 - New SmartSortKeywords transformer (disabled by default) for sorting out keywords inside
*** Keywords ***section #52 - New MergeAndOrderSections transformer for merging duplicated sections and ordering them (order is configurable) #70
- New OrderSettings transformer for ordering settings like [Arguments], [Setup], [Return] inside Keywords and Test Cases #59
- New OrderSettingsSection transformer for ordering settings, imports inside
*** Settings ****section #100
- New option
--configureor-cfor configuring transformer parameters. It works the same way configuring through--transformworks. The benefit of using--configureis that you can configure selected transformers and still run all transformers #96 - Transformers can now be disabled by default if you add
ENABLED = Falseclass attribute to your class. Those transformers will be only run when selected explicitly with--transformoption #10 - Support for
pyproject.tomlconfiguration files. Because of the required changes there are backward incompatible changes done torobotidy.tomlsyntax. See example from README #66 --list-transformersoutput is now ordered. Also transformers themselves will always run in the same predefined order #69--describe-transformeroutput is now pre-formatted (removed rst formatting) #83- Several options have now abbreviations: #92
--transformcan be also used with-t--list-transformerscan be also used with--listor-l--describe-transformercan be also used with--descor-d
- SplitTooLongLine will now parse multiple assignment values correctly #68
- AlignSettingsSection is now parsing empty lines in multi lines correctly (those lines are removed) #75
- Fix
--diffoption not displaying colours on Windows #86 - Fix issue where variable was not left aligned if name was prefixed with space (
{variable} 4) #88
- Support for pipes is now removed. All pipes will be converted to spaces by NormalizeSeparators transformer. It can be restored if people that use pipe syntax request for it
- Files with invalid encoding will now not stop robotidy execution - warning will be printed instead
- AlignVariablesSection should ignore lines with only comments
- Added alignVariablesSection for aligning variables and their values in column like appearance #50
- Robotidy should not add new (extra) line at the end of file #47
- BuiltIn.Run Keyword If should now work with ReplaceRunKeywordIf transformer #53
- DiscardEmptySections - empty sections are removed
- SplitTooLongLine - keywords with too long lines are split
- NormalizeSettingName - ensure that setting names are Title Case - Test Template, Library
- AssignmentNormalizer - use only one type of assignment
- NormalizeNewLines - ensure proper number of empty lines between keywords, test cases and sections
- NormalizeSectionHeaderName - ensure that sections are in
*** Section ***or*** SECTION ***format - ReplaceRunKeywordIf - replace RunKeywordIf with IF blocks
- configurable transformers
- selectable transformers (chose how you want to transform your code)
- robotidy configuration can be supplied from cli and config file (which can be pointed to or autodetected in directory if the name is 'robotidy.toml'
- option
--no-overviewto disable writing to files - option
--diffto display file diff with the changes done by robotidy - option
--checkto return status depending on if any file was modified by robotidy - options
--spacecountand--lineseparatorfor defining global formatting rules --startlineand--endlinearguments for narrowing down what robotidy is supposed to transform in file--list-transformersand--describe-transformerfor displaying information about existing transformers