JamitLabs / ProjLint

Project Linter to enforce your non-code best practices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for wildcards in Templates

Jeehut opened this issue · comments

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

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.