robotframework-robocop icon indicating copy to clipboard operation
robotframework-robocop copied to clipboard

[Bug] allow the last comment in a file follow previous indent

Open rikerfi opened this issue 1 year ago • 1 comments

What happened?

Robocop reports following as [W] 1007 Line is over-indented (uneven-indent), but I think it should be allowed. The issue happens only when comments are placed on the last line of the file.

*** Test Cases ***
Test
    [Documentation]  doc
    Keyword


*** Keywords ***
Keyword
    [Documentation]  this is doc
    No Operation  # todo: do something
    # g

However, also this should be ok, like it is currently:

*** Test Cases ***
Test
    [Documentation]  doc
    Keyword


*** Keywords ***
Keyword
    [Documentation]  this is doc
    No Operation  # todo: do something
    # g

# EOF

Operating System

Linux

Robocop version

2.3.0

rikerfi avatar Aug 06 '22 09:08 rikerfi

You're right. over/under indented rules are bit complicated right now - I've actually started some improvements (for #504 - to allow for strict checks). I will take a look if it's something I can also fix/improve.

bhirsz avatar Aug 07 '22 09:08 bhirsz

I have actually fixed it without touching the logic - the problem lied in small (stupid) mistake with wrong range :) There will be the change to the uneven-indent (strict checks instead of "fuzzy" one right now) but it's separate topic for this fix - which will be included in the next release.

bhirsz avatar Sep 15 '22 12:09 bhirsz