Hello community,
here is the log from the commit of package python-yamllint for openSUSE:Factory
checked in at 2020-02-05 19:41:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-yamllint (Old)
and /work/SRC/openSUSE:Factory/.python-yamllint.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-yamllint"
Wed Feb 5 19:41:50 2020 rev:8 rq:770066 version:1.20.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-yamllint/python-yamllint.changes
2019-10-31 18:18:22.842204640 +0100
+++
/work/SRC/openSUSE:Factory/.python-yamllint.new.26092/python-yamllint.changes
2020-02-05 19:41:51.847272327 +0100
@@ -1,0 +2,8 @@
+Tue Feb 4 16:00:48 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 1.20.0
+ * Add --no-warnings option to suppress warning messages
+ * Use 'syntax' as rule name upon syntax errors
+ * Allow disabling all checks for a file with # yamllint disable-file
+
+-------------------------------------------------------------------
Old:
----
yamllint-1.18.0.tar.gz
New:
----
yamllint-1.20.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-yamllint.spec ++++++
--- /var/tmp/diff_new_pack.TWzlyd/_old 2020-02-05 19:41:52.967272861 +0100
+++ /var/tmp/diff_new_pack.TWzlyd/_new 2020-02-05 19:41:52.983272869 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-yamllint
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-yamllint
-Version: 1.18.0
+Version: 1.20.0
Release: 0
Summary: A linter for YAML files
License: GPL-3.0-only
++++++ yamllint-1.18.0.tar.gz -> yamllint-1.20.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/PKG-INFO new/yamllint-1.20.0/PKG-INFO
--- old/yamllint-1.18.0/PKG-INFO 2019-10-15 09:50:07.000000000 +0200
+++ new/yamllint-1.20.0/PKG-INFO 2019-12-26 16:07:34.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: yamllint
-Version: 1.18.0
+Version: 1.20.0
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Vergé
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/docs/configuration.rst
new/yamllint-1.20.0/docs/configuration.rst
--- old/yamllint-1.18.0/docs/configuration.rst 2019-10-15 09:41:40.000000000
+0200
+++ new/yamllint-1.20.0/docs/configuration.rst 2019-12-12 09:13:16.000000000
+0100
@@ -116,6 +116,9 @@
* ``1`` if one or more errors occur
* ``2`` if no errors occur, but one or more warnings occur
+If the script is invoked with the ``--no-warnings`` option, it won't output
+warning level problems, only error level ones.
+
YAML files extensions
---------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/docs/disable_with_comments.rst
new/yamllint-1.20.0/docs/disable_with_comments.rst
--- old/yamllint-1.18.0/docs/disable_with_comments.rst 2019-01-11
12:00:07.000000000 +0100
+++ new/yamllint-1.20.0/docs/disable_with_comments.rst 2019-12-12
09:07:45.000000000 +0100
@@ -73,3 +73,31 @@
If you need to disable multiple rules, it is allowed to chain rules like this:
``# yamllint disable rule:hyphens rule:commas rule:indentation``.
+
+Disabling all checks for a file
+-------------------------------
+
+To prevent yamllint from reporting problems for a specific file, add the
+directive comment ``# yamllint disable-file`` as the first line of the file.
+For instance:
+
+.. code-block:: yaml
+
+ # yamllint disable-file
+ # The following mapping contains the same key twice, but I know what I'm
doing:
+ key: value 1
+ key: value 2
+
+ - This line is waaaaaaaaaay too long but yamllint will not report anything
about it.
+ This line will be checked by yamllint.
+
+or:
+
+.. code-block:: jinja
+
+ # yamllint disable-file
+ # This file is not valid YAML because it is a Jinja template
+ {% if extra_info %}
+ key1: value1
+ {% endif %}
+ key2: value2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/tests/test_cli.py
new/yamllint-1.20.0/tests/test_cli.py
--- old/yamllint-1.18.0/tests/test_cli.py 2019-08-12 16:53:44.000000000
+0200
+++ new/yamllint-1.20.0/tests/test_cli.py 2019-12-26 16:04:47.000000000
+0100
@@ -530,5 +530,40 @@
out, err = sys.stdout.getvalue(), sys.stderr.getvalue()
self.assertEqual(out, (
'stdin:2:10: [error] syntax error: '
- 'mapping values are not allowed here\n'))
+ 'mapping values are not allowed here (syntax)\n'))
self.assertEqual(err, '')
+
+ def test_run_no_warnings(self):
+ file = os.path.join(self.wd, 'a.yaml')
+
+ sys.stdout, sys.stderr = StringIO(), StringIO()
+ with self.assertRaises(SystemExit) as ctx:
+ cli.run((file, '--no-warnings', '-f', '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, '')
+
+ file = os.path.join(self.wd, 'warn.yaml')
+
+ sys.stdout, sys.stderr = StringIO(), StringIO()
+ with self.assertRaises(SystemExit) as ctx:
+ cli.run((file, '--no-warnings', '-f', 'auto'))
+
+ self.assertEqual(ctx.exception.code, 0)
+
+ def test_run_no_warnings_and_strict(self):
+ file = os.path.join(self.wd, 'warn.yaml')
+
+ sys.stdout, sys.stderr = StringIO(), StringIO()
+ with self.assertRaises(SystemExit) as ctx:
+ cli.run((file, '--no-warnings', '-s'))
+
+ self.assertEqual(ctx.exception.code, 2)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/tests/test_yamllint_directives.py
new/yamllint-1.20.0/tests/test_yamllint_directives.py
--- old/yamllint-1.18.0/tests/test_yamllint_directives.py 2017-02-06
14:21:06.000000000 +0100
+++ new/yamllint-1.20.0/tests/test_yamllint_directives.py 2019-12-12
09:07:45.000000000 +0100
@@ -302,3 +302,104 @@
' c: [x]\n',
conf,
problem=(6, 2, 'comments-indentation'))
+
+ def test_disable_file_directive(self):
+ conf = ('comments: {min-spaces-from-content: 2}\n'
+ 'comments-indentation: {}\n')
+ self.check('# yamllint disable-file\n'
+ '---\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf)
+ self.check('# yamllint disable-file\n'
+ '---\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf)
+ self.check('#yamllint disable-file\n'
+ '---\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf)
+ self.check('#yamllint disable-file \n'
+ '---\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf)
+ self.check('---\n'
+ '# yamllint disable-file\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf,
+ problem1=(3, 8, 'comments'),
+ problem2=(5, 2, 'comments-indentation'))
+ self.check('# yamllint disable-file: rules cannot be specified\n'
+ '---\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf,
+ problem1=(3, 8, 'comments'),
+ problem2=(5, 2, 'comments-indentation'))
+ self.check('AAAA yamllint disable-file\n'
+ '---\n'
+ '- a: 1 # comment too close\n'
+ ' b:\n'
+ ' # wrong indentation\n'
+ ' c: [x]\n',
+ conf,
+ problem1=(1, 1, 'document-start'),
+ problem2=(3, 8, 'comments'),
+ problem3=(5, 2, 'comments-indentation'))
+
+ def test_disable_file_directive_not_at_first_position(self):
+ self.check('# yamllint disable-file\n'
+ '---\n'
+ '- bad : colon and spaces \n',
+ self.conf)
+ self.check('---\n'
+ '# yamllint disable-file\n'
+ '- bad : colon and spaces \n',
+ self.conf,
+ problem1=(3, 7, 'colons'),
+ problem2=(3, 26, 'trailing-spaces'))
+
+ def test_disable_file_directive_with_syntax_error(self):
+ self.check('# This file is not valid YAML (it is a Jinja template)\n'
+ '{% if extra_info %}\n'
+ 'key1: value1\n'
+ '{% endif %}\n'
+ 'key2: value2\n',
+ self.conf,
+ problem=(2, 2, 'syntax'))
+ self.check('# yamllint disable-file\n'
+ '# This file is not valid YAML (it is a Jinja template)\n'
+ '{% if extra_info %}\n'
+ 'key1: value1\n'
+ '{% endif %}\n'
+ 'key2: value2\n',
+ self.conf)
+
+ def test_disable_file_directive_with_dos_lines(self):
+ self.check('# yamllint disable-file\r\n'
+ '---\r\n'
+ '- bad : colon and spaces \r\n',
+ self.conf)
+ self.check('# yamllint disable-file\r\n'
+ '# This file is not valid YAML (it is a Jinja template)\r\n'
+ '{% if extra_info %}\r\n'
+ 'key1: value1\r\n'
+ '{% endif %}\r\n'
+ 'key2: value2\r\n',
+ self.conf)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/yamllint/__init__.py
new/yamllint-1.20.0/yamllint/__init__.py
--- old/yamllint-1.18.0/yamllint/__init__.py 2019-10-15 09:49:16.000000000
+0200
+++ new/yamllint-1.20.0/yamllint/__init__.py 2019-12-26 16:06:16.000000000
+0100
@@ -22,7 +22,7 @@
APP_NAME = 'yamllint'
-APP_VERSION = '1.18.0'
+APP_VERSION = '1.20.0'
APP_DESCRIPTION = __doc__
__author__ = u'Adrien Vergé'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/yamllint/cli.py
new/yamllint-1.20.0/yamllint/cli.py
--- old/yamllint-1.18.0/yamllint/cli.py 2019-10-15 09:41:40.000000000 +0200
+++ new/yamllint-1.20.0/yamllint/cli.py 2019-12-12 09:13:16.000000000 +0100
@@ -84,11 +84,14 @@
return line
-def show_problems(problems, file, args_format):
+def show_problems(problems, file, args_format, no_warn):
max_level = 0
first = True
for problem in problems:
+ max_level = max(max_level, PROBLEM_LEVELS[problem.level])
+ if no_warn and (problem.level != 'error'):
+ continue
if args_format == 'parsable':
print(Format.parsable(problem, file))
elif args_format == 'colored' or \
@@ -102,7 +105,6 @@
print(file)
first = False
print(Format.standard(problem, file))
- max_level = max(max_level, PROBLEM_LEVELS[problem.level])
if not first and args_format != 'parsable':
print('')
@@ -133,6 +135,9 @@
action='store_true',
help='return non-zero exit code on warnings '
'as well as errors')
+ parser.add_argument('--no-warnings',
+ action='store_true',
+ help='output only error level problems')
parser.add_argument('-v', '--version', action='version',
version='{} {}'.format(APP_NAME, APP_VERSION))
@@ -176,7 +181,8 @@
except EnvironmentError as e:
print(e, file=sys.stderr)
sys.exit(-1)
- prob_level = show_problems(problems, file, args_format=args.format)
+ prob_level = show_problems(problems, file, args_format=args.format,
+ no_warn=args.no_warnings)
max_level = max(max_level, prob_level)
# read yaml from stdin
@@ -186,7 +192,8 @@
except EnvironmentError as e:
print(e, file=sys.stderr)
sys.exit(-1)
- prob_level = show_problems(problems, 'stdin', args_format=args.format)
+ prob_level = show_problems(problems, 'stdin', args_format=args.format,
+ no_warn=args.no_warnings)
max_level = max(max_level, prob_level)
if max_level == PROBLEM_LEVELS['error']:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/yamllint/linter.py
new/yamllint-1.20.0/yamllint/linter.py
--- old/yamllint-1.18.0/yamllint/linter.py 2019-01-11 12:00:07.000000000
+0100
+++ new/yamllint-1.20.0/yamllint/linter.py 2019-12-26 16:04:47.000000000
+0100
@@ -180,7 +180,7 @@
except yaml.error.MarkedYAMLError as e:
problem = LintProblem(e.problem_mark.line + 1,
e.problem_mark.column + 1,
- 'syntax error: ' + e.problem)
+ 'syntax error: ' + e.problem + ' (syntax)')
problem.level = 'error'
return problem
@@ -189,6 +189,10 @@
assert hasattr(buffer, '__getitem__'), \
'_run() argument must be a buffer, not a stream'
+ first_line = next(parser.line_generator(buffer)).content
+ if re.match(r'^#\s*yamllint disable-file\s*$', first_line):
+ return
+
# If the document contains a syntax error, save it and yield it at the
# right line
syntax_error = get_syntax_error(buffer)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.18.0/yamllint.egg-info/PKG-INFO
new/yamllint-1.20.0/yamllint.egg-info/PKG-INFO
--- old/yamllint-1.18.0/yamllint.egg-info/PKG-INFO 2019-10-15
09:50:06.000000000 +0200
+++ new/yamllint-1.20.0/yamllint.egg-info/PKG-INFO 2019-12-26
16:07:34.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: yamllint
-Version: 1.18.0
+Version: 1.20.0
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Vergé