Skip to content

[BUG] fix=true in .toml file leads to incorrect formatting #654

Description

@Persipaani

Describe the bug
When using a pyproject.toml file with fix=true in the [tool.robocop.lint] section along with the "inconsistent-assignment-in-variables.assignment_sign_type setting, variables are formatted wrong.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Install latest robotcode & robocop 9+ in VSCode.
  2. Create a keybinding for "format file" and disable format on save. (possibly optional)
  3. Create a new project and add one .robot file and one pyproject.toml file to the root.
  4. Set to toml:
[tool.robocop.lint]
configure = [
    "inconsistent-assignment-in-variables.assignment_sign_type=equal_sign",
    "inconsistent-assignment.assignment_sign_type=equal_sign"
]
  1. Create a simple robot file where there are variables without the equal sign:
*** Settings ***
Documentation    Robocop test


*** Variables ***
${one}   1    
${two}           2


*** Test Cases ***
Test Test Case
    Log               something
    VAR    ${variable}      I am a variable
  1. Add fix=true to the beginning of the [tool.robocop.lint] section in the .toml file.
  2. Save & apply formatting to the .robot file

Note that sometimes you need to apply the formatting multiple times or re-open the file to get the behavior.

Expected behavior
Output is a .robot file formatted according to robocop rules.

Actual output
Output is a .robot file with incorrect amount of equal signs.

*** Settings ***
Documentation    Robocop test

*** Variables ***
${one}=    ==   1
${two}=    ==           2


*** Test Cases ***
Test Test Case
    Log               something
    VAR    ${variable}=    ==      I am a variable

Another example:

Image

Note that running robocop format .\test.robot with the same .toml does not seem to cause the issue.

Specs:

  • VS Code Version: 1.139.1 (user setup)
  • RobotCode Version 2.7.0
  • OS: Windows 11 64 bit
  • Python Version 3.14.4
  • RobotFramework Version 7.4.2
  • Robocop: 9.1.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions