Skip to content

Negative render rules don't work as intended #1267

@andilem

Description

@andilem

According to the documentation, a negative rule like <m key="k" value="~|false"> should match when the key "k" is not present or it has the value "false".
But that is not the case - the rule matches when the key "k" is not present or any key (not just k) has the value "false".
The code reads:

static class NegativeRule extends Rule {
...
        @Override
        public boolean matchesTags(Tag[] tags) {
            if (!containsKeys(tags))
                return true;

            for (Tag tag : tags)
                for (String value : values)
                    if (Utils.equals(value, tag.value))
                        return !exclusive;

            return exclusive;
        }
}

It is clear that any tags are evaluated, not just the specified one(s).
Is this behavior intended? If yes, it seems very strange and there is no way to specify a rule like described in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions