Add support for wildcards in Templates
Jeehut opened this issue · comments
Cihat Gündüz commented
For the rule file_content_template there should be wildcard-matchers that can be specified in the template where the compared file can have whatever type the wilcard is. This can be done by using a Regex where in place of the wildcard there is a given regex. The wildcards and corresponding regexes could be:
Wildcard Placeholder | Regular Expression |
---|---|
wildcard.integer |
\d+ |
wildcard.double |
\d+(?:\.\d+) |
wildcard.string |
[^\n]+ |
wildcard.list.integer |
(?: *- \d+)* |
wildcard.list.double |
(?: *- \d+(?:\.\d+))* |
wildcard.list.string |
(?: *- [^\n]+)* |
wildcard.any |
.* |
wildcard.custom|regex:/some custom regex/ |
custom regex |
The usage in a Template could be like this:
- Foo
{{ wildcard.list.string }}
- Bar
Cihat Gündüz commented
Adding wildcards was tested but renders the failure feedback quite unreadable. Therefore we recommend trying to work around this differently, e.g. via putting more into the local config file implemented in #27.