AlignVariablesSection¶
Align variables in *** Variables *** section to columns.
Disabling the formatter
AlignVariablesSection is included in the default formatters, but it can be also run separately with:
You can also disable it:
Align up to columns¶
You can configure how many columns should be aligned to the longest token in a given column. The remaining columns
will use fixed length separator length --space-count. By default, only the first two columns are aligned.
Example of how AlignVariablesSection formatter behaves with default configuration and multiple columns:
You can configure it to align three columns:
will result in the following formatting:
To align all columns set up_to_column to 0.
Select variable types to align¶
It is possible to not align variables of given types. You can choose between following types: scalar ($), list (@),
dict (&). Invalid variables - such as missing values or not left-aligned - will always be aligned no matter the type.
You can configure types to skip using skip_types parameter:
skip_types accepts a comma-separated list of types.
Using the above configuration code will be aligned in the following way:
Fixed width of column¶
It's possible to set a fixed width of the column. To configure it use fixed_width parameter:
This configuration respects up_to_column parameter:
Minimal width of column¶
It's possible to set minimal width of the column. To configure it use min_width parameter:
This configuration respects up_to_column parameter. Example where there is variable longer than min_width:
Example where all variables are shorter than min_width:
Select lines to align¶
AlignVariablesSection does also support global formatting params --start-line and --end-line:
will result in the following formatting: