Hello community,
here is the log from the commit of package python-yamllint for openSUSE:Factory checked in at 2018-12-31 09:47:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-yamllint (Old)
and /work/SRC/openSUSE:Factory/.python-yamllint.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-yamllint"
Mon Dec 31 09:47:12 2018 rev:3 rq:662050 version:1.13.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-yamllint/python-yamllint.changes 2018-12-13 19:45:51.144902644 +0100
+++ /work/SRC/openSUSE:Factory/.python-yamllint.new.28833/python-yamllint.changes 2018-12-31 09:47:51.310144399 +0100
@@ -1,0 +2,11 @@
+Sun Dec 30 04:03:53 UTC 2018 - John Vandenberg
+
+- Update to 1.13.0
+ * Add a new -f colored option
+- Update to 1.12.1
+ * Fix the `quoted-strings` rule
+- Update to 1.12.0
+ * Add a new `quoted-strings` rule
+- Changes file fix
+
+-------------------------------------------------------------------
Old:
----
yamllint-1.11.1.tar.gz
New:
----
yamllint-1.13.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-yamllint.spec ++++++
--- /var/tmp/diff_new_pack.iNk3De/_old 2018-12-31 09:47:51.998143834 +0100
+++ /var/tmp/diff_new_pack.iNk3De/_new 2018-12-31 09:47:51.998143834 +0100
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-yamllint
-Version: 1.11.1
+Version: 1.13.0
Release: 0
Summary: A linter for YAML files
License: GPL-3.0-only
++++++ yamllint-1.11.1.tar.gz -> yamllint-1.13.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/PKG-INFO new/yamllint-1.13.0/PKG-INFO
--- old/yamllint-1.11.1/PKG-INFO 2018-04-06 11:14:37.000000000 +0200
+++ new/yamllint-1.13.0/PKG-INFO 2018-11-14 19:10:45.000000000 +0100
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: yamllint
-Version: 1.11.1
+Version: 1.13.0
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Vergé
Author-email: UNKNOWN
License: GPLv3
-Description-Content-Type: UNKNOWN
Description: A linter for YAML files.
yamllint does not only check for syntax validity, but for weirdnesses like key
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/README.rst new/yamllint-1.13.0/README.rst
--- old/yamllint-1.11.1/README.rst 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/README.rst 2018-11-14 19:10:16.000000000 +0100
@@ -38,7 +38,8 @@
Installation
^^^^^^^^^^^^
-On Fedora / CentOS:
+On Fedora / CentOS (note: `EPEL https://fedoraproject.org/wiki/EPEL`_ is
+required on CentOS):
.. code:: bash
@@ -50,11 +51,17 @@
sudo apt-get install yamllint
+On Mac OS 10.11+:
+
+.. code:: bash
+
+ brew install yamllint
+
Alternatively using pip, the Python package manager:
.. code:: bash
- sudo pip install yamllint
+ pip install --user yamllint
Usage
^^^^^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/docs/configuration.rst new/yamllint-1.13.0/docs/configuration.rst
--- old/yamllint-1.11.1/docs/configuration.rst 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/docs/configuration.rst 2018-11-14 19:10:16.000000000 +0100
@@ -102,8 +102,8 @@
-------------------
Problems detected by yamllint can be raised either as errors or as warnings.
-The CLI will output them (with different colors when using the ``standard``
-output format).
+The CLI will output them (with different colors when using the ``colored``
+output format, or ``auto`` when run from a terminal).
By default the script will exit with a return code ``1`` *only when* there is one or
more error(s).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/docs/quickstart.rst new/yamllint-1.13.0/docs/quickstart.rst
--- old/yamllint-1.11.1/docs/quickstart.rst 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/docs/quickstart.rst 2018-11-14 19:10:16.000000000 +0100
@@ -16,25 +16,24 @@
sudo apt-get install yamllint
-On older Debian / Ubuntu versions:
+On Mac OS 10.11+:
.. code:: bash
- sudo add-apt-repository -y ppa:adrienverge/ppa && sudo apt-get update
- sudo apt-get install yamllint
+ brew install yamllint
Alternatively using pip, the Python package manager:
.. code:: bash
- sudo pip install yamllint
+ pip install --user yamllint
If you prefer installing from source, you can run, from the source directory:
.. code:: bash
python setup.py sdist
- sudo pip install dist/yamllint-*.tar.gz
+ pip install --user dist/yamllint-*.tar.gz
Running yamllint
----------------
@@ -69,6 +68,10 @@
10:1 error too many blank lines (4 > 2) (empty-lines)
11:4 error too many spaces inside braces (braces)
+By default, the output of yamllint is colored when run from a terminal, and pure
+text in other cases. Add the ``-f standard`` arguments to force non-colored output.
+Use the ``-f colored`` arguments to force colored output.
+
Add the ``-f parsable`` arguments if you need an output format parsable by a
machine (for instance for :doc:`syntax highlighting in text editors
`). The output will then look like:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/docs/rules.rst new/yamllint-1.13.0/docs/rules.rst
--- old/yamllint-1.11.1/docs/rules.rst 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/docs/rules.rst 2018-11-14 19:10:16.000000000 +0100
@@ -104,6 +104,11 @@
.. automodule:: yamllint.rules.octal_values
+quoted-strings
+--------------
+
+.. automodule:: yamllint.rules.quoted_strings
+
trailing-spaces
---------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/tests/rules/test_quoted_strings.py new/yamllint-1.13.0/tests/rules/test_quoted_strings.py
--- old/yamllint-1.11.1/tests/rules/test_quoted_strings.py 1970-01-01 01:00:00.000000000 +0100
+++ new/yamllint-1.13.0/tests/rules/test_quoted_strings.py 2018-11-14 19:10:16.000000000 +0100
@@ -0,0 +1,125 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2018 ClearScore
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+
+from tests.common import RuleTestCase
+
+
+class QuotedTestCase(RuleTestCase):
+ rule_id = 'quoted-strings'
+
+ def test_disabled(self):
+ conf = 'quoted-strings: disable'
+ self.check('---\n'
+ 'foo: bar\n', conf)
+ self.check('---\n'
+ 'foo: "bar"\n', conf)
+ self.check('---\n'
+ 'foo: \'bar\'\n', conf)
+ self.check('---\n'
+ 'bar: 123\n', conf)
+
+ def test_quote_type_any(self):
+ conf = 'quoted-strings: {quote-type: any}\n'
+ self.check('---\n'
+ 'boolean1: true\n'
+ 'number1: 123\n'
+ 'string1: foo\n' # fails
+ 'string2: "foo"\n'
+ 'string3: \'bar\'\n'
+ 'string4: !!str genericstring\n'
+ 'string5: !!str 456\n'
+ 'string6: !!str "quotedgenericstring"\n'
+ 'binary: !!binary binstring\n'
+ 'integer: !!int intstring\n'
+ 'boolean2: !!bool boolstring\n'
+ 'boolean3: !!bool "quotedboolstring"\n',
+ conf, problem=(4, 10))
+ self.check('---\n'
+ 'multiline string 1: |\n'
+ ' line 1\n'
+ ' line 2\n'
+ 'multiline string 2: >\n'
+ ' word 1\n'
+ ' word 2\n'
+ 'multiline string 3:\n'
+ ' word 1\n'
+ ' word 2\n'
+ 'multiline string 4:\n'
+ ' "word 1\\\n'
+ ' word 2"\n',
+ conf, problem1=(9, 3))
+
+ def test_quote_type_single(self):
+ conf = 'quoted-strings: {quote-type: single}\n'
+ self.check('---\n'
+ 'boolean1: true\n'
+ 'number1: 123\n'
+ 'string1: foo\n' # fails
+ 'string2: "foo"\n' # fails
+ 'string3: \'bar\'\n'
+ 'string4: !!str genericstring\n'
+ 'string5: !!str 456\n'
+ 'string6: !!str "quotedgenericstring"\n'
+ 'binary: !!binary binstring\n'
+ 'integer: !!int intstring\n'
+ 'boolean2: !!bool boolstring\n'
+ 'boolean3: !!bool "quotedboolstring"\n',
+ conf, problem1=(4, 10), problem2=(5, 10))
+ self.check('---\n'
+ 'multiline string 1: |\n'
+ ' line 1\n'
+ ' line 2\n'
+ 'multiline string 2: >\n'
+ ' word 1\n'
+ ' word 2\n'
+ 'multiline string 3:\n'
+ ' word 1\n'
+ ' word 2\n'
+ 'multiline string 4:\n'
+ ' "word 1\\\n'
+ ' word 2"\n',
+ conf, problem1=(9, 3), problem2=(12, 3))
+
+ def test_quote_type_double(self):
+ conf = 'quoted-strings: {quote-type: double}\n'
+ self.check('---\n'
+ 'boolean1: true\n'
+ 'number1: 123\n'
+ 'string1: foo\n' # fails
+ 'string2: "foo"\n'
+ 'string3: \'bar\'\n' # fails
+ 'string4: !!str genericstring\n'
+ 'string5: !!str 456\n'
+ 'string6: !!str "quotedgenericstring"\n'
+ 'binary: !!binary binstring\n'
+ 'integer: !!int intstring\n'
+ 'boolean2: !!bool boolstring\n'
+ 'boolean3: !!bool "quotedboolstring"\n',
+ conf, problem1=(4, 10), problem2=(6, 10))
+ self.check('---\n'
+ 'multiline string 1: |\n'
+ ' line 1\n'
+ ' line 2\n'
+ 'multiline string 2: >\n'
+ ' word 1\n'
+ ' word 2\n'
+ 'multiline string 3:\n'
+ ' word 1\n'
+ ' word 2\n'
+ 'multiline string 4:\n'
+ ' "word 1\\\n'
+ ' word 2"\n',
+ conf, problem1=(9, 3))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/tests/test_cli.py new/yamllint-1.13.0/tests/test_cli.py
--- old/yamllint-1.11.1/tests/test_cli.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/tests/test_cli.py 2018-11-14 19:10:16.000000000 +0100
@@ -351,7 +351,7 @@
'\n' % file))
self.assertEqual(err, '')
- def test_run_colored_output(self):
+ def test_run_default_format_output_in_tty(self):
file = os.path.join(self.wd, 'a.yaml')
# Create a pseudo-TTY and redirect stdout to it
@@ -383,3 +383,59 @@
'no new line character at the end of file '
'\033[2m(new-line-at-end-of-file)\033[0m\n'
'\n' % file))
+
+ def test_run_default_format_output_without_tty(self):
+ file = os.path.join(self.wd, 'a.yaml')
+
+ sys.stdout, sys.stderr = StringIO(), StringIO()
+ with self.assertRaises(SystemExit) as ctx:
+ cli.run((file, ))
+
+ self.assertEqual(ctx.exception.code, 1)
+
+ out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
+ self.assertEqual(out, (
+ '%s\n'
+ ' 2:4 error trailing spaces (trailing-spaces)\n'
+ ' 3:4 error no new line character at the end of file '
+ '(new-line-at-end-of-file)\n'
+ '\n' % file))
+ self.assertEqual(err, '')
+
+ def test_run_auto_output_without_tty_output(self):
+ file = os.path.join(self.wd, 'a.yaml')
+
+ sys.stdout, sys.stderr = StringIO(), StringIO()
+ with self.assertRaises(SystemExit) as ctx:
+ cli.run((file, '--format', 'auto'))
+
+ self.assertEqual(ctx.exception.code, 1)
+
+ out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
+ self.assertEqual(out, (
+ '%s\n'
+ ' 2:4 error trailing spaces (trailing-spaces)\n'
+ ' 3:4 error no new line character at the end of file '
+ '(new-line-at-end-of-file)\n'
+ '\n' % file))
+ self.assertEqual(err, '')
+
+ def test_run_format_colored(self):
+ file = os.path.join(self.wd, 'a.yaml')
+
+ sys.stdout, sys.stderr = StringIO(), StringIO()
+ with self.assertRaises(SystemExit) as ctx:
+ cli.run((file, '--format', 'colored'))
+
+ self.assertEqual(ctx.exception.code, 1)
+
+ out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
+ self.assertEqual(out, (
+ '\033[4m%s\033[0m\n'
+ ' \033[2m2:4\033[0m \033[31merror\033[0m '
+ 'trailing spaces \033[2m(trailing-spaces)\033[0m\n'
+ ' \033[2m3:4\033[0m \033[31merror\033[0m '
+ 'no new line character at the end of file '
+ '\033[2m(new-line-at-end-of-file)\033[0m\n'
+ '\n' % file))
+ self.assertEqual(err, '')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/__init__.py new/yamllint-1.13.0/yamllint/__init__.py
--- old/yamllint-1.11.1/yamllint/__init__.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/__init__.py 2018-11-14 19:10:16.000000000 +0100
@@ -22,7 +22,7 @@
APP_NAME = 'yamllint'
-APP_VERSION = '1.11.1'
+APP_VERSION = '1.13.0'
APP_DESCRIPTION = __doc__
__author__ = u'Adrien Vergé'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/cli.py new/yamllint-1.13.0/yamllint/cli.py
--- old/yamllint-1.11.1/yamllint/cli.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/cli.py 2018-11-14 19:10:16.000000000 +0100
@@ -96,8 +96,8 @@
action='store',
help='custom configuration (as YAML source)')
parser.add_argument('-f', '--format',
- choices=('parsable', 'standard'), default='standard',
- help='format for parsing output')
+ choices=('parsable', 'standard', 'colored', 'auto'),
+ default='auto', help='format for parsing output')
parser.add_argument('-s', '--strict',
action='store_true',
help='return non-zero exit code on warnings '
@@ -143,7 +143,8 @@
for problem in linter.run(f, conf, filepath):
if args.format == 'parsable':
print(Format.parsable(problem, file))
- elif supports_color():
+ elif args.format == 'colored' or \
+ (args.format == 'auto' and supports_color()):
if first:
print('\033[4m%s\033[0m' % file)
first = False
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/conf/default.yaml new/yamllint-1.13.0/yamllint/conf/default.yaml
--- old/yamllint-1.11.1/yamllint/conf/default.yaml 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/conf/default.yaml 2018-11-14 19:10:16.000000000 +0100
@@ -32,6 +32,7 @@
max: 2
max-start: 0
max-end: 0
+ quoted-strings: disable
empty-values:
forbid-in-block-mappings: false
forbid-in-flow-mappings: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/config.py new/yamllint-1.13.0/yamllint/config.py
--- old/yamllint-1.11.1/yamllint/config.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/config.py 2018-11-14 19:10:16.000000000 +0100
@@ -52,7 +52,7 @@
assert isinstance(base_config, YamlLintConfig)
for rule in self.rules:
- if (type(self.rules[rule]) == dict and
+ if (isinstance(self.rules[rule], dict) and
rule in base_config.rules and
base_config.rules[rule] is not False):
base_config.rules[rule].update(self.rules[rule])
@@ -70,7 +70,7 @@
except Exception as e:
raise YamlLintConfigError('invalid config: %s' % e)
- if type(conf) != dict:
+ if not isinstance(conf, dict):
raise YamlLintConfigError('invalid config: not a dict')
self.rules = conf.get('rules', {})
@@ -85,7 +85,7 @@
raise YamlLintConfigError('invalid config: %s' % e)
if 'ignore' in conf:
- if type(conf['ignore']) != str:
+ if not isinstance(conf['ignore'], str):
raise YamlLintConfigError(
'invalid config: ignore should contain file patterns')
self.ignore = pathspec.PathSpec.from_lines(
@@ -107,10 +107,10 @@
elif conf == 'enable':
conf = {}
- if type(conf) == dict:
+ if isinstance(conf, dict):
if ('ignore' in conf and
- type(conf['ignore']) != pathspec.pathspec.PathSpec):
- if type(conf['ignore']) != str:
+ not isinstance(conf['ignore'], pathspec.pathspec.PathSpec)):
+ if not isinstance(conf['ignore'], str):
raise YamlLintConfigError(
'invalid config: ignore should contain file patterns')
conf['ignore'] = pathspec.PathSpec.from_lines(
@@ -130,14 +130,14 @@
raise YamlLintConfigError(
'invalid config: unknown option "%s" for rule "%s"' %
(optkey, rule.ID))
- if type(options[optkey]) == tuple:
+ if isinstance(options[optkey], tuple):
if (conf[optkey] not in options[optkey] and
type(conf[optkey]) not in options[optkey]):
raise YamlLintConfigError(
'invalid config: option "%s" of "%s" should be in %s'
% (optkey, rule.ID, options[optkey]))
else:
- if type(conf[optkey]) != options[optkey]:
+ if not isinstance(conf[optkey], options[optkey]):
raise YamlLintConfigError(
'invalid config: option "%s" of "%s" should be %s'
% (optkey, rule.ID, options[optkey].__name__))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/linter.py new/yamllint-1.13.0/yamllint/linter.py
--- old/yamllint-1.11.1/yamllint/linter.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/linter.py 2018-11-14 19:10:16.000000000 +0100
@@ -226,7 +226,7 @@
if conf.is_file_ignored(filepath):
return ()
- if type(input) in (type(b''), type(u'')): # compat with Python 2 & 3
+ if isinstance(input, (type(b''), type(u''))): # compat with Python 2 & 3
return _run(input, conf, filepath)
elif hasattr(input, 'read'): # Python 2's file or Python 3's io.IOBase
# We need to have everything in memory to parse correctly
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/rules/__init__.py new/yamllint-1.13.0/yamllint/rules/__init__.py
--- old/yamllint-1.11.1/yamllint/rules/__init__.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/rules/__init__.py 2018-11-14 19:10:16.000000000 +0100
@@ -33,6 +33,7 @@
new_line_at_end_of_file,
new_lines,
octal_values,
+ quoted_strings,
trailing_spaces,
truthy,
)
@@ -56,6 +57,7 @@
new_line_at_end_of_file.ID: new_line_at_end_of_file,
new_lines.ID: new_lines,
octal_values.ID: octal_values,
+ quoted_strings.ID: quoted_strings,
trailing_spaces.ID: trailing_spaces,
truthy.ID: truthy,
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/rules/document_end.py new/yamllint-1.13.0/yamllint/rules/document_end.py
--- old/yamllint-1.11.1/yamllint/rules/document_end.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/rules/document_end.py 2018-11-14 19:10:16.000000000 +0100
@@ -86,14 +86,16 @@
def check(conf, token, prev, next, nextnext, context):
if conf['present']:
- if (isinstance(token, yaml.StreamEndToken) and
- not (isinstance(prev, yaml.DocumentEndToken) or
- isinstance(prev, yaml.StreamStartToken))):
+ is_stream_end = isinstance(token, yaml.StreamEndToken)
+ is_start = isinstance(token, yaml.DocumentStartToken)
+ prev_is_end_or_stream_start = isinstance(
+ prev, (yaml.DocumentEndToken, yaml.StreamStartToken)
+ )
+
+ if is_stream_end and not prev_is_end_or_stream_start:
yield LintProblem(token.start_mark.line, 1,
'missing document end "..."')
- elif (isinstance(token, yaml.DocumentStartToken) and
- not (isinstance(prev, yaml.DocumentEndToken) or
- isinstance(prev, yaml.StreamStartToken))):
+ elif is_start and not prev_is_end_or_stream_start:
yield LintProblem(token.start_mark.line + 1, 1,
'missing document end "..."')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/rules/indentation.py new/yamllint-1.13.0/yamllint/rules/indentation.py
--- old/yamllint-1.11.1/yamllint/rules/indentation.py 2018-04-06 11:12:20.000000000 +0200
+++ new/yamllint-1.13.0/yamllint/rules/indentation.py 2018-11-14 19:10:16.000000000 +0100
@@ -224,7 +224,7 @@
def compute_expected_indent(found_indent):
def detect_indent(base_indent):
- if type(context['spaces']) is not int:
+ if not isinstance(context['spaces'], int):
context['spaces'] = found_indent - base_indent
return base_indent + context['spaces']
@@ -312,7 +312,7 @@
token.start_mark.line + 1 > context['cur_line'])
def detect_indent(base_indent, next):
- if type(context['spaces']) is not int:
+ if not isinstance(context['spaces'], int):
context['spaces'] = next.start_mark.column - base_indent
return base_indent + context['spaces']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint/rules/quoted_strings.py new/yamllint-1.13.0/yamllint/rules/quoted_strings.py
--- old/yamllint-1.11.1/yamllint/rules/quoted_strings.py 1970-01-01 01:00:00.000000000 +0100
+++ new/yamllint-1.13.0/yamllint/rules/quoted_strings.py 2018-11-14 19:10:16.000000000 +0100
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2018 ClearScore
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+
+"""
+Use this rule to forbid any string values that are not quoted.
+You can also enforce the type of the quote used using the ``quote-type`` option
+(``single``, ``double`` or ``any``).
+
+**Note**: Multi-line strings (with ``|`` or ``>``) will not be checked.
+
+.. rubric:: Examples
+
+#. With ``quoted-strings: {quote-type: any}``
+
+ the following code snippet would **PASS**:
+ ::
+
+ foo: "bar"
+ bar: 'foo'
+ number: 123
+ boolean: true
+
+ the following code snippet would **FAIL**:
+ ::
+
+ foo: bar
+"""
+
+import yaml
+
+from yamllint.linter import LintProblem
+
+ID = 'quoted-strings'
+TYPE = 'token'
+CONF = {'quote-type': ('any', 'single', 'double')}
+
+
+def check(conf, token, prev, next, nextnext, context):
+ quote_type = conf['quote-type']
+
+ if (isinstance(token, yaml.tokens.ScalarToken) and
+ isinstance(prev, (yaml.ValueToken, yaml.TagToken))):
+ # Ignore explicit types, e.g. !!str testtest or !!int 42
+ if (prev and isinstance(prev, yaml.tokens.TagToken) and
+ prev.value[0] == '!!'):
+ return
+
+ # Ignore numbers, booleans, etc.
+ resolver = yaml.resolver.Resolver()
+ if resolver.resolve(yaml.nodes.ScalarNode, token.value,
+ (True, False)) != 'tag:yaml.org,2002:str':
+ return
+
+ # Ignore multi-line strings
+ if (not token.plain) and (token.style == "|" or token.style == ">"):
+ return
+
+ if ((quote_type == 'single' and token.style != "'") or
+ (quote_type == 'double' and token.style != '"') or
+ (quote_type == 'any' and token.style is None)):
+ yield LintProblem(
+ token.start_mark.line + 1,
+ token.start_mark.column + 1,
+ "string value is not quoted with %s quotes" % (quote_type))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint.egg-info/PKG-INFO new/yamllint-1.13.0/yamllint.egg-info/PKG-INFO
--- old/yamllint-1.11.1/yamllint.egg-info/PKG-INFO 2018-04-06 11:14:37.000000000 +0200
+++ new/yamllint-1.13.0/yamllint.egg-info/PKG-INFO 2018-11-14 19:10:45.000000000 +0100
@@ -1,12 +1,11 @@
Metadata-Version: 1.1
Name: yamllint
-Version: 1.11.1
+Version: 1.13.0
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Vergé
Author-email: UNKNOWN
License: GPLv3
-Description-Content-Type: UNKNOWN
Description: A linter for YAML files.
yamllint does not only check for syntax validity, but for weirdnesses like key
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yamllint-1.11.1/yamllint.egg-info/SOURCES.txt new/yamllint-1.13.0/yamllint.egg-info/SOURCES.txt
--- old/yamllint-1.11.1/yamllint.egg-info/SOURCES.txt 2018-04-06 11:14:37.000000000 +0200
+++ new/yamllint-1.13.0/yamllint.egg-info/SOURCES.txt 2018-11-14 19:10:45.000000000 +0100
@@ -44,6 +44,7 @@
tests/rules/test_new_line_at_end_of_file.py
tests/rules/test_new_lines.py
tests/rules/test_octal_values.py
+tests/rules/test_quoted_strings.py
tests/rules/test_trailing_spaces.py
tests/rules/test_truthy.py
tests/yaml-1.2-spec-examples/example-10.1
@@ -212,5 +213,6 @@
yamllint/rules/new_line_at_end_of_file.py
yamllint/rules/new_lines.py
yamllint/rules/octal_values.py
+yamllint/rules/quoted_strings.py
yamllint/rules/trailing_spaces.py
yamllint/rules/truthy.py
\ No newline at end of file