Merge tag 'v1.11.1' into packaging
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
---
|
||||
|
||||
# For use with pre-commit.
|
||||
# See usage instructions at http://pre-commit.com
|
||||
# See usage instructions at https://pre-commit.com
|
||||
|
||||
- id: yamllint
|
||||
name: yamllint
|
||||
|
||||
@@ -9,14 +9,12 @@ python:
|
||||
- 3.6
|
||||
- nightly
|
||||
install:
|
||||
- pip install pyyaml flake8 flake8-import-order coveralls sphinx
|
||||
- pip install pyyaml flake8 flake8-import-order coveralls
|
||||
- if [[ $TRAVIS_PYTHON_VERSION == 2.6 ]]; then pip install unittest2; fi
|
||||
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then pip install sphinx; fi
|
||||
- pip install .
|
||||
script:
|
||||
- if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then flake8 .; fi
|
||||
# Because of https://github.com/PyCQA/flake8-import-order/issues/149
|
||||
# otherwise tests fail with Python 3.6:
|
||||
- pip uninstall --yes enum34
|
||||
- yamllint --strict $(git ls-files '*.yaml' '*.yml')
|
||||
- coverage run --source=yamllint setup.py test
|
||||
- if [[ $TRAVIS_PYTHON_VERSION != 2* ]]; then
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
1.11.1 (2018-04-06)
|
||||
-------------------
|
||||
|
||||
- Handle merge keys (`<<`) in the `key-duplicates` rule
|
||||
- Update documentation about pre-commit
|
||||
- Make examples for `ignore` rule clearer
|
||||
- Clarify documentation on the 'truthy' rule
|
||||
- Fix crash in parser due to a change in PyYAML > 3.12
|
||||
|
||||
1.11.0 (2018-02-21)
|
||||
-------------------
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ You can either totally ignore files (they won't be looked at):
|
||||
|
||||
ignore: |
|
||||
/this/specific/file.yaml
|
||||
/all/this/directory/
|
||||
all/this/directory/
|
||||
*.template.yaml
|
||||
|
||||
or ignore paths only for specific rules:
|
||||
@@ -167,4 +167,4 @@ Here is a more complex example:
|
||||
trailing-spaces:
|
||||
ignore: |
|
||||
*.ignore-trailing-spaces.yaml
|
||||
/ascii-art/*
|
||||
ascii-art/*
|
||||
|
||||
@@ -78,6 +78,15 @@ class KeyDuplicatesTestCase(RuleTestCase):
|
||||
' duplicates with\n'
|
||||
' many styles\n'
|
||||
': 1\n', conf)
|
||||
self.check('---\n'
|
||||
'Merge Keys are OK:\n'
|
||||
'anchor_one: &anchor_one\n'
|
||||
' one: one\n'
|
||||
'anchor_two: &anchor_two\n'
|
||||
' two: two\n'
|
||||
'anchor_reference:\n'
|
||||
' <<: *anchor_one\n'
|
||||
' <<: *anchor_two\n', conf)
|
||||
|
||||
def test_enabled(self):
|
||||
conf = 'key-duplicates: enable'
|
||||
@@ -147,6 +156,15 @@ class KeyDuplicatesTestCase(RuleTestCase):
|
||||
': 1\n', conf,
|
||||
problem1=(3, 1), problem2=(4, 1), problem3=(5, 3),
|
||||
problem4=(7, 3))
|
||||
self.check('---\n'
|
||||
'Merge Keys are OK:\n'
|
||||
'anchor_one: &anchor_one\n'
|
||||
' one: one\n'
|
||||
'anchor_two: &anchor_two\n'
|
||||
' two: two\n'
|
||||
'anchor_reference:\n'
|
||||
' <<: *anchor_one\n'
|
||||
' <<: *anchor_two\n', conf)
|
||||
|
||||
def test_key_tokens_in_flow_sequences(self):
|
||||
conf = 'key-duplicates: enable'
|
||||
|
||||
@@ -22,7 +22,7 @@ indentation, etc."""
|
||||
|
||||
|
||||
APP_NAME = 'yamllint'
|
||||
APP_VERSION = '1.11.0'
|
||||
APP_VERSION = '1.11.1'
|
||||
APP_DESCRIPTION = __doc__
|
||||
|
||||
__author__ = u'Adrien Vergé'
|
||||
|
||||
@@ -125,7 +125,8 @@ def token_or_comment_generator(buffer):
|
||||
curr = yaml_loader.get_token()
|
||||
while curr is not None:
|
||||
next = yaml_loader.get_token()
|
||||
nextnext = yaml_loader.peek_token()
|
||||
nextnext = (yaml_loader.peek_token()
|
||||
if yaml_loader.check_token() else None)
|
||||
|
||||
yield Token(curr.start_mark.line + 1, curr, prev, next, nextnext)
|
||||
|
||||
|
||||
@@ -91,7 +91,9 @@ def check(conf, token, prev, next, nextnext, context):
|
||||
# This check is done because KeyTokens can be found inside flow
|
||||
# sequences... strange, but allowed.
|
||||
if len(context['stack']) > 0 and context['stack'][-1].type == MAP:
|
||||
if next.value in context['stack'][-1].keys:
|
||||
if (next.value in context['stack'][-1].keys and
|
||||
# `<<` is "merge key", see http://yaml.org/type/merge.html
|
||||
next.value != '<<'):
|
||||
yield LintProblem(
|
||||
next.start_mark.line + 1, next.start_mark.column + 1,
|
||||
'duplication of key "%s" in mapping' % next.value)
|
||||
|
||||
@@ -15,11 +15,12 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
Use this rule to forbid truthy values that are not quoted nor explicitly typed.
|
||||
Use this rule to forbid non-explictly typed truthy values other than ``true``
|
||||
and ``false``, for example ``YES``, ``False`` and ``off``.
|
||||
|
||||
This would prevent YAML parsers from transforming ``[yes, FALSE, Off]`` into
|
||||
``[true, false, false]`` or ``{y: 1, yes: 2, on: 3, true: 4, True: 5}`` into
|
||||
``{y: 1, true: 5}``.
|
||||
This can be useful to prevent surprises from YAML parsers transforming
|
||||
``[yes, FALSE, Off]`` into ``[true, false, false]`` or
|
||||
``{y: 1, yes: 2, on: 3, true: 4, True: 5}`` into ``{y: 1, true: 5}``.
|
||||
|
||||
.. rubric:: Examples
|
||||
|
||||
@@ -34,8 +35,7 @@ This would prevent YAML parsers from transforming ``[yes, FALSE, Off]`` into
|
||||
|
||||
"yes": 1
|
||||
"on": 2
|
||||
"true": 3
|
||||
"True": 4
|
||||
"True": 3
|
||||
|
||||
explicit:
|
||||
string1: !!str True
|
||||
@@ -62,8 +62,7 @@ This would prevent YAML parsers from transforming ``[yes, FALSE, Off]`` into
|
||||
|
||||
yes: 1
|
||||
on: 2
|
||||
true: 3
|
||||
True: 4
|
||||
True: 3
|
||||
"""
|
||||
|
||||
import yaml
|
||||
@@ -90,4 +89,4 @@ def check(conf, token, prev, next, nextnext, context):
|
||||
if token.value in TRUTHY and token.style is None:
|
||||
yield LintProblem(token.start_mark.line + 1,
|
||||
token.start_mark.column + 1,
|
||||
"truthy value is not quoted")
|
||||
"truthy value should be true or false")
|
||||
|
||||
Reference in New Issue
Block a user