Skip to content

Inconsistent NormalizeNewLines formatting #612

@RJIntraffic

Description

@RJIntraffic

Since migrating from the previous vscode extension I've had the same issue described in: #361

With this test file:

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


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

And this robot.toml:

[tool.robocop.format]
configure = [
    "NormalizeNewLines.enabled=True",
]

When formatting the test file with the vscode extension multiple times. The file will cycle between the following states:

  1. No change after the first format
  2. An extra whitespace line is added before *** Keywords ***
*** Test Cases ***
Test
    Embedded "args"



*** Keywords ***
Embedded "${args}"
    No Operation
  1. The file returns to original state
  2. FIle doesn't change
    Repeat from 1

When formatting with robocop via the CLI this issue doesn't happen.
robocop format test.robot --config robot.toml
(Since it might be relevant, robocop also work as expected when disabling caching
robocop format test.robot --config robot.toml --no-cache)

It seems to have something to do with the NormalizeNewLines.section_lines and NormalizeNewLines.test_case_lines variables? When either of these variables is set to 0 this issue doesn't occur. However when both these variables are > 0 the formatting becomes inconsistent.

The RobotCode output doesn't seem to show anything:

executeRobotCode: c:\XXX\Python310\python.exe -u -X utf8 c:\XXX\.vscode\extensions\d-biehl.robotcode-2.5.1\bundled\tool\robotcode --format json --no-color --no-pager -dp . discover --read-from-stdin tests -I test.robot --suite Robottest.Test
executeRobotCode: exit code 0

RobotCode version: 2.5.1
robotframework-robocop version: 8.2.10
robotframework version: 6.1.1

OS: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions