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

[enhancement] configure `non-local-variables-should-be-uppercase` to allow lower-case variables

Open rikerfi opened this issue 2 years ago • 1 comments

It should be possible to configure non-local-variables-should-be-uppercase to allow lower-case variables in it.

*** Variables ***
@{PROTOCOLS}  TCP  UDP


*** Test Cases ***
Test
    [Documentation]  Doc.
    KW


*** Keywords ***
KW
    [Documentation]  non-local-variables-should-be-uppercase
    FOR  ${proto}  IN  @{PROTOCOLS}
        ${stuff}  Get Stuff  ${proto}
        # This is good, but confusing:
        Set Test Variable  ${EXAMPLE_${PROTO}}  ${stuff}
        # This could be allowed via configure:
        Set Test Variable  ${EXAMPLE_${proto}}  ${stuff}
    END

rikerfi avatar Aug 14 '22 15:08 rikerfi

I agree. We need better mechanism for parsing the variables though - maybe steal something from the core Robot Framework. It's now always possible to recognize what is a variable, nested variable and what just text (Robot uses dynamic context to decide that) but it should be possible to cover basic cases (especially if we at least cache the local scope),

bhirsz avatar Aug 14 '22 17:08 bhirsz