Skip to content

Commit fc6b78d

Browse files
authored
fix: Fix unused-variable reported on variable names starting with digit (#1689)
1 parent 30b422f commit fc6b78d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/robocop/linter/rules/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ def find_not_nested_variable(self, value: str, can_be_escaped: bool) -> None:
16101610
elif value[i] == "}":
16111611
depth -= 1
16121612
if depth == 0:
1613-
self.update_used_variables(value[start_pos : i + 1])
1613+
self.update_used_variables(value[start_pos + 2 : i])
16141614
full_match = start_pos == 0 and i + 1 == len(value)
16151615
break
16161616

tests/linter/rules/variables/unused_variable/unused_section_vars.robot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ${METADATA_VALUE} value
3737
@{TEMPLATE_ARGS} arg1 arg2
3838
${VAR_DOCUMENTATION} Documentation value
3939
${VAR_TAG} Tag value
40+
${3MAR_DESCRIPTION} Lorem ipsum 2
4041

4142

4243
*** Test Cases ****
@@ -67,3 +68,6 @@ Keyword
6768
Keyword With Arguments
6869
[Arguments] ${arg}=${USED_IN_ARG_DEFAULT} ${arg2}=value with ${USED_IN_ARG_DEFAULT2}
6970
No Operation
71+
72+
Use Variable With Numbers
73+
Log To Console ${3MAR_DESCRIPTION}

0 commit comments

Comments
 (0)