fix(rules): Use true/false, not yes/no
Although `yes` and `no` are recognized as booleans by the pyyaml parser, the correct keywords are `true` and `false` (as highlighted by the newly added `truthy` rule). This commit replaces the use of `yes`/`no` by `true`/`false` and advertise it in the docs, but also makes sure this change is backward-compatible (so that `yes` and `no` still work).
This commit is contained in:
@@ -16,14 +16,14 @@ rules:
|
||||
max-spaces-after: 1
|
||||
comments:
|
||||
level: warning
|
||||
require-starting-space: yes
|
||||
require-starting-space: true
|
||||
min-spaces-from-content: 2
|
||||
comments-indentation:
|
||||
level: warning
|
||||
document-end: disable
|
||||
document-start:
|
||||
level: warning
|
||||
present: yes
|
||||
present: true
|
||||
empty-lines:
|
||||
max: 2
|
||||
max-start: 0
|
||||
@@ -32,13 +32,13 @@ rules:
|
||||
max-spaces-after: 1
|
||||
indentation:
|
||||
spaces: consistent
|
||||
indent-sequences: yes
|
||||
check-multi-line-strings: no
|
||||
indent-sequences: true
|
||||
check-multi-line-strings: false
|
||||
key-duplicates: enable
|
||||
line-length:
|
||||
max: 80
|
||||
allow-non-breakable-words: yes
|
||||
allow-non-breakable-inline-mappings: no
|
||||
allow-non-breakable-words: true
|
||||
allow-non-breakable-inline-mappings: false
|
||||
new-line-at-end-of-file: enable
|
||||
new-lines:
|
||||
type: unix
|
||||
|
||||
@@ -25,5 +25,5 @@ rules:
|
||||
indent-sequences: consistent
|
||||
line-length:
|
||||
level: warning
|
||||
allow-non-breakable-inline-mappings: yes
|
||||
allow-non-breakable-inline-mappings: true
|
||||
truthy: disable
|
||||
|
||||
@@ -20,14 +20,14 @@ Use this rule to control the position and formatting of comments.
|
||||
.. rubric:: Options
|
||||
|
||||
* Use ``require-starting-space`` to require a space character right after the
|
||||
``#``. Set to ``yes`` to enable, ``no`` to disable.
|
||||
``#``. Set to ``true`` to enable, ``false`` to disable.
|
||||
* ``min-spaces-from-content`` is used to visually separate inline comments from
|
||||
content. It defines the minimal required number of spaces between a comment
|
||||
and its preceding content.
|
||||
|
||||
.. rubric:: Examples
|
||||
|
||||
#. With ``comments: {require-starting-space: yes}``
|
||||
#. With ``comments: {require-starting-space: true}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
|
||||
@@ -19,12 +19,12 @@ Use this rule to require or forbid the use of document end marker (``...``).
|
||||
|
||||
.. rubric:: Options
|
||||
|
||||
* Set ``present`` to ``yes`` when the document end marker is required, or to
|
||||
``no`` when it is forbidden.
|
||||
* Set ``present`` to ``true`` when the document end marker is required, or to
|
||||
``false`` when it is forbidden.
|
||||
|
||||
.. rubric:: Examples
|
||||
|
||||
#. With ``document-end: {present: yes}``
|
||||
#. With ``document-end: {present: true}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
@@ -49,7 +49,7 @@ Use this rule to require or forbid the use of document end marker (``...``).
|
||||
- is: another one
|
||||
...
|
||||
|
||||
#. With ``document-end: {present: no}``
|
||||
#. With ``document-end: {present: false}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
|
||||
@@ -19,12 +19,12 @@ Use this rule to require or forbid the use of document start marker (``---``).
|
||||
|
||||
.. rubric:: Options
|
||||
|
||||
* Set ``present`` to ``yes`` when the document start marker is required, or to
|
||||
``no`` when it is forbidden.
|
||||
* Set ``present`` to ``true`` when the document start marker is required, or to
|
||||
``false`` when it is forbidden.
|
||||
|
||||
.. rubric:: Examples
|
||||
|
||||
#. With ``document-start: {present: yes}``
|
||||
#. With ``document-start: {present: true}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
@@ -45,7 +45,7 @@ Use this rule to require or forbid the use of document start marker (``---``).
|
||||
- this
|
||||
- is: another one
|
||||
|
||||
#. With ``document-start: {present: no}``
|
||||
#. With ``document-start: {present: false}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
|
||||
@@ -25,12 +25,12 @@ Use this rule to control the indentation.
|
||||
same within the file.
|
||||
* ``indent-sequences`` defines whether block sequences should be indented or
|
||||
not (when in a mapping, this indentation is not mandatory -- some people
|
||||
perceive the ``-`` as part of the indentation). Possible values: ``yes``,
|
||||
``no``, ``whatever`` and ``consistent``. ``consistent`` requires either all
|
||||
block sequences to be indented, or none to be. ``whatever`` means either
|
||||
perceive the ``-`` as part of the indentation). Possible values: ``true``,
|
||||
``false``, ``whatever`` and ``consistent``. ``consistent`` requires either
|
||||
all block sequences to be indented, or none to be. ``whatever`` means either
|
||||
indenting or not indenting individual block sequences is OK.
|
||||
* ``check-multi-line-strings`` defines whether to lint indentation in
|
||||
multi-line strings. Set to ``yes`` to enable, ``no`` to disable.
|
||||
multi-line strings. Set to ``true`` to enable, ``false`` to disable.
|
||||
|
||||
.. rubric:: Examples
|
||||
|
||||
@@ -99,7 +99,7 @@ Use this rule to control the indentation.
|
||||
Russian:
|
||||
dolls
|
||||
|
||||
#. With ``indentation: {spaces: 2, indent-sequences: no}``
|
||||
#. With ``indentation: {spaces: 2, indent-sequences: false}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
@@ -152,7 +152,7 @@ Use this rule to control the indentation.
|
||||
- spaghetti
|
||||
- sauce
|
||||
|
||||
#. With ``indentation: {spaces: 4, check-multi-line-strings: yes}``
|
||||
#. With ``indentation: {spaces: 4, check-multi-line-strings: true}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
|
||||
@@ -22,7 +22,7 @@ Use this rule to set a limit to lines length.
|
||||
* ``max`` defines the maximal (inclusive) length of lines.
|
||||
* ``allow-non-breakable-words`` is used to allow non breakable words (without
|
||||
spaces inside) to overflow the limit. This is useful for long URLs, for
|
||||
instance. Use ``yes`` to allow, ``no`` to forbid.
|
||||
instance. Use ``true`` to allow, ``false`` to forbid.
|
||||
* ``allow-non-breakable-inline-mappings`` implies ``allow-non-breakable-words``
|
||||
and extends it to also allow non-breakable words in inline mappings.
|
||||
|
||||
@@ -44,7 +44,7 @@ Use this rule to set a limit to lines length.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
|
||||
tempor incididunt ut labore et dolore magna aliqua.
|
||||
|
||||
#. With ``line-length: {max: 60, allow-non-breakable-words: yes}``
|
||||
#. With ``line-length: {max: 60, allow-non-breakable-words: true}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
@@ -68,15 +68,15 @@ Use this rule to set a limit to lines length.
|
||||
|
||||
- foobar: http://localhost/very/very/very/very/very/very/very/very/long/url
|
||||
|
||||
#. With ``line-length: {max: 60, allow-non-breakable-words: yes,
|
||||
allow-non-breakable-inline-mappings: yes}``
|
||||
#. With ``line-length: {max: 60, allow-non-breakable-words: true,
|
||||
allow-non-breakable-inline-mappings: true}``
|
||||
|
||||
the following code snippet would **PASS**:
|
||||
::
|
||||
|
||||
- foobar: http://localhost/very/very/very/very/very/very/very/very/long/url
|
||||
|
||||
#. With ``line-length: {max: 60, allow-non-breakable-words: no}``
|
||||
#. With ``line-length: {max: 60, allow-non-breakable-words: false}``
|
||||
|
||||
the following code snippet would **FAIL**:
|
||||
::
|
||||
|
||||
Reference in New Issue
Block a user