Skip to content

Feature request: Include a plain language description of why the rule failed #75

@logicbomb

Description

@logicbomb

Expand the return type for matches to be a tuple [bool, str | None] where the 2nd element contains an explaination of the failure when bool = False

It would also be nice to give the rule an optional name
e.g.

matched, reason = Rule("flux-capacitor", "foo < 3 and bar == 1" ).matches({"foo": 5, "bar": 1})
# matched: False
# reason: "The flux-capacitor failed because the value of 'foo' is 5, it must be less than 3"

I might be able to take a stab at it, if you think it's a useful feature. I'd want to hammer out how to format multiple failures in a single rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestRequests for new functionality

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions