Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c163135ee5 | ||
|
|
f656cf42d2 | ||
|
|
9b72a2d29a | ||
|
|
d7c17c7e7c |
@@ -16,7 +16,7 @@ indentation, etc.
|
|||||||
:target: https://coveralls.io/github/adrienverge/yamllint?branch=master
|
:target: https://coveralls.io/github/adrienverge/yamllint?branch=master
|
||||||
:alt: Code coverage status
|
:alt: Code coverage status
|
||||||
.. image:: https://readthedocs.org/projects/yamllint/badge/?version=latest
|
.. image:: https://readthedocs.org/projects/yamllint/badge/?version=latest
|
||||||
:target: http://yamllint.readthedocs.org/en/latest/?badge=latest
|
:target: https://yamllint.readthedocs.io/en/latest/?badge=latest
|
||||||
:alt: Documentation status
|
:alt: Documentation status
|
||||||
|
|
||||||
Written in Python (compatible with Python 2 & 3).
|
Written in Python (compatible with Python 2 & 3).
|
||||||
@@ -24,7 +24,7 @@ Written in Python (compatible with Python 2 & 3).
|
|||||||
Documentation
|
Documentation
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
http://yamllint.readthedocs.io/
|
https://yamllint.readthedocs.io/
|
||||||
|
|
||||||
Overview
|
Overview
|
||||||
--------
|
--------
|
||||||
@@ -82,7 +82,7 @@ Usage
|
|||||||
# Output a parsable format (for syntax checking in editors like Vim, emacs...)
|
# Output a parsable format (for syntax checking in editors like Vim, emacs...)
|
||||||
yamllint -f parsable file.yaml
|
yamllint -f parsable file.yaml
|
||||||
|
|
||||||
`Read more in the complete documentation! <http://yamllint.readthedocs.io/>`_
|
`Read more in the complete documentation! <https://yamllint.readthedocs.io/>`_
|
||||||
|
|
||||||
Features
|
Features
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
@@ -119,7 +119,7 @@ or for a whole block:
|
|||||||
consectetur : adipiscing elit
|
consectetur : adipiscing elit
|
||||||
# yamllint enable
|
# yamllint enable
|
||||||
|
|
||||||
`Read more in the complete documentation! <http://yamllint.readthedocs.io/>`_
|
`Read more in the complete documentation! <https://yamllint.readthedocs.io/>`_
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ class LineLengthTestCase(RuleTestCase):
|
|||||||
self.check('---\n' + 81 * 'a' + '\n', conf)
|
self.check('---\n' + 81 * 'a' + '\n', conf)
|
||||||
self.check(1000 * 'b', conf)
|
self.check(1000 * 'b', conf)
|
||||||
self.check('---\n' + 1000 * 'b' + '\n', conf)
|
self.check('---\n' + 1000 * 'b' + '\n', conf)
|
||||||
|
self.check('content: |\n'
|
||||||
|
' {% this line is' + 99 * ' really' + ' long %}\n',
|
||||||
|
conf)
|
||||||
|
|
||||||
def test_default(self):
|
def test_default(self):
|
||||||
conf = ('line-length: {max: 80}\n'
|
conf = ('line-length: {max: 80}\n'
|
||||||
@@ -145,3 +148,10 @@ class LineLengthTestCase(RuleTestCase):
|
|||||||
self.check('---\n'
|
self.check('---\n'
|
||||||
'- long line: and+some+space+at+the+end \n',
|
'- long line: and+some+space+at+the+end \n',
|
||||||
conf, problem=(2, 21))
|
conf, problem=(2, 21))
|
||||||
|
|
||||||
|
# See https://github.com/adrienverge/yamllint/issues/21
|
||||||
|
conf = 'line-length: {allow-non-breakable-inline-mappings: yes}'
|
||||||
|
self.check('---\n'
|
||||||
|
'content: |\n'
|
||||||
|
' {% this line is' + 99 * ' really' + ' long %}\n',
|
||||||
|
conf, problem=(3, 81))
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ indentation, etc."""
|
|||||||
|
|
||||||
|
|
||||||
APP_NAME = 'yamllint'
|
APP_NAME = 'yamllint'
|
||||||
APP_VERSION = '1.4.0'
|
APP_VERSION = '1.4.1'
|
||||||
APP_DESCRIPTION = __doc__
|
APP_DESCRIPTION = __doc__
|
||||||
|
|
||||||
__author__ = u'Adrien Vergé'
|
__author__ = u'Adrien Vergé'
|
||||||
|
|||||||
@@ -102,13 +102,18 @@ CONF = {'max': int,
|
|||||||
|
|
||||||
def check_inline_mapping(line):
|
def check_inline_mapping(line):
|
||||||
loader = yaml.SafeLoader(line.content)
|
loader = yaml.SafeLoader(line.content)
|
||||||
while loader.peek_token():
|
try:
|
||||||
if isinstance(loader.get_token(), yaml.BlockMappingStartToken):
|
while loader.peek_token():
|
||||||
while loader.peek_token():
|
if isinstance(loader.get_token(), yaml.BlockMappingStartToken):
|
||||||
if isinstance(loader.get_token(), yaml.ValueToken):
|
while loader.peek_token():
|
||||||
t = loader.get_token()
|
if isinstance(loader.get_token(), yaml.ValueToken):
|
||||||
if isinstance(t, yaml.ScalarToken):
|
t = loader.get_token()
|
||||||
return ' ' not in line.content[t.start_mark.column:]
|
if isinstance(t, yaml.ScalarToken):
|
||||||
|
return (
|
||||||
|
' ' not in line.content[t.start_mark.column:])
|
||||||
|
except yaml.scanner.ScannerError:
|
||||||
|
pass
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user