Skip to content

[BUG] Incorrect formatting of Robot test script every second time #361

Open
@Markus537

Description

@Markus537

Type: Bug

Given the following minimal test description:

*** Test Cases ***
Test
   Embedded "args"


*** Keywords ***
Embedded "${args}"
   No Operation

When I reformat this from within VsCode using the corresponding keyboard shortcut <Shift><Ctrl>I, every second time an extra blank line is inserted before the keywords section. When the extra blank line is inserted, reformatting the document removes the blank line again.

My robotidy configuration in pyproject.toml is as follows:

[tool.robotidy]
spacecount = 3
transform = [
   "NormalizeSectionHeaderName",
   "NormalizeNewLines",
   "NormalizeSettingName",
   "NormalizeSeparators",
   "RemoveEmptySettings",
   "OrderSettings",
   "OrderSettingsSection"
]
configure = [
    "NormalizeAssignments: equal_sign_type=space_and_equal_sign",
    "NormalizeAssignments: equal_sign_type_variables=space_and_equal_sign",
    "NormalizeNewLines: section_lines=2",
    "NormalizeNewLines: keyword_lines=1",
    "NormalizeNewLines: test_case_lines=1",
    "NormalizeNewLines: separate_templated_tests=True",
    "NormalizeNewLines: consecutive_lines=1",
    "OrderSettings: keyword_before=documentation,tags,timeout,arguments",
    "OrderSettings: keyword_after=return",
    "OrderSettingsSection: group_order=documentation,tags,imports,settings",
    "OrderSettingsSection: imports_order=resource,library,variables"
]

Executing robotidy directly from the command line doesn't show this behaviour.

There is nothing special to be seen in the output of the RobotCode extension:

executeRobotCode: /home/.../.venv/bin/python -u -X utf8 /home/.../.vscode/extensions/d-biehl.robotcode-0.99.0/bundled/tool/robotcode --format json --no-color --no-pager --default-path . discover --read-from-stdin tests -P libraries/ --argumentfile=arguments.arg --parse-include test.robot --suite Test Robot Scripts.Test
executeRobotCode: exit code 0

Extension version: 0.99.0
VS Code version: Code 1.95.3 (f1a4fb101478ce6ec82fe9627c43efbf9e98c813, 2024-11-13T14:50:04.152Z)
OS version: Linux x64 4.18.0-553.27.1.el8_10.x86_64
Modes:

System Info
Item Value
CPUs Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz (4 x 0)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
webnn: unavailable_software
Load (avg) 1, 1, 1
Memory (System) 15.39GB (6.96GB free)
Process Argv . --log streetsidesoftware.code-spell-checker=trace
Screen Reader no
VM 100%
DESKTOP_SESSION gnome-xorg
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome-xorg
XDG_SESSION_TYPE x11

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions