100 Commits
Author SHA1 Message Date
Adrien Vergé cba56bcde1 yamllint version 1.38.0 2026-01-13 08:45:53 +01:00
Adrien Vergé 9dc506b5a1 Require pathspec ≥ 1.0.0 and follow Git's gitignore implementation
To follow Git's implementation, use `GitIgnoreSpec.from_lines(…)`. The
change for using this is Git allows including files from excluded
directories which directly contradicts the gitignore docs.

Thanks to Wong Hoi Sing Edison for the initial proposal.

Fixes https://github.com/adrienverge/yamllint/issues/800.
2026-01-13 08:42:00 +01:00
Adrien Vergé 73b9c0b542 Drop support for Python 3.9
Python 3.9 is officially "end-of-life" since 2025-10-31.

Note: Python 3.14 is officially supported since commit 823a96e "CI: Test
more versions of Python".
2025-12-03 08:38:01 +01:00
Adrien Vergé a3b3bb31bb README: Enhance wording of recursive directory lint 2025-11-13 08:49:38 +01:00
Adrien Vergé 16430e9d0a config: Use "mapping" instead of "dict" for user-facing errors
Previously, these errors used the word "dict" because it's the common
term in the Python world. But the YAML term is rather "mapping". The
present commit fixes this wording.

This originates from this discussion [^2].

[^1]: https://yaml.org/spec/1.2.2/#3211-nodes
[^2]: https://github.com/adrienverge/yamllint/pull/747#pullrequestreview-2813393998
2025-05-05 18:34:39 +02:00
Adrien Vergé 79a6b2b139 yamllint version 1.37.1 2025-05-04 10:24:35 +02:00
Adrien Vergé 1a6542c58a quoted-strings: Fix only-when-needed on multiline with backslash
On double-quoted multiline strings, quotes aren't needed if lines are
broken on spaces, e.g.:

    multiline:
      "this is a sentence
      cut into words"

