Commit Graph

4 Commits (f52347c688cfc446fe87c41e0f4700203584a0d6)

Author SHA1 Message Date
Ondrej Vasko f52347c688
Add allowed-values configuration option (custom truthy values #150)
Allows using key `allowed-values` for `truthy` section in configuration file (#150).

This allows to use configuration `truthy: allowed-values: ["yes", "no",
"..."]`, to set custom allowed truthy values.

This is especially useful for people using ansible, where values like
`yes` or `no` are valid and officially supported, but yamllint reports
them as illegal.

Implemented by difference of set of TRUTHY constants and configured
allowed values.

Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
6 years ago
Adrien Vergé 6dae8f5b6e feat(truthy): Allow explicit types
With this change, we don't require quotes for truthy values that are
explicitly typed. For instance, the following examples are all
considered valid:

    string1: !!str True
    string2: !!str yes
    string3: !!str off
    encoded: !!binary |
               True
               OFF
               pad==  # this decodes as 'N\xbb\x9e8Qii'
    boolean1: !!bool true
    boolean2: !!bool "false"
    boolean3: !!bool FALSE
    boolean4: !!bool True
    boolean5: !!bool off
    boolean6: !!bool NO
9 years ago
Peter Ericson 5294ff5552 truthy: Add tests for explicit booleans
From @adrienverge
9 years ago
Peter Ericson 1f472bc144 Add rule: truthy, to forbid truthy values that are not quoted 9 years ago