Skip to content

Variables limitation: Variables with variables in their name are not always counted #78

@Lakitna

Description

@Lakitna

When using or defining a variable, the variable name can contain other variables. The most common use cases are supported but there are a lot of possible complexity which is not supported.

Variables in variable names are only counted when:

  • None of the involved variables are limited by limitation 1.
  • All nested variables are single-line scalar variables.
    • No lists (e.g. @{example})
    • No dicts (e.g. &{example})
    • No multi-line string definitions
  • No extended variable syntax.

Example: ${hello_${place.lower()}} uses extended variable syntax and is therefore ignored. Because of this, the variable ${hello_world} will be falsely flagged as unused.

*** Variables ***
${hello_world}    Hello World!
${place}          WORLD

*** Keywords ***
My Amazing Keyword
    Log    ${hello_${place.lower()}}

There is currently no plan to remove this limitation. Reason:

Fully supporting all variables within variables requires a full runtime context. The most common cases are already supported. This should be enough. This is primarily a static code analysis tool and should not try to be so complete.

If you disagree with this assessment, leave a comment on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions