-
Notifications
You must be signed in to change notification settings - Fork 48
Description
When using robocop’s AlignVariablesSection rule to format the *** Variables *** section, the number of spaces inserted between the variable name and its value is inconsistent depending on the length of the variable name.
Example cases
Case 1 – 4 spaces between name and value:
*** Variables ***
${VARXX_CONTEXT} ${EMPTY} # Set in Suite Setup
${ADD_REMOVE_T1} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_2} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_3} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_4} ${EMPTY} # Set in Test Setup
Case 2 – 7 spaces:
*** Variables ***
${VARXX_CONTEXT} ${EMPTY} # Set in Suite Setup
${ADD_REMOVE_TE1} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_2} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_3} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_4} ${EMPTY} # Set in Test Setup
Case 3 – 5 spaces:
*** Variables ***
${VARXX_CONTEXT} ${EMPTY} # Set in Suite Setup
${ADD_REMOVE_TEST1} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_2} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_3} ${EMPTY} # Set in Test Setup
${ADD_REMOVE_4} ${EMPTY} # Set in Test Setup
Expected behavior
The formatter should use consistent spacing regardless of variable name length. For example, if the configuration defines a fixed alignment rule (e.g., 4 spaces between name and value), it should apply uniformly across all variables.
Actual behavior
The number of spaces varies depending on the variable name length — seemingly trying to align the ${EMPTY} tokens to a shared column, but producing inconsistent spacing when variable names differ slightly in length.
robocop, version 6.10.0
Robot Framework 7.3.2 (Python 3.12.12 on linux)
[tool.robocop.format]
line-ending = "unix"
line-length = 150
reruns = 3
configure = [
"InlineIf.enabled=True",
"InlineIf.line_length=150",
"NormalizeTags.preserve_format=True",
"NormalizeAssignments.equal_sign_type=space_and_equal_sign",
"OrderTags.enabled=False",
"RenameKeywords.enabled=True",
"RenameTestCases.enabled=True",
"RenameTestCases.capitalize_each_word=True",
"ReplaceWithVAR.enabled=True",
]