Use this rule to control that the YAML documents do not contain a scalar value. Forbidden values can be defined as a regular expression. That can be globally forbidden (for any key) or forbidden for a specific key (also identifiable with a regular expression).
.*. The start and end line markers ^ and $ are implicit: this means that
setting foo is equivalent to ^foo$.key-name parameter, if you want to match a single word
you must use the start and end line markers ^ and $. For example, if you set foo
as the regular expression then any value containing the "foo" word will be caught, whereas ^foo$
will match only the values that are exactly foo..* would have the same effect as the rule ForbiddenKeyCheck.With key-name = [tT]e.*t and value = ^forbi.*en$
the following code snippet would PASS:
Test: any forbidden value
tesT: {key1: 4, key2: forbidden}
the following code snippets would FAIL:
Test: forbidden
test: forbi anything in between
Test: {key1: 4, forbidden: forbidden}
With key-name = [tT]e.*t and value = .*forbidden.* or value = forbidden
the following code snippet would PASS:
Test: any value
tesT: {key1: 4, key2: forbidden}
the following code snippets would FAIL:
Test: any forbidden value
tesT: {key1: 4, forbidden: forbidden}
test: >
with
a forbidden
value
test: |
with
a forbidden
value
With key-name = .* and value = ^forbi.*en$
the following code snippet would PASS:
foo: any forbidden value
Bar: {key1: 4, key2: 8}
the following code snippets would FAIL:
foo: forbidden
Bar: forbi anything in between
Bar: {key1: 4, key2: forbidden}
With key-name = [tT]e.*t and value = .*
the following code snippet would PASS:
Test1: value
tesT: {key1: 4, key2: 8}
the following code snippets would FAIL:
test: value
tesT: {Test: 4, key2: 8}