Hello community,
here is the log from the commit of package python-yamllint for openSUSE:Factory
checked in at 2020-07-21 15:51:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-yamllint (Old)
and /work/SRC/openSUSE:Factory/.python-yamllint.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-yamllint"
Tue Jul 21 15:51:16 2020 rev:11 rq:822075 version:1.24.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-yamllint/python-yamllint.changes
2020-07-08 19:12:57.415101363 +0200
+++
/work/SRC/openSUSE:Factory/.python-yamllint.new.3592/python-yamllint.changes
2020-07-21 15:54:30.652596834 +0200
@@ -1,0 +2,11 @@
+Tue Jul 21 11:03:17 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 1.24.2
+ * Add ``locale`` config option and make ``key-ordering`` locale-aware
+ * Revert ``locale`` config option from version 1.24.0 because of a bug
+ * Specify config with environment variable ``YAMLLINT_CONFIG_FILE``
+ * Fix bug with CRLF in ``new-lines`` and ``require-starting-space``
+ * Do not run linter on directories whose names look like YAML files
+ * Add ``locale`` config option and make ``key-ordering`` locale-aware
+
+-------------------------------------------------------------------
Old:
----
yamllint-1.23.0.tar.gz
New:
----
yamllint-1.24.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-yamllint.spec ++++++
--- /var/tmp/diff_new_pack.o8DEmX/_old 2020-07-21 15:54:33.188599918 +0200
+++ /var/tmp/diff_new_pack.o8DEmX/_new 2020-07-21 15:54:33.188599918 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-yamllint
-Version: 1.23.0
+Version: 1.24.2
Release: 0
Summary: A linter for YAML files
License: GPL-3.0-only
++++++ yamllint-1.23.0.tar.gz -> yamllint-1.24.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/PKG-INFO new/yamllint-1.24.2/PKG-INFO
--- old/yamllint-1.23.0/PKG-INFO 2020-04-17 10:34:16.000000000 +0200
+++ new/yamllint-1.24.2/PKG-INFO 2020-07-16 09:35:38.630434000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: yamllint
-Version: 1.23.0
+Version: 1.24.2
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Vergé
@@ -23,6 +23,7 @@
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Quality Assurance
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/docs/conf.py
new/yamllint-1.24.2/docs/conf.py
--- old/yamllint-1.23.0/docs/conf.py 2019-02-14 18:17:12.000000000 +0100
+++ new/yamllint-1.24.2/docs/conf.py 2020-07-08 16:27:16.000000000 +0200
@@ -6,9 +6,9 @@
import os
from unittest.mock import MagicMock
-sys.path.insert(0, os.path.abspath('..')) # noqa
+sys.path.insert(0, os.path.abspath('..'))
-from yamllint import __copyright__, APP_NAME, APP_VERSION
+from yamllint import __copyright__, APP_NAME, APP_VERSION # noqa
# -- General configuration ------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/docs/configuration.rst
new/yamllint-1.24.2/docs/configuration.rst
--- old/yamllint-1.23.0/docs/configuration.rst 2019-12-12 09:13:16.000000000
+0100
+++ new/yamllint-1.24.2/docs/configuration.rst 2020-07-16 09:34:22.000000000
+0200
@@ -16,6 +16,7 @@
- ``.yamllint``, ``.yamllint.yaml`` or ``.yamllint.yml`` in the current working
directory
+- the file referenced by ``$YAMLLINT_CONFIG_FILE``, if set
- ``$XDG_CONFIG_HOME/yamllint/config``
- ``~/.config/yamllint/config``
@@ -188,3 +189,22 @@
ignore: |
*.ignore-trailing-spaces.yaml
ascii-art/*
+
+Setting the locale
+------------------
+
+It is possible to set the ``locale`` option globally. This is passed to
Python's
+`locale.setlocale
+<https://docs.python.org/3/library/locale.html#locale.setlocale>`_,
+so an empty string ``""`` will use the system default locale, while e.g.
+``"en_US.UTF-8"`` will use that.
+
+Currently this only affects the ``key-ordering`` rule. The default will order
+by Unicode code point number, while locales will sort case and accents
+properly as well.
+
+.. code-block:: yaml
+
+ extends: default
+
+ locale: en_US.UTF-8
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/setup.cfg
new/yamllint-1.24.2/setup.cfg
--- old/yamllint-1.23.0/setup.cfg 2020-04-17 10:34:16.000000000 +0200
+++ new/yamllint-1.24.2/setup.cfg 2020-07-16 09:35:38.630434000 +0200
@@ -4,6 +4,7 @@
[flake8]
import-order-style = pep8
application-import-names = yamllint
+ignore = W503,W504
[build_sphinx]
all-files = 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/setup.py new/yamllint-1.24.2/setup.py
--- old/yamllint-1.23.0/setup.py 2019-06-06 09:52:15.000000000 +0200
+++ new/yamllint-1.24.2/setup.py 2020-05-03 16:22:34.000000000 +0200
@@ -42,6 +42,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Topic :: Software Development',
'Topic :: Software Development :: Debuggers',
'Topic :: Software Development :: Quality Assurance',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/tests/rules/test_comments.py
new/yamllint-1.24.2/tests/rules/test_comments.py
--- old/yamllint-1.23.0/tests/rules/test_comments.py 2019-01-14
09:40:49.000000000 +0100
+++ new/yamllint-1.24.2/tests/rules/test_comments.py 2020-05-03
16:22:34.000000000 +0200
@@ -186,6 +186,27 @@
'inline: comment #\n'
'foo: bar\n', conf)
+ def test_empty_comment_crlf_dos_newlines(self):
+ conf = ('comments:\n'
+ ' require-starting-space: true\n'
+ ' min-spaces-from-content: 2\n'
+ 'new-lines:\n'
+ ' type: dos\n')
+ self.check('---\r\n'
+ '# This is paragraph 1.\r\n'
+ '#\r\n'
+ '# This is paragraph 2.\r\n', conf)
+
+ def test_empty_comment_crlf_disabled_newlines(self):
+ conf = ('comments:\n'
+ ' require-starting-space: true\n'
+ ' min-spaces-from-content: 2\n'
+ 'new-lines: disable\n')
+ self.check('---\r\n'
+ '# This is paragraph 1.\r\n'
+ '#\r\n'
+ '# This is paragraph 2.\r\n', conf)
+
def test_first_line(self):
conf = ('comments:\n'
' require-starting-space: true\n'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/tests/rules/test_key_ordering.py
new/yamllint-1.24.2/tests/rules/test_key_ordering.py
--- old/yamllint-1.23.0/tests/rules/test_key_ordering.py 2017-10-16
22:49:56.000000000 +0200
+++ new/yamllint-1.24.2/tests/rules/test_key_ordering.py 2020-07-16
09:34:22.000000000 +0200
@@ -14,6 +14,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import locale
+
from tests.common import RuleTestCase
@@ -103,10 +105,6 @@
'haïr: true\n'
'hais: true\n', conf,
problem=(3, 1))
- self.check('---\n'
- 'haïr: true\n'
- 'hais: true\n', conf,
- problem=(3, 1))
def test_key_tokens_in_flow_sequences(self):
conf = 'key-ordering: enable'
@@ -114,3 +112,39 @@
'[\n'
' key: value, mappings, in, flow: sequence\n'
']\n', conf)
+
+ def test_locale_case(self):
+ self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
+ try:
+ locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
+ except locale.Error:
+ self.skipTest('locale en_US.UTF-8 not available')
+ conf = ('key-ordering: enable')
+ self.check('---\n'
+ 't-shirt: 1\n'
+ 'T-shirt: 2\n'
+ 't-shirts: 3\n'
+ 'T-shirts: 4\n', conf)
+ self.check('---\n'
+ 't-shirt: 1\n'
+ 't-shirts: 2\n'
+ 'T-shirt: 3\n'
+ 'T-shirts: 4\n', conf,
+ problem=(4, 1))
+
+ def test_locale_accents(self):
+ self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
+ try:
+ locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
+ except locale.Error:
+ self.skipTest('locale en_US.UTF-8 not available')
+ conf = ('key-ordering: enable')
+ self.check('---\n'
+ 'hair: true\n'
+ 'haïr: true\n'
+ 'hais: true\n'
+ 'haïssable: true\n', conf)
+ self.check('---\n'
+ 'hais: true\n'
+ 'haïr: true\n', conf,
+ problem=(3, 1))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/tests/rules/test_new_lines.py
new/yamllint-1.24.2/tests/rules/test_new_lines.py
--- old/yamllint-1.23.0/tests/rules/test_new_lines.py 2019-04-09
16:48:10.000000000 +0200
+++ new/yamllint-1.24.2/tests/rules/test_new_lines.py 2020-05-03
16:22:34.000000000 +0200
@@ -40,6 +40,16 @@
self.check('---\ntext\n', conf)
self.check('---\r\ntext\r\n', conf, problem=(1, 4))
+ def test_unix_type_required_st_sp(self):
+ # If we find a CRLF when looking for Unix newlines, yamllint
+ # should always raise, regardless of logic with
+ # require-starting-space.
+ conf = ('new-line-at-end-of-file: disable\n'
+ 'new-lines: {type: unix}\n'
+ 'comments:\n'
+ ' require-starting-space: true\n')
+ self.check('---\r\n#\r\n', conf, problem=(1, 4))
+
def test_dos_type(self):
conf = ('new-line-at-end-of-file: disable\n'
'new-lines: {type: dos}\n')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/tests/test_cli.py
new/yamllint-1.24.2/tests/test_cli.py
--- old/yamllint-1.23.0/tests/test_cli.py 2020-03-31 12:32:06.000000000
+0200
+++ new/yamllint-1.24.2/tests/test_cli.py 2020-07-16 09:34:22.000000000
+0200
@@ -24,6 +24,7 @@
import pty
import shutil
import sys
+import tempfile
import unittest
from tests.common import build_temp_workspace
@@ -72,6 +73,9 @@
# file in dir
'sub/ok.yaml': '---\n'
'key: value\n',
+ # directory that looks like a yaml file
+ 'sub/directory.yaml/not-yaml.txt': '',
+ 'sub/directory.yaml/empty.yml': '',
# file in very nested dir
's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml': '---\n'
'key: value\n'
@@ -91,6 +95,13 @@
# dos line endings yaml
'dos.yml': '---\r\n'
'dos: true',
+ # different key-ordering by locale
+ 'c.yaml': '---\n'
+ 'A: true\n'
+ 'a: true',
+ 'en.yaml': '---\n'
+ 'a: true\n'
+ 'A: true'
})
@classmethod
@@ -104,9 +115,12 @@
self.assertEqual(
sorted(cli.find_files_recursively([self.wd], conf)),
[os.path.join(self.wd, 'a.yaml'),
+ os.path.join(self.wd, 'c.yaml'),
os.path.join(self.wd, 'dos.yml'),
os.path.join(self.wd, 'empty.yml'),
+ os.path.join(self.wd, 'en.yaml'),
os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'),
+ os.path.join(self.wd, 'sub/directory.yaml/empty.yml'),
os.path.join(self.wd, 'sub/ok.yaml'),
os.path.join(self.wd, 'warn.yaml')],
)
@@ -131,6 +145,7 @@
self.assertEqual(
sorted(cli.find_files_recursively(items, conf)),
[os.path.join(self.wd, '/etc/another/file'),
+ os.path.join(self.wd, 'sub/directory.yaml/empty.yml'),
os.path.join(self.wd, 'sub/ok.yaml')],
)
@@ -140,6 +155,8 @@
self.assertEqual(
sorted(cli.find_files_recursively([self.wd], conf)),
[os.path.join(self.wd, 'a.yaml'),
+ os.path.join(self.wd, 'c.yaml'),
+ os.path.join(self.wd, 'en.yaml'),
os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'),
os.path.join(self.wd, 'sub/ok.yaml'),
os.path.join(self.wd, 'warn.yaml')]
@@ -151,7 +168,8 @@
self.assertEqual(
sorted(cli.find_files_recursively([self.wd], conf)),
[os.path.join(self.wd, 'dos.yml'),
- os.path.join(self.wd, 'empty.yml')]
+ os.path.join(self.wd, 'empty.yml'),
+ os.path.join(self.wd, 'sub/directory.yaml/empty.yml')]
)
conf = config.YamlLintConfig('extends: default\n'
@@ -168,11 +186,15 @@
self.assertEqual(
sorted(cli.find_files_recursively([self.wd], conf)),
[os.path.join(self.wd, 'a.yaml'),
+ os.path.join(self.wd, 'c.yaml'),
os.path.join(self.wd, 'dos.yml'),
os.path.join(self.wd, 'empty.yml'),
+ os.path.join(self.wd, 'en.yaml'),
os.path.join(self.wd, 'no-yaml.json'),
os.path.join(self.wd, 'non-ascii/éçäγλνπ¥/utf-8'),
os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'),
+ os.path.join(self.wd, 'sub/directory.yaml/empty.yml'),
+ os.path.join(self.wd, 'sub/directory.yaml/not-yaml.txt'),
os.path.join(self.wd, 'sub/ok.yaml'),
os.path.join(self.wd, 'warn.yaml')]
)
@@ -185,11 +207,15 @@
self.assertEqual(
sorted(cli.find_files_recursively([self.wd], conf)),
[os.path.join(self.wd, 'a.yaml'),
+ os.path.join(self.wd, 'c.yaml'),
os.path.join(self.wd, 'dos.yml'),
os.path.join(self.wd, 'empty.yml'),
+ os.path.join(self.wd, 'en.yaml'),
os.path.join(self.wd, 'no-yaml.json'),
os.path.join(self.wd, 'non-ascii/éçäγλνπ¥/utf-8'),
os.path.join(self.wd, 's/s/s/s/s/s/s/s/s/s/s/s/s/s/s/file.yaml'),
+ os.path.join(self.wd, 'sub/directory.yaml/empty.yml'),
+ os.path.join(self.wd, 'sub/directory.yaml/not-yaml.txt'),
os.path.join(self.wd, 'sub/ok.yaml'),
os.path.join(self.wd, 'warn.yaml')]
)
@@ -285,6 +311,65 @@
cli.run((os.path.join(self.wd, 'a.yaml'), ))
self.assertEqual(ctx.returncode, 1)
+ def test_run_with_user_yamllint_config_file_in_env(self):
+ self.addCleanup(os.environ.__delitem__, 'YAMLLINT_CONFIG_FILE')
+
+ with tempfile.NamedTemporaryFile('w') as f:
+ os.environ['YAMLLINT_CONFIG_FILE'] = f.name
+ f.write('rules: {trailing-spaces: disable}')
+ f.flush()
+ with RunContext(self) as ctx:
+ cli.run((os.path.join(self.wd, 'a.yaml'), ))
+ self.assertEqual(ctx.returncode, 0)
+
+ with tempfile.NamedTemporaryFile('w') as f:
+ os.environ['YAMLLINT_CONFIG_FILE'] = f.name
+ f.write('rules: {trailing-spaces: enable}')
+ f.flush()
+ with RunContext(self) as ctx:
+ cli.run((os.path.join(self.wd, 'a.yaml'), ))
+ self.assertEqual(ctx.returncode, 1)
+
+ def test_run_with_locale(self):
+ # check for availability of locale, otherwise skip the test
+ # reset to default before running the test,
+ # as the first two runs don't use setlocale()
+ try:
+ locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
+ except locale.Error:
+ self.skipTest('locale en_US.UTF-8 not available')
+ locale.setlocale(locale.LC_ALL, (None, None))
+
+ # C + en.yaml should fail
+ with RunContext(self) as ctx:
+ cli.run(('-d', 'rules: { key-ordering: enable }',
+ os.path.join(self.wd, 'en.yaml')))
+ self.assertEqual(ctx.returncode, 1)
+
+ # C + c.yaml should pass
+ with RunContext(self) as ctx:
+ cli.run(('-d', 'rules: { key-ordering: enable }',
+ os.path.join(self.wd, 'c.yaml')))
+ self.assertEqual(ctx.returncode, 0)
+
+ # the next two runs use setlocale() inside,
+ # so we need to clean up afterwards
+ self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
+
+ # en_US + en.yaml should pass
+ with RunContext(self) as ctx:
+ cli.run(('-d', 'locale: en_US.UTF-8\n'
+ 'rules: { key-ordering: enable }',
+ os.path.join(self.wd, 'en.yaml')))
+ self.assertEqual(ctx.returncode, 0)
+
+ # en_US + c.yaml should fail
+ with RunContext(self) as ctx:
+ cli.run(('-d', 'locale: en_US.UTF-8\n'
+ 'rules: { key-ordering: enable }',
+ os.path.join(self.wd, 'c.yaml')))
+ self.assertEqual(ctx.returncode, 1)
+
def test_run_version(self):
with RunContext(self) as ctx:
cli.run(('--version', ))
@@ -345,12 +430,11 @@
# Make sure the default localization conditions on this "system"
# support UTF-8 encoding.
- loc = locale.getlocale()
try:
- locale.setlocale(locale.LC_ALL, 'C.UTF-8')
+ locale.setlocale(locale.LC_ALL, (None, 'UTF-8'))
except locale.Error:
- locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
- self.addCleanup(locale.setlocale, locale.LC_ALL, loc)
+ self.skipTest('no UTF-8 locale available')
+ self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
with RunContext(self) as ctx:
cli.run(('-f', 'parsable', path))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/yamllint/__init__.py
new/yamllint-1.24.2/yamllint/__init__.py
--- old/yamllint-1.23.0/yamllint/__init__.py 2020-04-17 10:30:32.000000000
+0200
+++ new/yamllint-1.24.2/yamllint/__init__.py 2020-07-16 09:34:41.000000000
+0200
@@ -22,7 +22,7 @@
APP_NAME = 'yamllint'
-APP_VERSION = '1.23.0'
+APP_VERSION = '1.24.2'
APP_DESCRIPTION = __doc__
__author__ = u'Adrien Vergé'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/yamllint/cli.py
new/yamllint-1.24.2/yamllint/cli.py
--- old/yamllint-1.23.0/yamllint/cli.py 2020-04-08 11:46:13.000000000 +0200
+++ new/yamllint-1.24.2/yamllint/cli.py 2020-07-16 09:34:22.000000000 +0200
@@ -18,6 +18,7 @@
import argparse
import io
+import locale
import os
import platform
import sys
@@ -144,8 +145,11 @@
args = parser.parse_args(argv)
+ if 'YAMLLINT_CONFIG_FILE' in os.environ:
+ user_global_config = os.path.expanduser(
+ os.environ['YAMLLINT_CONFIG_FILE'])
# User-global config is supposed to be in ~/.config/yamllint/config
- if 'XDG_CONFIG_HOME' in os.environ:
+ elif 'XDG_CONFIG_HOME' in os.environ:
user_global_config = os.path.join(
os.environ['XDG_CONFIG_HOME'], 'yamllint', 'config')
else:
@@ -172,6 +176,9 @@
print(e, file=sys.stderr)
sys.exit(-1)
+ if conf.locale is not None:
+ locale.setlocale(locale.LC_ALL, conf.locale)
+
max_level = 0
for file in find_files_recursively(args.files, conf):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/yamllint/config.py
new/yamllint-1.24.2/yamllint/config.py
--- old/yamllint-1.23.0/yamllint/config.py 2020-04-17 10:30:12.000000000
+0200
+++ new/yamllint-1.24.2/yamllint/config.py 2020-07-16 09:34:22.000000000
+0200
@@ -35,6 +35,8 @@
self.yaml_files = pathspec.PathSpec.from_lines(
'gitwildmatch', ['*.yaml', '*.yml', '.yamllint'])
+ self.locale = None
+
if file is not None:
with open(file) as f:
content = f.read()
@@ -46,7 +48,7 @@
return self.ignore and self.ignore.match_file(filepath)
def is_yaml_file(self, filepath):
- return self.yaml_files.match_file(filepath)
+ return self.yaml_files.match_file(os.path.basename(filepath))
def enabled_rules(self, filepath):
return [yamllint.rules.get(id) for id, val in self.rules.items()
@@ -111,6 +113,12 @@
self.yaml_files = pathspec.PathSpec.from_lines('gitwildmatch',
conf['yaml-files'])
+ if 'locale' in conf:
+ if not isinstance(conf['locale'], str):
+ raise YamlLintConfigError(
+ 'invalid config: locale should be a string')
+ self.locale = conf['locale']
+
def validate(self):
for id in self.rules:
try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/yamllint/rules/comments.py
new/yamllint-1.24.2/yamllint/rules/comments.py
--- old/yamllint-1.23.0/yamllint/rules/comments.py 2019-01-14
09:40:49.000000000 +0100
+++ new/yamllint-1.24.2/yamllint/rules/comments.py 2020-05-03
16:22:34.000000000 +0200
@@ -97,7 +97,9 @@
comment.column_no == 1 and
re.match(r'^!\S', comment.buffer[text_start:])):
return
- elif comment.buffer[text_start] not in (' ', '\n', '\0'):
+ # We can test for both \r and \r\n just by checking first char
+ # \r itself is a valid newline on some older OS.
+ elif comment.buffer[text_start] not in {' ', '\n', '\r', '\x00'}:
column = comment.column_no + text_start - comment.pointer
yield LintProblem(comment.line_no,
column,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/yamllint/rules/key_ordering.py
new/yamllint-1.24.2/yamllint/rules/key_ordering.py
--- old/yamllint-1.23.0/yamllint/rules/key_ordering.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.24.2/yamllint/rules/key_ordering.py 2020-07-16
09:34:22.000000000 +0200
@@ -16,8 +16,10 @@
"""
Use this rule to enforce alphabetical ordering of keys in mappings. The sorting
-order uses the Unicode code point number. As a result, the ordering is
-case-sensitive and not accent-friendly (see examples below).
+order uses the Unicode code point number as a default. As a result, the
+ordering is case-sensitive and not accent-friendly (see examples below).
+This can be changed by setting the global ``locale`` option. This allows to
+sort case and accents properly.
.. rubric:: Examples
@@ -63,8 +65,24 @@
- haïr: true
hais: true
+
+#. With global option ``locale: "en_US.UTF-8"`` and rule ``key-ordering: {}``
+
+ as opposed to before, the following code snippet would now **PASS**:
+ ::
+
+ - t-shirt: 1
+ T-shirt: 2
+ t-shirts: 3
+ T-shirts: 4
+ - hair: true
+ haïr: true
+ hais: true
+ haïssable: true
"""
+from locale import strcoll
+
import yaml
from yamllint.linter import LintProblem
@@ -101,7 +119,8 @@
# 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 any(next.value < key for key in context['stack'][-1].keys):
+ if any(strcoll(next.value, key) < 0
+ for key in context['stack'][-1].keys):
yield LintProblem(
next.start_mark.line + 1, next.start_mark.column + 1,
'wrong ordering of key "%s" in mapping' % next.value)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.23.0/yamllint.egg-info/PKG-INFO
new/yamllint-1.24.2/yamllint.egg-info/PKG-INFO
--- old/yamllint-1.23.0/yamllint.egg-info/PKG-INFO 2020-04-17
10:34:16.000000000 +0200
+++ new/yamllint-1.24.2/yamllint.egg-info/PKG-INFO 2020-07-16
09:35:38.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: yamllint
-Version: 1.23.0
+Version: 1.24.2
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Vergé
@@ -23,6 +23,7 @@
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Quality Assurance