Skip to content

how to use local variable in check block? #1989

@hh9527

Description

@hh9527
_RE = r"[a-z]+"
schema App:
    config: {str:str} = {}

    check:
        invalid = [k for k, v in config if not regex.match(k, RE)]
        len(invalid) == 0, "key format errors: {}".format(invalid)

kcl report: name 'invalid' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions