Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-yamllint for openSUSE:Factory
checked in at 2022-04-13 22:15:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-yamllint (Old)
and /work/SRC/openSUSE:Factory/.python-yamllint.new.1900 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-yamllint"
Wed Apr 13 22:15:28 2022 rev:12 rq:969174 version:1.26.3
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-yamllint/python-yamllint.changes
2020-07-21 15:54:30.652596834 +0200
+++
/work/SRC/openSUSE:Factory/.python-yamllint.new.1900/python-yamllint.changes
2022-04-13 22:15:29.552201748 +0200
@@ -1,0 +2,117 @@
+Sun Apr 10 11:26:51 UTC 2022 - Sebastian Wagner <[email protected]>
+
+- Update to version 1.26.3:
+ - Restore setuptools requirement for Python < 3.8
+ This reverts commit 8f68248 "Remove runtime dep 'setuptools' for Python
+ < 3.8". It looks like removing setuptools induces problems on some
+ systems, see for example the linked discussion.
+ Fixes https://github.com/adrienverge/yamllint/issues/380.
+- Update to version 1.26.2:
+ - setup: update python_requires to comply with PEP 345/440
+ According to PEP 345 Requires-Python
+ (https://www.python.org/dev/peps/pep-0345/#requires-python), the value
+ of this field must be a valid Version Specifier
+ (https://www.python.org/dev/peps/pep-0345/#version-specifiers). Which
+ in turn expects this to comply with PEP 440
+ (https://www.python.org/dev/peps/pep-0440/).
+ While not an issue for those that directly use `pip`, this will cause
+ issues for `poetry` users in the next release (if their current stance
+ is maintained). Discussion of the issue and there stance can be found
+ here: https://github.com/python-poetry/poetry/issues/4095.
+- Update to version 1.26.1:
+ - line_length: skip all hash signs starting comment
+ - Remove runtime dep 'setuptools' for Python < 3.8
+ > In recent versions of setuptools and Python, console-script entry
+ points are using stdlib importlib by default, thus setuptools is no
+ longer needed as a runtime dependency.
+ https://github.com/pypa/setuptools/pull/2197
+ https://github.com/pypa/setuptools/blob/main/CHANGES.rst#v4730
+ https://docs.python.org/3/library/importlib.metadata.html
+- Update to version 1.26.0:
+ - quoted-strings: Fix explicit octal recognition
+ PyYAML implements YAML spec version 1.1, not 1.2. Hence, values starting
+ with `0o` are not considered as numbers: they are just strings, so they
+ need quotes when `quoted-strings: {required: true}`.
+ >>> import yaml
+ >>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '100', (True,
False))
+ 'tag:yaml.org,2002:int'
+ >>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '0100', (True,
False))
+ 'tag:yaml.org,2002:int'
+ >>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '0o100', (True,
False))
+ 'tag:yaml.org,2002:str'
+ Let's try to prevent that.
+ Fixes https://github.com/adrienverge/yamllint/issues/351.
+ - End support for Python 2
+ As planned and advertized, yamllint drops support for Python 2 on 2021.
+ - Allow only non-empty brackets/braces
+ We'd like to disallow brackets and braces in our YAML, but there's a
+ catch: the only way to describe an empty array or hash in YAML is to
+ supply an empty one (`[]` or `{}`). Otherwise, the value will be null.
+ This commit adds a `non-empty` option to `forbid` for brackets and
+ braces. When it is set, all flow and sequence mappings will cause errors
+ _except_ for empty ones.
+ - Add support for Python 3.9, drop Python 3.4
+ Add support for Python 3.9 since it was officially released in October
+ and drop support for Python 3.4 since it is end-of-life (EOL).
+ - docs: Add configuration for integration with Arcanist
+- Update to version 1.25.0:
+ - gitignore: Add /.eggs
+ Quick PR to ignore the `/.eggs` folder, which appears to be generated every
+ time the `python setup.py test` command is run.
+ The content of the `./.eggs/README.txt` file:
+ > This directory contains eggs that were downloaded by setuptools to build,
+ > test, and run plug-ins.
+ >
+ > This directory caches those eggs to prevent repeated downloads.
+ >
+ > However, it is safe to delete this directory.
+ - directives: Fix DOS lines messing with rule IDs
+ Fixes #325
+ The linter allows a directive to contain trailing whitespace characters like
+
+, but does not trim them before iterating on the rules. As a result, the last
+ rule in the list contains the trailing whitespace characters and never
matches
+ any existing rule.
+ I added the necessary trimming, as well as a test with 2 checks to go along
+ with it.
+ - Auto-change output format if GitHub Actions detected
+ - Add support for GitHub Annotations output format
+ Support the format used by GitHub Actions to annotate pull
+ requests with linter failures
+ - fix: add runtime dependency to setuptools
+ yamllint depends on pkg_resources.load_entry_point from setuptools to
+ make its command working, so this runtime dependency to setuptools is
+ necessary to be listed.
+ - Add 'forbid' configurations to the braces and brackets rules
+ Add 'forbid' configuration parameters to the braces and brackets rules
+ to allow users to forbid the use of flow style collections, flow
+ mappings and flow sequences.
+ - quoted-strings: Fix detecting strings with hashtag as requiring quotes
+ - octal-values: Prevent detection of 8 and 9 as octal values
+ - docs: Make 'yaml-file' config documentation clearer
+ Related to https://github.com/adrienverge/yamllint/issues/311.
+ - enhancement: add some metadata to provide extra info in its PyPI page
+ Add some metadata (project_urls) to provide extra info in its PyPI page.
+ Signed-off-by: Satoru SATOH <[email protected]>
+ - Move setuptools' packaging configuration from setup.py to setup.cfg
+ Move setuptools' packaging configuration from setup.py to setup.cfg to
+ simplify setup.py and make its packaging more dedeclarative.
+ Signed-off-by: Satoru SATOH <[email protected]>
+ - docs: Add Python API usage example
+ Fixes: #297
+ - commas: Fix example in documentation
+ Error in the example snippet, it would NOT pass otherwise actually:
+ ```
+ $ cat test.yml
+ strange var:
+ [10, 20,30, {x: 1, y: 2}]
+ $ yamllint -d "{extends: default, rules: {commas: {min-spaces-after: 1,
max-spaces-after: 1}}}" test.yml
+ test.yml
+ 1:1 warning missing document start "---" (document-start)
+ 2:11 error too few spaces after comma (commas)
+ ```
+ - docs: Add default values to rules with options
+ - CI: Add build environment without UTF-8 locales to travis-ci
+ Preventing regressions like #285
+
+-------------------------------------------------------------------
Old:
----
yamllint-1.24.2.tar.gz
New:
----
yamllint-1.26.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-yamllint.spec ++++++
--- /var/tmp/diff_new_pack.EMcRKn/_old 2022-04-13 22:15:30.144202278 +0200
+++ /var/tmp/diff_new_pack.EMcRKn/_new 2022-04-13 22:15:30.152202286 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-yamllint
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 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.24.2
+Version: 1.26.3
Release: 0
Summary: A linter for YAML files
License: GPL-3.0-only
@@ -31,7 +31,7 @@
Requires: python-PyYAML
Requires: python-pathspec >= 0.5.3
Requires(post): update-alternatives
-Requires(postun): update-alternatives
+Requires(postun):update-alternatives
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module PyYAML}
++++++ yamllint-1.24.2.tar.gz -> yamllint-1.26.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/PKG-INFO new/yamllint-1.26.3/PKG-INFO
--- old/yamllint-1.24.2/PKG-INFO 2020-07-16 09:35:38.630434000 +0200
+++ new/yamllint-1.26.3/PKG-INFO 2021-08-21 19:26:45.874583700 +0200
@@ -1,10 +1,14 @@
Metadata-Version: 1.2
Name: yamllint
-Version: 1.24.2
+Version: 1.26.3
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Verg??
License: GPLv3
+Project-URL: Documentation, https://yamllint.readthedocs.io
+Project-URL: Download, https://pypi.org/project/yamllint/#files
+Project-URL: Bug Tracker, https://github.com/adrienverge/yamllint/issues
+Project-URL: Source Code, https://github.com/adrienverge/yamllint
Description: A linter for YAML files.
yamllint does not only check for syntax validity, but for weirdnesses
like key
@@ -16,16 +20,14 @@
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
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: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/README.rst
new/yamllint-1.26.3/README.rst
--- old/yamllint-1.24.2/README.rst 2020-04-10 16:31:09.000000000 +0200
+++ new/yamllint-1.26.3/README.rst 2021-01-27 08:53:04.000000000 +0100
@@ -19,11 +19,7 @@
:target: https://yamllint.readthedocs.io/en/latest/?badge=latest
:alt: Documentation status
-Written in Python (compatible with Python 2 & 3).
-
-??? Python 2 upstream support stopped on January 1, 2020. yamllint will keep
-best-effort support for Python 2.7 until January 1, 2021. Passed that date,
-yamllint will drop all Python 2-related code.
+Written in Python (compatible with Python 3 only).
Documentation
-------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/docs/configuration.rst
new/yamllint-1.26.3/docs/configuration.rst
--- old/yamllint-1.24.2/docs/configuration.rst 2020-07-16 09:34:22.000000000
+0200
+++ new/yamllint-1.26.3/docs/configuration.rst 2020-09-27 10:11:38.000000000
+0200
@@ -123,8 +123,8 @@
YAML files extensions
---------------------
-To configure what yamllint should consider as YAML files, set ``yaml-files``
-configuration option. The default is:
+To configure what yamllint should consider as YAML files when listing
+directories, set ``yaml-files`` configuration option. The default is:
.. code-block:: yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/docs/development.rst
new/yamllint-1.26.3/docs/development.rst
--- old/yamllint-1.24.2/docs/development.rst 2016-01-24 18:07:07.000000000
+0100
+++ new/yamllint-1.26.3/docs/development.rst 2020-10-08 09:20:53.000000000
+0200
@@ -2,7 +2,17 @@
===========
yamllint provides both a script and a Python module. The latter can be used to
-write your own linting tools:
+write your own linting tools.
+
+Basic example of running the linter from Python:
+
+.. code-block:: python
+
+ import yamllint
+
+ yaml_config = yamllint.config.YamlLintConfig("extends: default")
+ for p in yamllint.linter.run("example.yaml", yaml_config):
+ print(p.desc, p.line, p.rule)
.. automodule:: yamllint.linter
:members:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/docs/integration.rst
new/yamllint-1.26.3/docs/integration.rst
--- old/yamllint-1.24.2/docs/integration.rst 2019-10-15 16:18:58.000000000
+0200
+++ new/yamllint-1.26.3/docs/integration.rst 2020-11-04 14:55:55.000000000
+0100
@@ -17,3 +17,56 @@
hooks:
- id: yamllint
args: [-c=/path/to/.yamllint]
+
+Integration with GitHub Actions
+-------------------------------
+
+yamllint auto-detects when it's running inside of `GitHub
+Actions<https://github.com/features/actions>` and automatically uses the suited
+output format to decorate code with linting errors automatically. You can also
+force the GitHub Actions output with ``yamllint --format github``.
+
+An example workflow using GitHub Actions:
+
+.. code:: yaml
+
+ ---
+ name: yamllint test
+
+ on: push
+
+ jobs:
+ test:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+
+ - name: Install yamllint
+ run: pip install yamllint
+
+ - name: Lint YAML files
+ run: yamllint .
+
+Integration with Arcanist
+-------------------------
+
+You can configure yamllint to run on ``arc lint``. Here is an example
+``.arclint`` file that makes use of this configuration.
+
+.. code:: json
+
+ {
+ "linters": {
+ "yamllint": {
+ "type": "script-and-regex",
+ "script-and-regex.script": "yamllint",
+ "script-and-regex.regex": "/^(?P<line>\\d+):(?P<offset>\\d+)
+(?P<severity>warning|error) +(?P<message>.*) +\\((?P<name>.*)\\)$/m",
+ "include": "(\\.(yml|yaml)$)"
+ }
+ }
+ }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/setup.cfg
new/yamllint-1.26.3/setup.cfg
--- old/yamllint-1.24.2/setup.cfg 2020-07-16 09:35:38.630434000 +0200
+++ new/yamllint-1.26.3/setup.cfg 2021-08-21 19:26:45.875584000 +0200
@@ -12,6 +12,60 @@
build-dir = docs/_build
warning-is-error = 1
+[metadata]
+keywords =
+ yaml
+ lint
+ linter
+ syntax
+ checker
+url = https://github.com/adrienverge/yamllint
+classifiers =
+ Development Status :: 5 - Production/Stable
+ Environment :: Console
+ Intended Audience :: Developers
+ License :: OSI Approved :: GNU General Public License v3 (GPLv3)
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3.5
+ Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Programming Language :: Python :: 3.8
+ Programming Language :: Python :: 3.9
+ Topic :: Software Development
+ Topic :: Software Development :: Debuggers
+ Topic :: Software Development :: Quality Assurance
+ Topic :: Software Development :: Testing
+project_urls =
+ Documentation = https://yamllint.readthedocs.io
+ Download = https://pypi.org/project/yamllint/#files
+ Bug Tracker = https://github.com/adrienverge/yamllint/issues
+ Source Code = https://github.com/adrienverge/yamllint
+
+[options]
+packages = find:
+python_requires = >=3.5
+include_package_data = True
+install_requires =
+ pathspec >= 0.5.3
+ pyyaml
+ setuptools
+test_suite = tests
+
+[options.packages.find]
+exclude =
+ tests
+ tests.*
+
+[options.package_data]
+yamllint = conf/*.yaml
+
+[options.entry_points]
+console_scripts =
+ yamllint = yamllint.cli:run
+
+[coverage:run]
+relative_files = True
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/setup.py new/yamllint-1.26.3/setup.py
--- old/yamllint-1.24.2/setup.py 2020-05-03 16:22:34.000000000 +0200
+++ new/yamllint-1.26.3/setup.py 2020-09-27 10:11:38.000000000 +0200
@@ -14,7 +14,7 @@
# 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 setuptools import find_packages, setup
+from setuptools import setup
from yamllint import (__author__, __license__,
APP_NAME, APP_VERSION, APP_DESCRIPTION)
@@ -27,31 +27,4 @@
description=APP_DESCRIPTION.split('\n')[0],
long_description=APP_DESCRIPTION,
license=__license__,
- keywords=['yaml', 'lint', 'linter', 'syntax', 'checker'],
- url='https://github.com/adrienverge/yamllint',
- python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Console',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- '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',
- 'Topic :: Software Development :: Testing',
- ],
-
- packages=find_packages(exclude=['tests', 'tests.*']),
- entry_points={'console_scripts': ['yamllint=yamllint.cli:run']},
- package_data={'yamllint': ['conf/*.yaml']},
- install_requires=['pathspec >=0.5.3', 'pyyaml'],
- test_suite='tests',
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/common.py
new/yamllint-1.26.3/tests/common.py
--- old/yamllint-1.24.2/tests/common.py 2020-03-24 08:58:23.000000000 +0100
+++ new/yamllint-1.26.3/tests/common.py 2020-07-20 13:57:15.000000000 +0200
@@ -57,7 +57,7 @@
tempdir = tempfile.mkdtemp(prefix='yamllint-tests-')
for path, content in files.items():
- path = os.path.join(tempdir, path)
+ path = os.path.join(tempdir, path).encode('utf-8')
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/rules/test_braces.py
new/yamllint-1.26.3/tests/rules/test_braces.py
--- old/yamllint-1.24.2/tests/rules/test_braces.py 2017-07-04
21:36:19.000000000 +0200
+++ new/yamllint-1.26.3/tests/rules/test_braces.py 2021-01-27
08:53:04.000000000 +0100
@@ -31,6 +31,60 @@
'dict6: { a: 1, b, c: 3 }\n'
'dict7: { a: 1, b, c: 3 }\n', conf)
+ def test_forbid(self):
+ conf = ('braces:\n'
+ ' forbid: false\n')
+ self.check('---\n'
+ 'dict: {}\n', conf)
+ self.check('---\n'
+ 'dict: {a}\n', conf)
+ self.check('---\n'
+ 'dict: {a: 1}\n', conf)
+ self.check('---\n'
+ 'dict: {\n'
+ ' a: 1\n'
+ '}\n', conf)
+
+ conf = ('braces:\n'
+ ' forbid: true\n')
+ self.check('---\n'
+ 'dict:\n'
+ ' a: 1\n', conf)
+ self.check('---\n'
+ 'dict: {}\n', conf, problem=(2, 8))
+ self.check('---\n'
+ 'dict: {a}\n', conf, problem=(2, 8))
+ self.check('---\n'
+ 'dict: {a: 1}\n', conf, problem=(2, 8))
+ self.check('---\n'
+ 'dict: {\n'
+ ' a: 1\n'
+ '}\n', conf, problem=(2, 8))
+
+ conf = ('braces:\n'
+ ' forbid: non-empty\n')
+ self.check('---\n'
+ 'dict:\n'
+ ' a: 1\n', conf)
+ self.check('---\n'
+ 'dict: {}\n', conf)
+ self.check('---\n'
+ 'dict: {\n'
+ '}\n', conf)
+ self.check('---\n'
+ 'dict: {\n'
+ '# commented: value\n'
+ '# another: value2\n'
+ '}\n', conf)
+ self.check('---\n'
+ 'dict: {a}\n', conf, problem=(2, 8))
+ self.check('---\n'
+ 'dict: {a: 1}\n', conf, problem=(2, 8))
+ self.check('---\n'
+ 'dict: {\n'
+ ' a: 1\n'
+ '}\n', conf, problem=(2, 8))
+
def test_min_spaces(self):
conf = ('braces:\n'
' max-spaces-inside: -1\n'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/rules/test_brackets.py
new/yamllint-1.26.3/tests/rules/test_brackets.py
--- old/yamllint-1.24.2/tests/rules/test_brackets.py 2017-07-04
21:36:19.000000000 +0200
+++ new/yamllint-1.26.3/tests/rules/test_brackets.py 2021-01-27
08:53:04.000000000 +0100
@@ -31,6 +31,58 @@
'array6: [ a, b, c ]\n'
'array7: [ a, b, c ]\n', conf)
+ def test_forbid(self):
+ conf = ('brackets:\n'
+ ' forbid: false\n')
+ self.check('---\n'
+ 'array: []\n', conf)
+ self.check('---\n'
+ 'array: [a, b]\n', conf)
+ self.check('---\n'
+ 'array: [\n'
+ ' a,\n'
+ ' b\n'
+ ']\n', conf)
+
+ conf = ('brackets:\n'
+ ' forbid: true\n')
+ self.check('---\n'
+ 'array:\n'
+ ' - a\n'
+ ' - b\n', conf)
+ self.check('---\n'
+ 'array: []\n', conf, problem=(2, 9))
+ self.check('---\n'
+ 'array: [a, b]\n', conf, problem=(2, 9))
+ self.check('---\n'
+ 'array: [\n'
+ ' a,\n'
+ ' b\n'
+ ']\n', conf, problem=(2, 9))
+
+ conf = ('brackets:\n'
+ ' forbid: non-empty\n')
+ self.check('---\n'
+ 'array:\n'
+ ' - a\n'
+ ' - b\n', conf)
+ self.check('---\n'
+ 'array: []\n', conf)
+ self.check('---\n'
+ 'array: [\n\n'
+ ']\n', conf)
+ self.check('---\n'
+ 'array: [\n'
+ '# a comment\n'
+ ']\n', conf)
+ self.check('---\n'
+ 'array: [a, b]\n', conf, problem=(2, 9))
+ self.check('---\n'
+ 'array: [\n'
+ ' a,\n'
+ ' b\n'
+ ']\n', conf, problem=(2, 9))
+
def test_min_spaces(self):
conf = ('brackets:\n'
' max-spaces-inside: -1\n'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/rules/test_line_length.py
new/yamllint-1.26.3/tests/rules/test_line_length.py
--- old/yamllint-1.24.2/tests/rules/test_line_length.py 2019-04-09
16:48:10.000000000 +0200
+++ new/yamllint-1.26.3/tests/rules/test_line_length.py 2021-04-06
15:22:52.000000000 +0200
@@ -14,9 +14,6 @@
# 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 sys
-import unittest
-
from tests.common import RuleTestCase
@@ -119,6 +116,27 @@
'long_line: http://localhost/very/very/long/url\n'
'...\n', conf, problem=(2, 21))
+ conf = 'line-length: {max: 20, allow-non-breakable-words: true}'
+ self.check('---\n'
+ '# http://www.verylongurlurlurlurlurlurlurlurl.com\n'
+ 'key:\n'
+ ' subkey: value\n', conf)
+ self.check('---\n'
+ '## http://www.verylongurlurlurlurlurlurlurlurl.com\n'
+ 'key:\n'
+ ' subkey: value\n', conf)
+ self.check('---\n'
+ '# # http://www.verylongurlurlurlurlurlurlurlurl.com\n'
+ 'key:\n'
+ ' subkey: value\n', conf,
+ problem=(2, 21))
+ self.check('---\n'
+ '#A http://www.verylongurlurlurlurlurlurlurlurl.com\n'
+ 'key:\n'
+ ' subkey: value\n', conf,
+ problem1=(2, 2, 'comments'),
+ problem2=(2, 21, 'line-length'))
+
conf = ('line-length: {max: 20, allow-non-breakable-words: true}\n'
'trailing-spaces: disable')
self.check('---\n'
@@ -159,7 +177,6 @@
' {% this line is' + 99 * ' really' + ' long %}\n',
conf, problem=(3, 81))
- @unittest.skipIf(sys.version_info < (3, 0), 'Python 2 not supported')
def test_unicode(self):
conf = 'line-length: {max: 53}'
self.check('---\n'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/rules/test_octal_values.py
new/yamllint-1.26.3/tests/rules/test_octal_values.py
--- old/yamllint-1.24.2/tests/rules/test_octal_values.py 2019-10-15
16:18:58.000000000 +0200
+++ new/yamllint-1.26.3/tests/rules/test_octal_values.py 2020-09-27
10:11:38.000000000 +0200
@@ -50,6 +50,8 @@
' - 0.10\n'
' - .01\n'
' - 0e3\n', conf)
+ self.check('with-decimal-digits: 012345678', conf)
+ self.check('with-decimal-digits: 012345679', conf)
def test_explicit_octal_values(self):
conf = ('octal-values:\n'
@@ -74,3 +76,5 @@
' - .01\n'
' - 0e3\n', conf)
self.check('user-city: "010"', conf)
+ self.check('with-decimal-digits: 0o012345678', conf)
+ self.check('with-decimal-digits: 0o012345679', conf)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/rules/test_quoted_strings.py
new/yamllint-1.26.3/tests/rules/test_quoted_strings.py
--- old/yamllint-1.24.2/tests/rules/test_quoted_strings.py 2020-07-15
11:38:48.000000000 +0200
+++ new/yamllint-1.26.3/tests/rules/test_quoted_strings.py 2021-01-27
08:53:04.000000000 +0100
@@ -330,7 +330,8 @@
'- "%wheel ALL=(ALL) NOPASSWD: ALL"\n'
'- \'"quoted"\'\n'
'- "\'foo\' == \'bar\'"\n'
- '- "\'Mac\' in ansible_facts.product_name"\n',
+ '- "\'Mac\' in ansible_facts.product_name"\n'
+ '- \'foo # bar\'\n',
conf)
self.check('---\n'
'k1: ""\n'
@@ -435,3 +436,21 @@
'- foo bar\n'
'- "foo bar"\n',
conf, problem1=(3, 3), problem2=(7, 3), problem3=(11, 3))
+
+ def test_octal_values(self):
+ conf = 'quoted-strings: {required: true}\n'
+
+ self.check('---\n'
+ '- 100\n'
+ '- 0100\n'
+ '- 0o100\n'
+ '- 777\n'
+ '- 0777\n'
+ '- 0o777\n'
+ '- 800\n'
+ '- 0800\n'
+ '- 0o800\n'
+ '- "0800"\n'
+ '- "0o800"\n',
+ conf,
+ problem1=(9, 3), problem2=(10, 3))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/test_cli.py
new/yamllint-1.26.3/tests/test_cli.py
--- old/yamllint-1.24.2/tests/test_cli.py 2020-07-16 09:34:22.000000000
+0200
+++ new/yamllint-1.26.3/tests/test_cli.py 2021-04-06 15:22:52.000000000
+0200
@@ -14,10 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-try:
- from cStringIO import StringIO
-except ImportError:
- from io import StringIO
+from io import StringIO
import fcntl
import locale
import os
@@ -56,6 +53,16 @@
return self._raises_ctx.exception.code
+# Check system's UTF-8 availability
+def utf8_available():
+ try:
+ locale.setlocale(locale.LC_ALL, 'C.UTF-8')
+ locale.setlocale(locale.LC_ALL, (None, None))
+ return True
+ except locale.Error:
+ return False
+
+
class CommandLineTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls):
@@ -86,7 +93,7 @@
'no-yaml.json': '---\n'
'key: value\n',
# non-ASCII chars
- 'non-ascii/????????????????/utf-8': (
+ u'non-ascii/????????????????/utf-8': (
u'---\n'
u'- h??t??rog??n??it??\n'
u'# 19.99 ???\n'
@@ -110,6 +117,8 @@
shutil.rmtree(cls.wd)
+ @unittest.skipIf(not utf8_available() and sys.version_info < (3, 7),
+ 'UTF-8 paths not supported')
def test_find_files_recursively(self):
conf = config.YamlLintConfig('extends: default')
self.assertEqual(
@@ -234,19 +243,19 @@
cli.run(())
self.assertNotEqual(ctx.returncode, 0)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(ctx.stderr, r'^usage')
+ self.assertRegex(ctx.stderr, r'^usage')
with RunContext(self) as ctx:
cli.run(('--unknown-arg', ))
self.assertNotEqual(ctx.returncode, 0)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(ctx.stderr, r'^usage')
+ self.assertRegex(ctx.stderr, r'^usage')
with RunContext(self) as ctx:
cli.run(('-c', './conf.yaml', '-d', 'relaxed', 'file'))
self.assertNotEqual(ctx.returncode, 0)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(
+ self.assertRegex(
ctx.stderr.splitlines()[-1],
r'^yamllint: error: argument -d\/--config-data: '
r'not allowed with argument -c\/--config-file$'
@@ -257,21 +266,21 @@
cli.run(('-', 'file'))
self.assertNotEqual(ctx.returncode, 0)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(ctx.stderr, r'^usage')
+ self.assertRegex(ctx.stderr, r'^usage')
def test_run_with_bad_config(self):
with RunContext(self) as ctx:
cli.run(('-d', 'rules: {a: b}', 'file'))
self.assertEqual(ctx.returncode, -1)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(ctx.stderr, r'^invalid config: no such rule')
+ self.assertRegex(ctx.stderr, r'^invalid config: no such rule')
def test_run_with_empty_config(self):
with RunContext(self) as ctx:
cli.run(('-d', '', 'file'))
self.assertEqual(ctx.returncode, -1)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(ctx.stderr, r'^invalid config: not a dict')
+ self.assertRegex(ctx.stderr, r'^invalid config: not a dict')
def test_run_with_config_file(self):
with open(os.path.join(self.wd, 'config'), 'w') as f:
@@ -288,6 +297,7 @@
cli.run(('-c', f.name, os.path.join(self.wd, 'a.yaml')))
self.assertEqual(ctx.returncode, 1)
+ @unittest.skipIf(os.environ.get('GITHUB_RUN_ID'), '$HOME not overridable')
def test_run_with_user_global_config_file(self):
home = os.path.join(self.wd, 'fake-home')
dir = os.path.join(home, '.config', 'yamllint')
@@ -374,7 +384,7 @@
with RunContext(self) as ctx:
cli.run(('--version', ))
self.assertEqual(ctx.returncode, 0)
- self.assertRegexpMatches(ctx.stdout + ctx.stderr, r'yamllint \d+\.\d+')
+ self.assertRegex(ctx.stdout + ctx.stderr, r'yamllint \d+\.\d+')
def test_run_non_existing_file(self):
path = os.path.join(self.wd, 'i-do-not-exist.yaml')
@@ -383,7 +393,7 @@
cli.run(('-f', 'parsable', path))
self.assertEqual(ctx.returncode, -1)
self.assertEqual(ctx.stdout, '')
- self.assertRegexpMatches(ctx.stderr, r'No such file or directory')
+ self.assertRegex(ctx.stderr, r'No such file or directory')
def test_run_one_problem_file(self):
path = os.path.join(self.wd, 'a.yaml')
@@ -425,17 +435,12 @@
cli.run(('-f', 'parsable', path))
self.assertEqual((ctx.returncode, ctx.stdout, ctx.stderr), (0, '', ''))
+ @unittest.skipIf(not utf8_available(), 'C.UTF-8 not available')
def test_run_non_ascii_file(self):
- path = os.path.join(self.wd, 'non-ascii', '????????????????', 'utf-8')
-
- # Make sure the default localization conditions on this "system"
- # support UTF-8 encoding.
- try:
- locale.setlocale(locale.LC_ALL, (None, 'UTF-8'))
- except locale.Error:
- self.skipTest('no UTF-8 locale available')
+ locale.setlocale(locale.LC_ALL, 'C.UTF-8')
self.addCleanup(locale.setlocale, locale.LC_ALL, (None, None))
+ path = os.path.join(self.wd, 'non-ascii', '????????????????', 'utf-8')
with RunContext(self) as ctx:
cli.run(('-f', 'parsable', path))
self.assertEqual((ctx.returncode, ctx.stdout, ctx.stderr), (0, '', ''))
@@ -542,6 +547,38 @@
self.assertEqual(
(ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, ''))
+ def test_run_format_github(self):
+ path = os.path.join(self.wd, 'a.yaml')
+
+ with RunContext(self) as ctx:
+ cli.run((path, '--format', 'github'))
+ expected_out = (
+ '::error file=%s,line=2,col=4::[trailing-spaces] trailing'
+ ' spaces\n'
+ '::error file=%s,line=3,col=4::[new-line-at-end-of-file] no'
+ ' new line character at the end of file\n'
+ % (path, path))
+ self.assertEqual(
+ (ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, ''))
+
+ def test_github_actions_detection(self):
+ path = os.path.join(self.wd, 'a.yaml')
+ self.addCleanup(os.environ.__delitem__, 'GITHUB_ACTIONS')
+ self.addCleanup(os.environ.__delitem__, 'GITHUB_WORKFLOW')
+
+ with RunContext(self) as ctx:
+ os.environ['GITHUB_ACTIONS'] = 'something'
+ os.environ['GITHUB_WORKFLOW'] = 'something'
+ cli.run((path, ))
+ expected_out = (
+ '::error file=%s,line=2,col=4::[trailing-spaces] trailing'
+ ' spaces\n'
+ '::error file=%s,line=3,col=4::[new-line-at-end-of-file] no'
+ ' new line character at the end of file\n'
+ % (path, path))
+ self.assertEqual(
+ (ctx.returncode, ctx.stdout, ctx.stderr), (1, expected_out, ''))
+
def test_run_read_from_stdin(self):
# prepares stdin with an invalid yaml string so that we can check
# for its specific error, and be assured that stdin was read
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/test_config.py
new/yamllint-1.26.3/tests/test_config.py
--- old/yamllint-1.24.2/tests/test_config.py 2019-08-27 09:46:03.000000000
+0200
+++ new/yamllint-1.26.3/tests/test_config.py 2021-01-27 08:53:04.000000000
+0100
@@ -14,10 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-try:
- from cStringIO import StringIO
-except ImportError:
- from io import StringIO
+from io import StringIO
import os
import shutil
import sys
@@ -48,7 +45,7 @@
config.YamlLintConfig('not: valid: yaml')
def test_unknown_rule(self):
- with self.assertRaisesRegexp(
+ with self.assertRaisesRegex(
config.YamlLintConfigError,
'invalid config: no such rule: "this-one-does-not-exist"'):
config.YamlLintConfig('rules:\n'
@@ -67,7 +64,7 @@
self.assertEqual(c.rules['colons']['max-spaces-after'], 1)
def test_unknown_option(self):
- with self.assertRaisesRegexp(
+ with self.assertRaisesRegex(
config.YamlLintConfigError,
'invalid config: unknown option "abcdef" for rule "colons"'):
config.YamlLintConfig('rules:\n'
@@ -105,7 +102,7 @@
self.assertEqual(c.rules['indentation']['check-multi-line-strings'],
False)
- with self.assertRaisesRegexp(
+ with self.assertRaisesRegex(
config.YamlLintConfigError,
'invalid config: option "indent-sequences" of "indentation" '
'should be in '):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/test_module.py
new/yamllint-1.26.3/tests/test_module.py
--- old/yamllint-1.24.2/tests/test_module.py 2018-11-26 19:20:01.000000000
+0100
+++ new/yamllint-1.26.3/tests/test_module.py 2021-01-27 08:53:04.000000000
+0100
@@ -47,16 +47,15 @@
subprocess.check_output([PYTHON, '-m', 'yamllint'],
stderr=subprocess.STDOUT)
self.assertEqual(ctx.exception.returncode, 2)
- self.assertRegexpMatches(ctx.exception.output.decode(),
- r'^usage: yamllint')
+ self.assertRegex(ctx.exception.output.decode(), r'^usage: yamllint')
def test_run_module_on_bad_dir(self):
with self.assertRaises(subprocess.CalledProcessError) as ctx:
subprocess.check_output([PYTHON, '-m', 'yamllint',
'/does/not/exist'],
stderr=subprocess.STDOUT)
- self.assertRegexpMatches(ctx.exception.output.decode(),
- r'No such file or directory')
+ self.assertRegex(ctx.exception.output.decode(),
+ r'No such file or directory')
def test_run_module_on_file(self):
out = subprocess.check_output(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/tests/test_yamllint_directives.py
new/yamllint-1.26.3/tests/test_yamllint_directives.py
--- old/yamllint-1.24.2/tests/test_yamllint_directives.py 2019-12-12
09:07:45.000000000 +0100
+++ new/yamllint-1.26.3/tests/test_yamllint_directives.py 2020-09-27
10:11:38.000000000 +0200
@@ -232,6 +232,34 @@
problem1=(3, 18, 'trailing-spaces'),
problem2=(4, 8, 'colons'))
+ def test_disable_directive_with_rules_and_dos_lines(self):
+ conf = self.conf + 'new-lines: {type: dos}\n'
+ self.check('---\r\n'
+ '- [valid , YAML]\r\n'
+ '# yamllint disable rule:trailing-spaces\r\n'
+ '- trailing spaces \r\n'
+ '- bad : colon\r\n'
+ '- [valid , YAML]\r\n'
+ '# yamllint enable rule:trailing-spaces\r\n'
+ '- bad : colon and spaces \r\n'
+ '- [valid , YAML]\r\n',
+ conf,
+ problem1=(5, 8, 'colons'),
+ problem2=(8, 7, 'colons'),
+ problem3=(8, 26, 'trailing-spaces'))
+ self.check('---\r\n'
+ '- [valid , YAML]\r\n'
+ '- trailing spaces \r\n'
+ '- bad : colon\r\n'
+ '- [valid , YAML]\r\n'
+ '# yamllint disable-line rule:colons\r\n'
+ '- bad : colon and spaces \r\n'
+ '- [valid , YAML]\r\n',
+ conf,
+ problem1=(3, 18, 'trailing-spaces'),
+ problem2=(4, 8, 'colons'),
+ problem3=(7, 26, 'trailing-spaces'))
+
def test_directive_on_last_line(self):
conf = 'new-line-at-end-of-file: {}'
self.check('---\n'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/__init__.py
new/yamllint-1.26.3/yamllint/__init__.py
--- old/yamllint-1.24.2/yamllint/__init__.py 2020-07-16 09:34:41.000000000
+0200
+++ new/yamllint-1.26.3/yamllint/__init__.py 2021-08-21 19:26:11.000000000
+0200
@@ -22,7 +22,7 @@
APP_NAME = 'yamllint'
-APP_VERSION = '1.24.2'
+APP_VERSION = '1.26.3'
APP_DESCRIPTION = __doc__
__author__ = u'Adrien Verg??'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/cli.py
new/yamllint-1.26.3/yamllint/cli.py
--- old/yamllint-1.24.2/yamllint/cli.py 2020-07-16 09:34:22.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/cli.py 2020-09-27 10:11:38.000000000 +0200
@@ -85,6 +85,19 @@
line += ' \033[2m(%s)\033[0m' % problem.rule
return line
+ @staticmethod
+ def github(problem, filename):
+ line = '::'
+ line += problem.level
+ line += ' file=' + filename + ','
+ line += 'line=' + format(problem.line) + ','
+ line += 'col=' + format(problem.column)
+ line += '::'
+ if problem.rule:
+ line += '[' + problem.rule + '] '
+ line += problem.desc
+ return line
+
def show_problems(problems, file, args_format, no_warn):
max_level = 0
@@ -96,6 +109,10 @@
continue
if args_format == 'parsable':
print(Format.parsable(problem, file))
+ elif args_format == 'github' or (args_format == 'auto' and
+ 'GITHUB_ACTIONS' in os.environ and
+ 'GITHUB_WORKFLOW' in os.environ):
+ print(Format.github(problem, file))
elif args_format == 'colored' or \
(args_format == 'auto' and supports_color()):
if first:
@@ -131,7 +148,8 @@
action='store',
help='custom configuration (as YAML source)')
parser.add_argument('-f', '--format',
- choices=('parsable', 'standard', 'colored', 'auto'),
+ choices=('parsable', 'standard', 'colored', 'github',
+ 'auto'),
default='auto', help='format for parsing output')
parser.add_argument('-s', '--strict',
action='store_true',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/linter.py
new/yamllint-1.26.3/yamllint/linter.py
--- old/yamllint-1.24.2/yamllint/linter.py 2020-05-07 12:31:09.000000000
+0200
+++ new/yamllint-1.26.3/yamllint/linter.py 2021-01-27 08:53:04.000000000
+0100
@@ -87,7 +87,8 @@
return # this certainly wasn't a yamllint directive comment
if re.match(r'^# yamllint disable( rule:\S+)*\s*$', comment):
- rules = [item[5:] for item in comment[18:].split(' ')][1:]
+ items = comment[18:].rstrip().split(' ')
+ rules = [item[5:] for item in items][1:]
if len(rules) == 0:
self.rules = self.all_rules.copy()
else:
@@ -96,7 +97,8 @@
self.rules.add(id)
elif re.match(r'^# yamllint enable( rule:\S+)*\s*$', comment):
- rules = [item[5:] for item in comment[17:].split(' ')][1:]
+ items = comment[17:].rstrip().split(' ')
+ rules = [item[5:] for item in items][1:]
if len(rules) == 0:
self.rules.clear()
else:
@@ -114,7 +116,8 @@
return # this certainly wasn't a yamllint directive comment
if re.match(r'^# yamllint disable-line( rule:\S+)*\s*$', comment):
- rules = [item[5:] for item in comment[23:].split(' ')][1:]
+ items = comment[23:].rstrip().split(' ')
+ rules = [item[5:] for item in items][1:]
if len(rules) == 0:
self.rules = self.all_rules.copy()
else:
@@ -230,7 +233,7 @@
if conf.is_file_ignored(filepath):
return ()
- if isinstance(input, (type(b''), type(u''))): # compat with Python 2 & 3
+ if isinstance(input, (bytes, str)):
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.24.2/yamllint/rules/braces.py
new/yamllint-1.26.3/yamllint/rules/braces.py
--- old/yamllint-1.24.2/yamllint/rules/braces.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/braces.py 2021-01-27
08:53:04.000000000 +0100
@@ -15,10 +15,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-Use this rule to control the number of spaces inside braces (``{`` and ``}``).
+Use this rule to control the use of flow mappings or number of spaces inside
+braces (``{`` and ``}``).
.. rubric:: Options
+* ``forbid`` is used to forbid the use of flow mappings which are denoted by
+ surrounding braces (``{`` and ``}``). Use ``true`` to forbid the use of flow
+ mappings completely. Use ``non-empty`` to forbid the use of all flow
+ mappings except for empty ones.
* ``min-spaces-inside`` defines the minimal number of spaces required inside
braces.
* ``max-spaces-inside`` defines the maximal number of spaces allowed inside
@@ -28,8 +33,46 @@
* ``max-spaces-inside-empty`` defines the maximal number of spaces allowed
inside empty braces.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ braces:
+ forbid: false
+ min-spaces-inside: 0
+ max-spaces-inside: 0
+ min-spaces-inside-empty: -1
+ max-spaces-inside-empty: -1
+
.. rubric:: Examples
+#. With ``braces: {forbid: true}``
+
+ the following code snippet would **PASS**:
+ ::
+
+ object:
+ key1: 4
+ key2: 8
+
+ the following code snippet would **FAIL**:
+ ::
+
+ object: { key1: 4, key2: 8 }
+
+#. With ``braces: {forbid: non-empty}``
+
+ the following code snippet would **PASS**:
+ ::
+
+ object: {}
+
+ the following code snippet would **FAIL**:
+ ::
+
+ object: { key1: 4, key2: 8 }
+
#. With ``braces: {min-spaces-inside: 0, max-spaces-inside: 0}``
the following code snippet would **PASS**:
@@ -92,23 +135,39 @@
import yaml
+from yamllint.linter import LintProblem
from yamllint.rules.common import spaces_after, spaces_before
ID = 'braces'
TYPE = 'token'
-CONF = {'min-spaces-inside': int,
+CONF = {'forbid': (bool, 'non-empty'),
+ 'min-spaces-inside': int,
'max-spaces-inside': int,
'min-spaces-inside-empty': int,
'max-spaces-inside-empty': int}
-DEFAULT = {'min-spaces-inside': 0,
+DEFAULT = {'forbid': False,
+ 'min-spaces-inside': 0,
'max-spaces-inside': 0,
'min-spaces-inside-empty': -1,
'max-spaces-inside-empty': -1}
def check(conf, token, prev, next, nextnext, context):
- if (isinstance(token, yaml.FlowMappingStartToken) and
+ if (conf['forbid'] is True and
+ isinstance(token, yaml.FlowMappingStartToken)):
+ yield LintProblem(token.start_mark.line + 1,
+ token.end_mark.column + 1,
+ 'forbidden flow mapping')
+
+ elif (conf['forbid'] == 'non-empty' and
+ isinstance(token, yaml.FlowMappingStartToken) and
+ not isinstance(next, yaml.FlowMappingEndToken)):
+ yield LintProblem(token.start_mark.line + 1,
+ token.end_mark.column + 1,
+ 'forbidden flow mapping')
+
+ elif (isinstance(token, yaml.FlowMappingStartToken) and
isinstance(next, yaml.FlowMappingEndToken)):
problem = spaces_after(token, prev, next,
min=(conf['min-spaces-inside-empty']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/brackets.py
new/yamllint-1.26.3/yamllint/rules/brackets.py
--- old/yamllint-1.24.2/yamllint/rules/brackets.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/brackets.py 2021-01-27
08:53:04.000000000 +0100
@@ -15,11 +15,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-Use this rule to control the number of spaces inside brackets (``[`` and
-``]``).
+Use this rule to control the use of flow sequences or the number of spaces
+inside brackets (``[`` and ``]``).
.. rubric:: Options
+* ``forbid`` is used to forbid the use of flow sequences which are denoted by
+ surrounding brackets (``[`` and ``]``). Use ``true`` to forbid the use of
+ flow sequences completely. Use ``non-empty`` to forbid the use of all flow
+ sequences except for empty ones.
* ``min-spaces-inside`` defines the minimal number of spaces required inside
brackets.
* ``max-spaces-inside`` defines the maximal number of spaces allowed inside
@@ -29,8 +33,47 @@
* ``max-spaces-inside-empty`` defines the maximal number of spaces allowed
inside empty brackets.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ brackets:
+ forbid: false
+ min-spaces-inside: 0
+ max-spaces-inside: 0
+ min-spaces-inside-empty: -1
+ max-spaces-inside-empty: -1
+
.. rubric:: Examples
+#. With ``brackets: {forbid: true}``
+
+ the following code snippet would **PASS**:
+ ::
+
+ object:
+ - 1
+ - 2
+ - abc
+
+ the following code snippet would **FAIL**:
+ ::
+
+ object: [ 1, 2, abc ]
+
+#. With ``brackets: {forbid: non-empty}``
+
+ the following code snippet would **PASS**:
+ ::
+
+ object: []
+
+ the following code snippet would **FAIL**:
+ ::
+
+ object: [ 1, 2, abc ]
+
#. With ``brackets: {min-spaces-inside: 0, max-spaces-inside: 0}``
the following code snippet would **PASS**:
@@ -93,23 +136,39 @@
import yaml
+from yamllint.linter import LintProblem
from yamllint.rules.common import spaces_after, spaces_before
ID = 'brackets'
TYPE = 'token'
-CONF = {'min-spaces-inside': int,
+CONF = {'forbid': (bool, 'non-empty'),
+ 'min-spaces-inside': int,
'max-spaces-inside': int,
'min-spaces-inside-empty': int,
'max-spaces-inside-empty': int}
-DEFAULT = {'min-spaces-inside': 0,
+DEFAULT = {'forbid': False,
+ 'min-spaces-inside': 0,
'max-spaces-inside': 0,
'min-spaces-inside-empty': -1,
'max-spaces-inside-empty': -1}
def check(conf, token, prev, next, nextnext, context):
- if (isinstance(token, yaml.FlowSequenceStartToken) and
+ if (conf['forbid'] is True and
+ isinstance(token, yaml.FlowSequenceStartToken)):
+ yield LintProblem(token.start_mark.line + 1,
+ token.end_mark.column + 1,
+ 'forbidden flow sequence')
+
+ elif (conf['forbid'] == 'non-empty' and
+ isinstance(token, yaml.FlowSequenceStartToken) and
+ not isinstance(next, yaml.FlowSequenceEndToken)):
+ yield LintProblem(token.start_mark.line + 1,
+ token.end_mark.column + 1,
+ 'forbidden flow sequence')
+
+ elif (isinstance(token, yaml.FlowSequenceStartToken) and
isinstance(next, yaml.FlowSequenceEndToken)):
problem = spaces_after(token, prev, next,
min=(conf['min-spaces-inside-empty']
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/colons.py
new/yamllint-1.26.3/yamllint/rules/colons.py
--- old/yamllint-1.24.2/yamllint/rules/colons.py 2019-06-06
09:52:15.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/colons.py 2020-09-02
18:18:24.000000000 +0200
@@ -24,6 +24,15 @@
* ``max-spaces-after`` defines the maximal number of spaces allowed after
colons (use ``-1`` to disable).
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ colons:
+ max-spaces-before: 0
+ max-spaces-after: 1
+
.. rubric:: Examples
#. With ``colons: {max-spaces-before: 0, max-spaces-after: 1}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/commas.py
new/yamllint-1.26.3/yamllint/rules/commas.py
--- old/yamllint-1.24.2/yamllint/rules/commas.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/commas.py 2020-09-02
18:18:24.000000000 +0200
@@ -26,6 +26,16 @@
* ``max-spaces-after`` defines the maximal number of spaces allowed after
commas (use ``-1`` to disable).
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ commas:
+ max-spaces-before: 0
+ min-spaces-after: 1
+ max-spaces-after: 1
+
.. rubric:: Examples
#. With ``commas: {max-spaces-before: 0}``
@@ -66,7 +76,7 @@
::
strange var:
- [10, 20,30, {x: 1, y: 2}]
+ [10, 20, 30, {x: 1, y: 2}]
the following code snippet would **FAIL**:
::
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/comments.py
new/yamllint-1.26.3/yamllint/rules/comments.py
--- old/yamllint-1.24.2/yamllint/rules/comments.py 2020-05-03
16:22:34.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/comments.py 2020-09-02
18:18:24.000000000 +0200
@@ -28,6 +28,16 @@
content. It defines the minimal required number of spaces between a comment
and its preceding content.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ comments:
+ require-starting-space: true
+ ignore-shebangs: true
+ min-spaces-from-content: 2
+
.. rubric:: Examples
#. With ``comments: {require-starting-space: true}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/document_end.py
new/yamllint-1.26.3/yamllint/rules/document_end.py
--- old/yamllint-1.24.2/yamllint/rules/document_end.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/document_end.py 2020-09-02
18:18:24.000000000 +0200
@@ -22,6 +22,14 @@
* Set ``present`` to ``true`` when the document end marker is required, or to
``false`` when it is forbidden.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ document-end:
+ present: true
+
.. rubric:: Examples
#. With ``document-end: {present: true}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/document_start.py
new/yamllint-1.26.3/yamllint/rules/document_start.py
--- old/yamllint-1.24.2/yamllint/rules/document_start.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/document_start.py 2020-11-04
15:13:42.000000000 +0100
@@ -22,6 +22,14 @@
* Set ``present`` to ``true`` when the document start marker is required, or to
``false`` when it is forbidden.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ document-start:
+ present: true
+
.. rubric:: Examples
#. With ``document-start: {present: true}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/empty_lines.py
new/yamllint-1.26.3/yamllint/rules/empty_lines.py
--- old/yamllint-1.24.2/yamllint/rules/empty_lines.py 2019-04-09
16:48:10.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/empty_lines.py 2020-09-02
18:18:24.000000000 +0200
@@ -25,6 +25,16 @@
* ``max-end`` defines the maximal number of empty lines allowed at the end of
the file. This option takes precedence over ``max``.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ empty-lines:
+ max: 2
+ max-start: 0
+ max-end: 0
+
.. rubric:: Examples
#. With ``empty-lines: {max: 1}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/empty_values.py
new/yamllint-1.26.3/yamllint/rules/empty_values.py
--- old/yamllint-1.24.2/yamllint/rules/empty_values.py 2019-10-15
16:18:58.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/empty_values.py 2020-09-02
18:18:24.000000000 +0200
@@ -23,6 +23,15 @@
* Use ``forbid-in-block-mappings`` to prevent empty values in block mappings.
* Use ``forbid-in-flow-mappings`` to prevent empty values in flow mappings.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ empty-values:
+ forbid-in-block-mappings: true
+ forbid-in-flow-mappings: true
+
.. rubric:: Examples
#. With ``empty-values: {forbid-in-block-mappings: true}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/hyphens.py
new/yamllint-1.26.3/yamllint/rules/hyphens.py
--- old/yamllint-1.24.2/yamllint/rules/hyphens.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/hyphens.py 2020-09-02
18:18:24.000000000 +0200
@@ -22,6 +22,14 @@
* ``max-spaces-after`` defines the maximal number of spaces allowed after
hyphens.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ hyphens:
+ max-spaces-after: 1
+
.. rubric:: Examples
#. With ``hyphens: {max-spaces-after: 1}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/indentation.py
new/yamllint-1.26.3/yamllint/rules/indentation.py
--- old/yamllint-1.24.2/yamllint/rules/indentation.py 2019-06-06
09:52:15.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/indentation.py 2020-09-02
18:18:24.000000000 +0200
@@ -32,6 +32,16 @@
* ``check-multi-line-strings`` defines whether to lint indentation in
multi-line strings. Set to ``true`` to enable, ``false`` to disable.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ indentation:
+ spaces: consistent
+ indent-sequences: true
+ check-multi-line-strings: false
+
.. rubric:: Examples
#. With ``indentation: {spaces: 1}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/line_length.py
new/yamllint-1.26.3/yamllint/rules/line_length.py
--- old/yamllint-1.24.2/yamllint/rules/line_length.py 2019-01-10
10:01:44.000000000 +0100
+++ new/yamllint-1.26.3/yamllint/rules/line_length.py 2021-04-06
15:22:52.000000000 +0200
@@ -17,10 +17,6 @@
"""
Use this rule to set a limit to lines length.
-Note: with Python 2, the ``line-length`` rule may not work properly with
-unicode characters because of the way strings are represented in bytes. We
-recommend running yamllint with Python 3.
-
.. rubric:: Options
* ``max`` defines the maximal (inclusive) length of lines.
@@ -30,6 +26,16 @@
* ``allow-non-breakable-inline-mappings`` implies ``allow-non-breakable-words``
and extends it to also allow non-breakable words in inline mappings.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ line-length:
+ max: 80
+ allow-non-breakable-words: true
+ allow-non-breakable-inline-mappings: false
+
.. rubric:: Examples
#. With ``line-length: {max: 70}``
@@ -134,7 +140,11 @@
start += 1
if start != line.end:
- if line.buffer[start] in ('#', '-'):
+ if line.buffer[start] == '#':
+ while line.buffer[start] == '#':
+ start += 1
+ start += 1
+ elif line.buffer[start] == '-':
start += 2
if line.buffer.find(' ', start, line.end) == -1:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/new_lines.py
new/yamllint-1.26.3/yamllint/rules/new_lines.py
--- old/yamllint-1.24.2/yamllint/rules/new_lines.py 2019-04-09
16:48:10.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/new_lines.py 2020-09-02
18:18:24.000000000 +0200
@@ -21,6 +21,14 @@
* Set ``type`` to ``unix`` to use UNIX-typed new line characters (``\\n``), or
``dos`` to use DOS-typed new line characters (``\\r\\n``).
+
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ new-lines:
+ type: unix
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/octal_values.py
new/yamllint-1.26.3/yamllint/rules/octal_values.py
--- old/yamllint-1.24.2/yamllint/rules/octal_values.py 2019-10-15
16:18:58.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/octal_values.py 2020-09-27
10:11:38.000000000 +0200
@@ -20,6 +20,20 @@
For instance ``010`` is the city code of Beijing, and should not be
converted to ``8``.
+.. rubric:: Options
+
+* Use ``forbid-implicit-octal`` to prevent numbers starting with ``0``.
+* Use ``forbid-explicit-octal`` to prevent numbers starting with ``0o``.
+
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ octal-values:
+ forbid-implicit-octal: true
+ forbid-explicit-octal: true
+
.. rubric:: Examples
#. With ``octal-values: {forbid-implicit-octal: true}``
@@ -57,6 +71,8 @@
city-code: 0o10
"""
+import re
+
import yaml
from yamllint.linter import LintProblem
@@ -70,6 +86,10 @@
'forbid-explicit-octal': True}
+def _is_octal_number(string):
+ return re.match(r'^[0-7]+$', string) is not None
+
+
def check(conf, token, prev, next, nextnext, context):
if prev and isinstance(prev, yaml.tokens.TagToken):
return
@@ -78,7 +98,8 @@
if isinstance(token, yaml.tokens.ScalarToken):
if not token.style:
val = token.value
- if val.isdigit() and len(val) > 1 and val[0] == '0':
+ if (val.isdigit() and len(val) > 1 and val[0] == '0' and
+ _is_octal_number(val[1:])):
yield LintProblem(
token.start_mark.line + 1, token.end_mark.column + 1,
'forbidden implicit octal value "%s"' %
@@ -88,7 +109,8 @@
if isinstance(token, yaml.tokens.ScalarToken):
if not token.style:
val = token.value
- if len(val) > 2 and val[:2] == '0o' and val[2:].isdigit():
+ if (len(val) > 2 and val[:2] == '0o' and
+ _is_octal_number(val[2:])):
yield LintProblem(
token.start_mark.line + 1, token.end_mark.column + 1,
'forbidden explicit octal value "%s"' %
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/quoted_strings.py
new/yamllint-1.26.3/yamllint/rules/quoted_strings.py
--- old/yamllint-1.24.2/yamllint/rules/quoted_strings.py 2020-04-17
10:30:12.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/quoted_strings.py 2021-01-27
08:53:04.000000000 +0100
@@ -34,6 +34,17 @@
**Note**: Multi-line strings (with ``|`` or ``>``) will not be checked.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ quoted-strings:
+ quote-type: any
+ required: true
+ extra-required: []
+ extra-allowed: []
+
.. rubric:: Examples
#. With ``quoted-strings: {quote-type: any, required: true}``
@@ -133,6 +144,17 @@
DEFAULT_SCALAR_TAG = u'tag:yaml.org,2002:str'
+# https://stackoverflow.com/a/36514274
+yaml.resolver.Resolver.add_implicit_resolver(
+ 'tag:yaml.org,2002:int',
+ re.compile(r'''^(?:[-+]?0b[0-1_]+
+ |[-+]?0o?[0-7_]+
+ |[-+]?0[0-7_]+
+ |[-+]?(?:0|[1-9][0-9_]*)
+ |[-+]?0x[0-9a-fA-F_]+
+ |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X),
+ list('-+0123456789'))
+
def _quote_match(quote_type, token_style):
return ((quote_type == 'any') or
@@ -149,7 +171,7 @@
try:
a, b = loader.get_token(), loader.get_token()
if (isinstance(a, yaml.ScalarToken) and a.style is None and
- isinstance(b, yaml.BlockEndToken)):
+ isinstance(b, yaml.BlockEndToken) and a.value == string):
return False
return True
except yaml.scanner.ScannerError:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint/rules/truthy.py
new/yamllint-1.26.3/yamllint/rules/truthy.py
--- old/yamllint-1.24.2/yamllint/rules/truthy.py 2020-04-08
12:30:35.000000000 +0200
+++ new/yamllint-1.26.3/yamllint/rules/truthy.py 2020-09-02
18:18:24.000000000 +0200
@@ -34,6 +34,15 @@
``truthy`` rule applies to both keys and values. Set this option to ``false``
to prevent this.
+.. rubric:: Default values (when enabled)
+
+.. code-block:: yaml
+
+ rules:
+ truthy:
+ allowed-values: ['true', 'false']
+ check-keys: true
+
.. rubric:: Examples
#. With ``truthy: {}``
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint.egg-info/PKG-INFO
new/yamllint-1.26.3/yamllint.egg-info/PKG-INFO
--- old/yamllint-1.24.2/yamllint.egg-info/PKG-INFO 2020-07-16
09:35:38.000000000 +0200
+++ new/yamllint-1.26.3/yamllint.egg-info/PKG-INFO 2021-08-21
19:26:45.000000000 +0200
@@ -1,10 +1,14 @@
Metadata-Version: 1.2
Name: yamllint
-Version: 1.24.2
+Version: 1.26.3
Summary: A linter for YAML files.
Home-page: https://github.com/adrienverge/yamllint
Author: Adrien Verg??
License: GPLv3
+Project-URL: Documentation, https://yamllint.readthedocs.io
+Project-URL: Download, https://pypi.org/project/yamllint/#files
+Project-URL: Bug Tracker, https://github.com/adrienverge/yamllint/issues
+Project-URL: Source Code, https://github.com/adrienverge/yamllint
Description: A linter for YAML files.
yamllint does not only check for syntax validity, but for weirdnesses
like key
@@ -16,16 +20,14 @@
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
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: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Debuggers
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
-Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Requires-Python: >=3.5
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yamllint-1.24.2/yamllint.egg-info/requires.txt
new/yamllint-1.26.3/yamllint.egg-info/requires.txt
--- old/yamllint-1.24.2/yamllint.egg-info/requires.txt 2020-07-16
09:35:38.000000000 +0200
+++ new/yamllint-1.26.3/yamllint.egg-info/requires.txt 2021-08-21
19:26:45.000000000 +0200
@@ -1,2 +1,3 @@
pathspec>=0.5.3
pyyaml
+setuptools