AlignSettingsSection#
Align statements in *** Settings ***
section to columns.
Transformer configuration
AlignSettingsSection is included in the default transformers, but it can be also run separately with:
robotidy --transform AlignSettingsSection src
You can also disable AlignSettingsSection:
robotidy --configure AlignSettingsSection:enabled=False src
*** Settings ***
Library SeleniumLibrary
Library Mylibrary.py
Variables variables.py
Test Timeout 1 min
# this should be left aligned
*** Settings ***
Library SeleniumLibrary
Library Mylibrary.py
Variables variables.py
Test Timeout 1 min
# this should be left aligned
Align up to columns#
You can configure how many columns should be aligned to the longest token in given column. The remaining columns
will use fixed length separator length --spacecount
. By default only first two columns are aligned.
Example of how AlignSettingsSection transformer behaves with default configuration and multiple columns:
*** Settings ***
Library CustomLibrary WITH NAME name
Library ArgsedLibrary ${1} ${2} ${3}
Documentation Example using the space separated format.
... and this documentation is multiline
... where this line should go I wonder?
*** Settings ***
Library CustomLibrary WITH NAME name
Library ArgsedLibrary ${1} ${2} ${3}
Documentation Example using the space separated format.
... and this documentation is multiline
... where this line should go I wonder?
You can configure it to align three columns:
robotidy --configure AlignSettingsSection:up_to_column=3 src
*** Settings ***
Library CustomLibrary WITH NAME name
Library ArgsedLibrary ${1} ${2} ${3}
Documentation Example using the space separated format.
... and this documentation is multiline
... where this line should go I wonder?
*** Settings ***
Library CustomLibrary WITH NAME name
Library ArgsedLibrary ${1} ${2} ${3}
Documentation Example using the space separated format.
... and this documentation is multiline
... where this line should go I wonder?
To align all columns set up_to_column
to 0.
Extra indent for keyword arguments#
Arguments in multiline settings are indented by additional argument_indent
(default 4
) spaces.
You can configure the indent or disable it by setting argument_indent
to 0.
*** Settings ***
Suite Setup Start Session
... host=${IPADDRESS}
... user=${USERNAME}
... password=${PASSWORD}
Suite Teardown Close Session
*** Settings ***
Suite Setup Start Session
... host=${IPADDRESS}
... user=${USERNAME}
... password=${PASSWORD}
Suite Teardown Close Session
*** Settings ***
Suite Setup Start Session
... host=${IPADDRESS}
... user=${USERNAME}
... password=${PASSWORD}
Suite Teardown Close Session
WITH NAME
arguments are not indented:
*** Settings ***
Library SeleniumLibrary
... timeout=${TIMEOUT}
... implicit_wait=${TIMEOUT}
... run_on_failure=Capture Page Screenshot
... WITH NAME Selenium
Library SeleniumLibrary
... timeout=${TIMEOUT}
... implicit_wait=${TIMEOUT}
... run_on_failure=Capture Page Screenshot
... WITH NAME Selenium
Fixed width of column#
It’s possible to set fixed minimal width of column. To configure it use min_width
parameter:
robotidy --configure AlignSettingsSection:min_width=30 src
This configuration respects up_to_column
parameter but ignores argument_indent
.
*** Settings ***
Library CustomLibrary WITH NAME name
Library ArgsedLibrary ${1} ${2} ${3}
Documentation Example using the space separated format.
... and this documentation is multiline
... where this line should go I wonder?
*** Settings ***
Library CustomLibrary WITH NAME name
Library ArgsedLibrary ${1} ${2} ${3}
Documentation Example using the space separated format.
... and this documentation is multiline
... where this line should go I wonder?
Select lines to transform#
AlignSettingsSection does also support global formatting params startline
and endline
:
robotidy --startline 2 --endline 3 --configure AlignSettingsSection:up_to_column=3 src
*** Settings ***
Metadata Version 2.0 # this should be not aligned
Metadata More Info For more information about *Robot Framework* see http://robotframework.org
Metadata Executed At {HOST}
*** Settings ***
Metadata Version 2.0 # this should be not aligned
Metadata More Info For more information about *Robot Framework* see http://robotframework.org
Metadata Executed At {HOST}