But quotes are needed when at least one line ends with a backslash
character (`\`), meaning that the next spaces should be removed:

    multiline:
      "https://example.com/a/very/very\
      /very/very/long/URL"

This commit fixes that.

Fixes https://github.com/adrienverge/yamllint/issues/275
2025-05-04 10:10:47 +02:00
Adrien Vergé 0f2fbb03c7 docs: Add links to GitHub repository and releases
Closes https://github.com/adrienverge/yamllint/issues/733.
2025-04-09 11:22:01 +02:00
Adrien Vergé bce26d68a8 CI: Fix TestPyPI "dev0" versions for master commits on tags
This fixes a problem in the custom versions `v1.37.0.devN` built for
publishing on TestPyPI since commit 325fafa "Publish each master commit
with a unique version on TestPyPI".

Such versions are constructed by suffixing `.devN`, where `N` is the
number of commits since last tags. In the `N = 0` case, we need to add
`--long` to `git describe --tags`. Otherwise it yields `v1.37.0` instead
of `v1.37.0-0-gbe92e15`, and the CI fails, e.g. on
https://github.com/adrienverge/yamllint/actions/runs/14017589005/job/39245225221

    packaging.version.InvalidVersion: Invalid version: '1.37.0.devv1.37.0'
2025-03-23 10:41:27 +01:00
Adrien Vergé be92e15345 yamllint version 1.37.0 2025-03-23 10:20:46 +01:00
Adrien Vergé 325fafac08 CI: Publish each master commit with a unique version on TestPyPI
This follows commit 7d52df7 "CI: Ignore version duplicates when
publishing to TestPyPI" with a better design:
- Only publish builds from `master` branch on TestPyPI.
- Version every non-tag commit with a `.devN` suffix, e.g. `1.36.2.dev1`.
  This prevents duplicates on TestPyPI.
- `twine check` built packages.

See discussion at
https://github.com/adrienverge/yamllint/issues/721#issuecomment-2731027692
for more details.
2025-03-21 15:25:15 +01:00
Adrien Vergé cd96692595 yamllint version 1.36.2 2025-03-17 10:11:35 +01:00
Adrien Vergé 7d52df703c CI: Ignore version duplicates when publishing to TestPyPI
This commit prevents the failure of the GitHub Actions job "Publish
distribution package to TestPyPI" on most pushes (see discussion at
https://github.com/adrienverge/yamllint/issues/721#issuecomment-2727167030),
since recent commit a3e1325 "CI: Publish PyPI releases using GitHub
Actions workflows".

Indeed, TestPyPI doesn't allow repushing the same version. Use
`skip-existing` to prevent to such failures on the CI.

An alternative would be to use the `setuptools-scm` plugin to define a
unique version for each commit (e.g. `1.36.2.dev2+gd4f1c14`), but it
requires more changes (define the version in `pyproject.toml`, fetch
tags from GitHub in `publish.yaml`, exclude `.*` + `.github/**` files in
`MANIFEST.in`). Moreover it doesn't work as is: to prevent errors like
`HTTP 400 The use of local versions in '1.36.2.dev2+gd4f1c14' is not
allowed` we would need `local_scheme = "no-local-version"`, which would
push duplicated versions on TestPyPI anyway.
2025-03-17 10:09:11 +01:00
Adrien Vergé 16727ac184 build: Restore documentation and test files in sdist
This commit fixes a problem reported by Nicholas Bollweg at
https://github.com/adrienverge/yamllint/pull/725. Recent commit a3e1325
"CI: Publish PyPI releases using GitHub Actions workflows" and automatic
publication of version 1.36.1 revealed a problem that had probably been
there for some time: most documentation and test files weren't included
in the source distribution when running `python -m build` (unless an
`yamllint.egg-info` from a previous run listed them).

I see two solutions:
1. Add plugin `setuptools-scm` in `pyproject.toml`:
       requires = ["setuptools >= 61", "setuptools-scm >= 8"]
   This would add all files tracked by Git in the sdist, including a few
   that aren't really needed: `.flake8`, `.github`, `.readthedocs.yaml`…
2. Declare extra files to embed in `MANIFEST.in`. This is what this
   commit does.

I checked that:
- All files packages before 1.36.0 are correctly included now:
      tar -tvf dist/yamllint-1.36.0.tar.gz | cut -b65- \
        > /tmp/sdist-files-before
      rm -rf yamllint.egg-info && python -m build && \
        tar -tvf dist/yamllint-1.36.1.tar.gz | cut -b65- \
        > /tmp/sdist-files-after
      git diff --no-index /tmp/sdist-files-before /tmp/sdist-files-after
- These extra files are still not installed by `pip install` (they are
  not needed):
      pip install yamllint==1.36.0 && \
        tree ~/.local/lib/python3.13/site-packages/yamllint \
        > /tmp/pip-install-before
      pip install dist/yamllint-1.36.1.tar.gz && \
        tree ~/.local/lib/python3.13/site-packages/yamllint \
        > /tmp/pip-install-after
      git diff --no-index /tmp/pip-install-before /tmp/pip-install-after
2025-03-17 08:59:44 +01:00
Adrien Vergé 27d05bdea3 yamllint version 1.36.1 2025-03-15 18:24:06 +01:00
Adrien Vergé a3e13253da CI: Publish PyPI releases using GitHub Actions workflows
Closes https://github.com/adrienverge/yamllint/issues/721
2025-03-15 18:22:40 +01:00
Adrien Vergé 1c3bbb27a0 CI: Rename the GitHub Actions workflow file tests.yaml
This is more logical and sets the ground for other GitHub Actions
workflows, e.g. automated distribution releases.
2025-03-15 17:46:46 +01:00
Adrien Vergé d5b6c4a6ae yamllint version 1.36.0 2025-03-11 08:33:54 +01:00
Adrien Vergé dc214be646 Drop support for Python 3.8
This fixes a leftover from commit c20f191 "CI: Add support for Python
3.13".

Python 3.8 is officially "end-of-life" since 2024-10-07.

Fixes https://github.com/adrienverge/yamllint/issues/717
2025-03-07 19:51:06 +01:00
Adrien Vergé 2f87db8144 key-ordering: Add ignored-keys option
This change allows ignoring certain keys by filling the `ignored-keys`
option with a list of PCRE regexes to select strings to ignore.
2025-03-05 18:28:48 +01:00
Adrien Vergé e427005b52 cli: Fix TTY test failing on Python 3.14
Since I don't have Python 3.14 on my system (yet), here are the steps I
used to reproduce:

    sudo dnf install python3.14
    python3.14 -m venv /tmp/py3.14
    source /tmp/py3.14/bin/activate
    pip install yaml pathspec
    python3.14 -m unittest discover
    # or
    python3.14 -m unittest tests.test_cli.CommandLineTestCase.test_run_default_format_output_in_tty

This commit fixes that by piping *only* `sys.stdout`, not `sys.stderr`
too. I'm not sure why I wrote this code in 2016 (see commit a2c68fdf),
but the new one makes more sense to me now.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2336947
2025-01-14 08:06:39 +01:00
Adrien Vergé 728656c937 cli: Refactor old test to avoid fcntl
This is a simple preparation for the next commit, to get rid of
low-level `fcntl.fcntl()` calls, since `os.set_blocking()` now exists
(since Python 3.5).
2025-01-14 08:06:39 +01:00
Adrien Vergé c20f191bc1 CI: Add support for Python 3.13
And drop support for Python 3.8 (end-of-life since 2024-10-07).
2025-01-13 19:21:33 +01:00
Adrien Vergé 8513d9b97d docs: Import 'yamllint.config' rather than 'yamllint'
Since yamllint version 0.5.2 (in 2016, just after yamllint was created)
this example in documentation doesn't work. Indeed, commit dbbecb5
(which aimed to solve another problem) removed the ability to import
yamllint submodules directly.

This commit makes it clearer inside documentation.

Fixes https://github.com/adrienverge/yamllint/issues/698
2024-11-20 18:27:38 +01:00
Adrien Vergé 81e9f98ffd yamllint version 1.35.1 2024-02-16 11:48:35 +01:00
Adrien Vergé 9235c68496 cli: Restore ignoration of files passed as command-line arguments
Commit 2344380 "Cleanly skip broken symlinks that are ignored" fixed a
problem on symbolic links but also introduced a change on how ignored
files should be treated, depending on whether they're explicitely passed
as command-line arguments or not [^1].

This change is annoying for users that dynamically build the list of
files to pass as arguments, e.g. [^2]:

    find -name '*\.yaml' | xargs yamllint

The present commit adds unit tests for `yamllint [FILES]...` and
`yamllint --list-files [FILES]...`, that passed with previous version
1.34.0, and restore the behavior of this version.

As a result it also reverts the API change of commit 2344380 on
`yamllint.linter.run(stream, config)`.

[^1]: https://github.com/adrienverge/yamllint/issues/657#issuecomment-1948009315
[^2]: https://github.com/adrienverge/yamllint/issues/657#issuecomment-1948093680
2024-02-16 11:48:22 +01:00
Adrien Vergé 3a13803fb0 yamllint version 1.35.0 2024-02-15 09:59:18 +01:00
Adrien Vergé 2344380353 cli: Cleanly skip broken symlinks that are ignored
Before this commit, yamllint would output "[Errno 2] No such file or
directory" when running on a directory which contained a broken symbolic
link, even if the file is set to be ignored in yamllint configuration.

This commit fixes that, and adds corresponding tests.

As a side effect this changes `yamllint.linter.run(stream, config)`, so
tools that would use this API need to filter ignored files beforehand.

Fixes https://github.com/adrienverge/yamllint/issues/399
2024-02-15 09:54:11 +01:00
Adrien Vergé f66855bf2d build: Restore official Read the Docs theme
https://yamllint.readthedocs.io/en/v1.34.0/ was rendered differently
than previous versions, very probably due to change of commit ca7f8b9
"Migrate to use .readthedocs.yaml for docs generation".

Let's restore the `sphinx_rtd_theme` theme.
2024-02-06 15:54:53 +01:00
Adrien Vergé dd99a1c965 yamllint version 1.34.0 2024-02-06 09:54:04 +01:00
Adrien Vergé 01df5bf038 truthy: Adapt forbidden values based on YAML version
Specification of YAML ≤ 1.1 has 22 boolean values:

    y     | Y            | n     | N
    yes   | Yes   | YES  | no    | No    | NO
    true  | True  | TRUE | false | False | FALSE
    on    | On    | ON   | off   | Off   | OFF

Whereas YAML 1.2 spec recognizes only 6 [^1]:

    true  | True  | TRUE | false | False | FALSE

For documents that explicit state their YAML spec version at the top of
the document, let's adapt the list of forbidden values.

In the future, we should:
- implement a configuration option to declare the default YAML spec
  version, e.g. `default-yaml-spec-version: 1.2`,
- consider making 1.2 the default in a future release (this would be a
  slight breaking change, but yamllint always tried to be
  1.2-compatible).
- consider adapting yamllint to other 1.1 vs. 1.2 differences [^2].

Solves: https://github.com/adrienverge/yamllint/issues/587

Related to: #559 #540 #430 #344 #247 #232 #158

[^1]: https://yaml.org/spec/1.2.2/#1032-tag-resolution
[^2]: https://yaml.org/spec/1.2.2/ext/changes/#changes-in-version-12-revision-120-2009-07-21
2024-02-06 09:45:33 +01:00
Adrien Vergé 52b40c8153 tests: Remove test skipping for Python < 3.7
Yamllint dropped support for Python 3.6 in september 2022.
2023-12-30 18:28:25 +01:00
Adrien Vergé ca7f8b972c build: Migrate to use .readthedocs.yaml for docs generation
As explained on https://readthedocs.org/projects/yamllint/:
> Your builds will stop working soon!
> Configuration files will soon be required by projects, and will no
> longer be optional. Read our blog post to create one and ensure your
> project continues building successfully.

https://blog.readthedocs.com/migrate-configuration-v2/
2023-11-21 22:39:14 +01:00
Adrien Vergé 1f79e62a98 docs: Fix new rstcheck errors
Some YAML snippets from the examples were actually invalid.
2023-11-21 22:27:44 +01:00
Adrien Vergé 8713140e99 yamllint version 1.33.0 2023-11-09 10:32:20 +01:00
Adrien Vergé b05e028c58 yamllint version 1.32.0 2023-05-22 18:01:58 +02:00
Adrien Vergé 019c87d36d anchors: Update code style to use single quotes
Like the rest of the project does.
2023-05-10 06:56:11 +02:00
Adrien Vergé 977f4908b5 anchors: Add missing quotes in unused anchor error message
Existing `anchors` options use quotes around the anchor name:

    2:3       error    found undeclared alias "unknown"  (anchors)
    4:3       error    found duplicated anchor "dup"  (anchors)

Let's do the same in the newly-added option `forbid-unused-anchors`:

    5:3       error    found unused anchor "not used"  (anchors)
2023-05-10 06:56:11 +02:00
Adrien Vergé 98f2281f56 yamllint version 1.31.0 2023-04-21 14:23:43 +02:00
Adrien Vergé 15eafeb80a build: Migrate from setup.py to pyproject.toml
Using `setup.py` is deprecated and the new recommanded way is to declare
a `pyproject.toml` file (see PEP 517 [^1]).

This commit proposes to use setuptools to achieve that, because
setuptools is already used by yamllint, is standard and referenced by
the official Python packaging documentation [^2], and seems to be the
most lightweight solution. An alternative could have been to use Poetry,
see the dedicated pull request and discussion [^3].

For some period, the `setup.py` file will be kept (although almost
empty), to allow old tools versions to keep working.

Closes https://github.com/adrienverge/yamllint/issues/509.

[^1]: https://peps.python.org/pep-0517/
[^2]: https://packaging.python.org/en/latest/tutorials/installing-packages/
[^3]: https://github.com/adrienverge/yamllint/pull/557
2023-04-21 14:15:53 +02:00
Adrien Vergé 16eae28a50 build: Stop using setup.py to generate documentation
Because `setup.py` is deprecated, let's switch from:

    python setup.py build_sphinx

to:

    make -C docs html

to build Sphinx documentation.

The generated HTML files in `docs/_build/html` are exactly the same (I
compared with `diff -qr`).

Also add `-W` (turn warnings into errors) to the `sphinx-build` options
to keep the previous behavior.
2023-04-14 16:03:32 +02:00
Adrien Vergé 771c3a0412 README: Update CI status badge
It is a leftover from commit 66bf76a "CI: Switch to GitHub Actions".
2023-04-14 15:18:30 +02:00
Adrien Vergé b92fc9cb31 colons: Prevent error when space before is mandatory
In the rare case when the key before `:` is an alias (e.g. `{*x : 4}`),
the space before `:` is required (although this requirement is not
enforced by PyYAML), the reason being that a colon can be part of an
anchor name. Consequently, this commit adapts the `colons` rule to avoid
failures when this happens.

See this comment from Tina Müller for more details:
https://github.com/adrienverge/yamllint/pull/550#discussion_r1155297373
2023-04-05 19:19:02 +02:00
Adrien Vergé e90e0a0eb5 anchors: Fix invalid YAML in aliases test cases
Although accepted by PyYAML, `{*x: 4}` is not valid YAML: it should be
noted `{*x : 4}`. The reason is that a colon can be part of an anchor
name. See this comment from Tina Müller for more details:
https://github.com/adrienverge/yamllint/pull/550#discussion_r1155297373

Even if it's not a problem for yamllint, let's fix our tests to include
valid YAML snippets.
2023-04-05 19:19:02 +02:00
Adrien Vergé 9d0f59876d yamllint version 1.30.0 2023-03-22 10:38:34 +01:00
Adrien Vergé ebd6b90d3e anchors: Add new rule to detect undeclared or duplicated anchors
According to the YAML specification [^1]:

- > It is an error for an alias node to use an anchor that does not
  > previously occur in the document.

  The `forbid-undeclared-aliases` option checks that aliases do have a
  matching anchor declared previously in the document. Since this is
  required by the YAML spec, this option is enabled by default.

- > The alias refers to the most recent preceding node having the same
  > anchor.

  This means that having a same anchor repeated in a document is
  allowed. However users could want to avoid this, so the new option
  `forbid-duplicated-anchors` allows that. It's disabled by default.

- > It is not an error to specify an anchor that is not used by any
  > alias node.

  This means that it's OK to declare anchors but don't have any alias
  referencing them. However users could want to avoid this, so a new
  option (e.g. `forbid-unused-anchors`) could be implemented in the
  future. See https://github.com/adrienverge/yamllint/pull/537.

Fixes #395
Closes #420

[^1]: https://yaml.org/spec/1.2.2/#71-alias-nodes
2023-03-22 10:34:35 +01:00
Adrien Vergé 15f8204427 linter: Prevent testing is_file_ignored() with filepath == None
As reported in https://github.com/adrienverge/yamllint/pull/548, there
might be a problem with	pathspec 0.11.1 which does't allow calling
`match_file()` with argument `None` anymore.

The `linter.run()` function shouldn't call
`YamlLintConfig.is_file_ignored(None)` anyway.
2023-03-19 11:06:52 +01:00
Adrien Vergé b9e1fd18c1 yamllint version 1.29.0 2023-01-10 18:57:21 +01:00
Adrien Vergé a6e0e1213a CI: Fix pip install problem with Pygments version
Recently `python setup.py build_sphinx` started failing with:

    pkg_resources.VersionConflict: (Pygments 2.3.1
    (/usr/lib/python3/dist-packages), Requirement.parse('Pygments>=2.12'))

The reason is that `doc8` 1.0.0 installs `Pygments` 2.3.1, then `Sphinx`
5.3.0 needs `Pygments` ≥ 2.12.

The easiest fix is to change the install order.
2022-10-26 16:37:45 +02:00
Adrien Vergé eb7b7ca627 docs: Fix Sphinx error on non-YAML code snippet
This problem was just introduced by commit cec4f33 "Clarify disable-line
and parser errors, workaround" and produced this error when building
documentation:

    docs/disable_with_comments.rst:120:Could not lex literal_block as
    "yaml". Highlighting skipped.
2022-10-26 16:37:45 +02:00
Adrien Vergé 151b1c4086 style: Fix indentation test file missing whitespace
Commit 764586d "indentation: Fix indent-sequences in nested collections"
introduced 2 style-related problems:

    tests/rules/test_indentation.py:1394:45: E231 missing whitespace after ','
    tests/rules/test_indentation.py:1402:45: E231 missing whitespace after ','

Let's fix them.
2022-10-24 14:37:48 +02:00
Adrien Vergé b8c85f0dfd build: Stop releasing universal wheels
This reverts commit 3c525ab "Release as a universal wheel".

Python 2 support was definitely dropped in early 2021 in commit a3fc64d,
since then it's no longer useful to build universal wheels.

According to the `wheel` documentation:
> If your project contains no C extensions and is expected to work on
> both Python 2 and 3, you will want to tell wheel to produce universal
> wheels

Partly fixes https://github.com/adrienverge/yamllint/issues/501
2022-10-11 11:38:01 +02:00
Adrien Vergé 008db4aa09 float-values: Fix bug on strings containing fordidden values
The rule correctly reports number values like `.1`, `1e2`, `.NaN` and
`.Inf`, but it also reported false positives on strings like `.1two3`,
`1e2a`, `.NaNa` and `.Infinit∞`.

The regexps need to end with an end delimiter (`$`) otherwise longer
strings can be matched too.

Fixes https://github.com/adrienverge/yamllint/issues/495
2022-10-04 08:59:51 +02:00
Adrien Vergé 9cce294041 yamllint version 1.28.0 2022-09-12 14:37:48 +02:00
Adrien Vergé a09ad89268 yamllint version 1.27.1 2022-07-08 18:06:54 +02:00
Adrien Vergé 8d543a4b9c key-duplicates: Fix failing test for missing space after colon
Commit c268a82 "key-duplicates: Don't crash on redundant closing
brackets or braces" fixed a problem but introduced another one: it
crashes on systems with (I guess) an old version of PyYAML. This is
probably linked to the "Allow colon in a plain scalar in a flow context"
issue on PyYAML [1].
For example, this problem happens on CentOS 8:

    FAIL: test_disabled (tests.rules.test_key_duplicates.KeyDuplicatesTestCase)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "…/tests/rules/test_key_duplicates.py", line 90, in test_disabled
        '{a:1, b:2}}\n', conf, problem=(2, 11, 'syntax'))
      File "…/tests/common.py", line 54, in check
        self.assertEqual(real_problems, expected_problems)
    AssertionError: Lists differ: …
    - [2:3: syntax error: found unexpected ':' (syntax)]
    + [2:11: <no description>]

I propose to simply fix the *space following a colon* problem, since
it's not related to what the original author @tamere-allo-peter tried to
fix.

[1]: https://github.com/yaml/pyyaml/pull/45
2022-07-08 18:05:21 +02:00
Adrien Vergé 8a364e2fde yamllint version 1.27.0 2022-07-08 17:32:19 +02:00
Adrien Vergé dc2d0991e0 float-values: Refactor tests to be less verbose
The goal is to be more concise thus more readable, as well as consistent
with most other tests.
2022-07-08 17:21:22 +02:00
Adrien Vergé e6af957131 float-values: Add missing quotes in problems messages
To be consistent with other existing messages, e.g.:
- forbidden not a number value ".NaN"
- found forbidden document start "---"
- missing document start "---"
- truthy value should be one of ["true"]
- forbidden implicit octal value "0777"
2022-07-08 17:21:22 +02:00
Adrien Vergé 89b75b7c05 refactor: Remove UTF-8 headers in Python files
The `# -*- coding: utf-8 -*-` headers were useful for Python 2, and
aren't needed for Python 3 where UTF-8 is the default.

yamllint support of Python 2 was dropped in early 2021, see commit
a3fc64d "End support for Python 2".

Let's drop these headers.
2022-06-09 09:40:06 +02:00
Adrien Vergé f2e2e0c366 docs: Update CONTRIBUTING.rst
Be more precise in contributing instructions.
2021-10-20 09:40:59 +02:00
Adrien Vergé 058fef7559 yamllint version 1.26.3 2021-08-21 19:26:15 +02:00
Adrien Vergé f47d5318cf 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.
2021-08-21 19:25:27 +02:00
Adrien Vergé 33ce0fa960 yamllint version 1.26.2 2021-08-03 12:57:43 +02:00
Adrien Vergé 85ccd625a3 yamllint version 1.26.1 2021-04-06 16:02:55 +02:00
Adrien Vergé 5d8ef2ea23 CI: Simplify 'pip' commands 2021-03-24 17:16:57 +01:00
Adrien Vergé 4515269233 CI: Fix failing 'coverage' command because of $PATH
Very probably due to:
https://github.com/actions/virtual-environments/issues/2455#issuecomment-787511010
2021-03-24 17:16:57 +01:00
Adrien Vergé 66bf76a362 CI: Switch to GitHub Actions
Because Travis CI is dead.
2021-03-16 16:13:01 +01:00
Adrien Vergé 0fff4e29e4 yamllint version 1.26.0 2021-01-29 18:10:35 +01:00
Adrien Vergé 1b378ed5b9 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.
2021-01-11 16:38:29 +01:00
Adrien Vergé a3fc64d134 End support for Python 2
As planned and advertized, yamllint drops support for Python 2 on 2021.
2021-01-06 07:55:10 +01:00
Adrien Vergé 85c8631183 tests: Stop using deprecated 'python setup.py test'
Using `python setup.py test` is now deprecated [1], users are encouraged
to be explicit about the test command.

Running yamllint tests using the Python standard library (`unittest`)
can be done using:

    python -m unittest discover

Why not nose, tox or pytest? Because they would add a dependency, make
tests running more complicated and verbose for new users, and their
benefit is not worth for this simple project (only 2 runtime
dependencies: PyYAML and pathspec).

Resolves https://github.com/adrienverge/yamllint/issues/328.

[1]: https://github.com/pypa/setuptools/pull/1878
2020-09-30 09:43:31 +02:00
Adrien Vergé 16e0f9d7b2 yamllint version 1.25.0 2020-09-29 08:52:34 +02:00
Adrien Vergé 597e88bb7b docs: Make 'yaml-file' config documentation clearer
Related to https://github.com/adrienverge/yamllint/issues/311.
2020-09-02 18:23:51 +02:00
Adrien Vergé 8b758d4e7e yamllint version 1.24.2 2020-07-16 09:35:08 +02:00
Adrien Vergé 0fceca2354 yamllint version 1.24.1 2020-07-15 14:49:51 +02:00
Adrien Vergé 9403f1f3ec Revert "Add global "locale" config option"
This reverts commit 9e90c77, because it caused a bug that affected
different people just after being released:
https://github.com/adrienverge/yamllint/issues/285
https://github.com/adrienverge/yamllint/issues/286
2020-07-15 14:48:48 +02:00
Adrien Vergé 0016390e78 yamllint version 1.24.0 2020-07-15 11:50:36 +02:00
Adrien Vergé 954fdd5e8f style: Fix 'noqa' for flake8 3.8.0
There was a change in behavior of E402, see:
https://gitlab.com/pycqa/flake8/-/issues/638#note_345108633
2020-07-08 16:27:08 +02:00
Adrien Vergé 30c90dbf70 Add contribution instructions in CONTRIBUTING.rst
Closes https://github.com/adrienverge/yamllint/issues/263.
2020-05-03 16:51:22 +02:00
Adrien Vergé a54cbce1b6 yamllint version 1.23.0 2020-04-17 10:31:52 +02:00
Adrien VergéandLeo Feyer (https://github.com/adrienverge/yamllint/pull/246) b711fd993e quoted-strings: Add options extra-required and extra-allowed
Add ability to:
- require strings to be quoted if they match a pattern (PCRE regex)
- allow quoted strings if they match a pattern, while `require:
  only-when-needed` is enforced.

Co-Authored-By: Leo Feyer (https://github.com/adrienverge/yamllint/pull/246)
2020-04-17 10:29:55 +02:00
Adrien Vergé d68022b846 config: Allow generic types inside lists
For example it's possible to define a conf like:

    rule:
      foo: [str],
      bar: [int, bool, 'magic'],
2020-04-17 10:29:55 +02:00
Adrien Vergé 851d34b9fd config: Allow rules to validate their configuration 2020-04-17 10:29:55 +02:00
Adrien Vergé 483a8d89a5 yamllint version 1.22.1 2020-04-15 07:55:57 +02:00
Adrien Vergé fa87913566 quoted-strings: Fix only-when-needed on corner cases
Change implementation of `required: only-when-needed`, because
maintaining a list of `START_TOKENS` and just looking at the first
character of string values has proven to be partially broken.

Cf. discussion at
https://github.com/adrienverge/yamllint/pull/246#issuecomment-612354097.

Fixes https://github.com/adrienverge/yamllint/issues/242 and
https://github.com/adrienverge/yamllint/pull/244.
2020-04-15 07:48:59 +02:00
Adrien Vergé 961c496b4f yamllint version 1.22.0 2020-04-13 14:32:08 +02:00
Adrien Vergé ce7d3fcc7b quoted-strings: Remove test_quotes_required()
It is exactly the same tests as `test_quote_type_any()`.
2020-04-13 14:28:02 +02:00
Adrien Vergé 0bffba1e13 quoted-strings: Remove test_single_quotes_required()
It is exactly the same tests as `test_quote_type_single()`.
2020-04-13 14:28:02 +02:00
Adrien Vergé 2d8639c3a1 quoted-strings: Fix broken rule for list items
The rule worked for values like:

    flow-map: {a: foo, b: "bar"}
    block-map:
      a: foo
      b: "bar"

But not for:

    flow-seq: [foo, "bar"]
    block-seq:
      - foo
      - "bar"

Also add tests to make sure there will be no regression.

Fixes: #208.
2020-04-13 14:15:29 +02:00
Adrien Vergé e284d74be1 quoted-strings: Rename tests names for clarity
And move only-when-needed tests at the end for readability.
2020-04-13 14:15:29 +02:00
Adrien Vergé 1a13837e84 docs: Sunset Python 2
Keep supporting Python 2.7 for one extra year after upstream dropped it:
https://www.python.org/doc/sunset-python-2/
2020-04-09 16:29:43 +02:00
Adrien Vergé 46ed0c02be truthy: Add missing test removed from PR
See https://github.com/adrienverge/yamllint/pull/247#discussion_r405421376.
2020-04-08 12:31:12 +02:00
Adrien Vergé 542ae758f5 yamllint version 1.21.0 2020-03-24 07:53:14 +01:00
Adrien Vergé 044c7f0248 cli: Test unicode chars in paths too 2020-01-17 16:01:05 +01:00
Adrien Vergé 734d5d5f73 CI: Run tests on Python 3.8
Python 3.8 was released in October 2019.
2020-01-03 09:33:35 +01:00
Adrien Vergé 13a0f11e7c yamllint version 1.20.0 2019-12-26 16:06:29 +01:00
Adrien Vergé da3788e95a yamllint version 1.19.0 2019-11-19 11:28:21 +01:00
Adrien Vergé 92324ae730 yamllint version 1.18.0 2019-10-15 09:49:20 +02:00
Adrien Vergé b62b424dd4 feat: Lint .yamllint by default 2019-08-26 10:01:40 +02:00