Skip to content

Commit 064d056

Browse files
committed
scripts/ci/check_platform_configs_vars.py: rework get_defined_variables
Signed-off-by: Maciej Pijanowski <[email protected]>
1 parent 02df092 commit 064d056

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

scripts/ci/check_platform_configs_vars.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from robot.api import get_model
1313
from robot.api.parsing import Variable, VariableSection
14+
from robot.running import ResourceFileBuilder
1415

1516
# Define paths
1617
BASE_DIR = "platform-configs" # Adjust this if needed
@@ -20,15 +21,8 @@
2021

2122
def get_defined_variables(file_path):
2223
"""Extract variable names from a Robot Framework file using RF parser."""
23-
with open(file_path, encoding="utf-8") as f:
24-
model = get_model(f.read())
25-
26-
variables = set()
27-
for section in model.sections:
28-
if isinstance(section, VariableSection):
29-
for var in section.body:
30-
if isinstance(var, Variable):
31-
variables.add(var.name)
24+
variables = ResourceFileBuilder().build(file_path).variables
25+
variables = set([var.name for var in variables])
3226
return variables
3327

3428

0 commit comments

Comments
 (0)