mirror of
https://github.com/j3ssie/osmedeus.git
synced 2026-09-13 05:07:45 +02:00
- Add platform variables (PlatformOS, PlatformArch, PlatformInDocker, PlatformInKubernetes, PlatformCloudProvider) to linter's built-in variables list - Extract checkStepFieldsForUndefinedVars and collectReferencedVarsFromStep helper functions to support comprehensive scanning of all template-renderable fields including parallel_functions, speed_args, config_args, agent fields, HTTP headers, LLM messages, decision cases/conditions, and memory paths - Add recursion for nested steps (foreach inner steps and parallel_steps) with proper variable scoping and support for loop-specific variables (_id_, foreach variable) - Enhance message formatting with highlightQuoted() to make quoted terms bold+yellow in error output - Enable UndefinedVariableRule by default in GetDefaultRules() - Add comprehensive test coverage for newly supported fields and nested step types (TestUndefinedVariableRule_*, TestUnusedVariableRule_ReferencedInNewFields) - Add test fixture and E2E test (TestWorkflow_Validate_UndefinedVarsComprehensive) validating detection across functions and foreach
44 lines
1.0 KiB
YAML
44 lines
1.0 KiB
YAML
name: undefined-vars-comprehensive
|
|
kind: module
|
|
description: Tests undefined variable detection in functions and foreach
|
|
params:
|
|
- name: target
|
|
required: true
|
|
- name: threads
|
|
default: 10
|
|
|
|
steps:
|
|
# 1) Undefined var inside functions: array
|
|
- name: func-with-undef
|
|
type: function
|
|
functions:
|
|
- 'log_info("target={{target}}")'
|
|
- 'log_info("bad={{funcUndef}}")'
|
|
|
|
# 2) Undefined var inside foreach inner step commands:
|
|
- name: foreach-with-undef
|
|
type: foreach
|
|
input: "{{target}}"
|
|
variable: line
|
|
step:
|
|
name: inner-step
|
|
type: bash
|
|
commands:
|
|
- echo "valid=[[line]]"
|
|
- echo "bad={{foreachCmdUndef}}"
|
|
|
|
# 3) Undefined var in foreach inner step function:
|
|
- name: foreach-func-undef
|
|
type: foreach
|
|
input: "{{target}}"
|
|
variable: item
|
|
step:
|
|
name: inner-func
|
|
type: function
|
|
function: 'log_info("bad={{foreachFuncUndef}}")'
|
|
|
|
# 4) Valid step (control - should produce no warnings)
|
|
- name: valid-step
|
|
type: bash
|
|
command: echo "{{target}} {{Output}}"
|