Commit Graph

10 Commits

Author SHA1 Message Date
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é
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é
6b5948c06b Tests: Reorganize common and global tests 2016-02-01 16:56:32 +01:00
Adrien Vergé
96465008ab Rules: Fix spaces_before when prev is multi-line scalar
YAML content like the following one produced an error, because the
multi-line ScalarToken ends at the beginning of the 4th line (the one
with the value):

    ? >
        multi-line
        key
    : value
2016-01-20 17:38:48 +01:00
Adrien Vergé
0b0251bacc Rules: indentation: Add the 'indent-sequences' option
Using either 'yes', 'no' or 'whatever', the user will be able to choose
whether to force block sequence items to be indented, to force them not
to be indented, or don't care, respectively.
2016-01-19 22:37:58 +01:00
Adrien Vergé
8288a6f331 Rules: colons: Apply to '?' also 2016-01-19 19:45:13 +01:00
Adrien Vergé
e81b73c111 Rules: indentation: Rewrite algorithm 2016-01-14 20:57:35 +01:00
Adrien Vergé
5c4c208b98 Rules: Add the 'braces' rule 2016-01-14 10:46:16 +01:00
Adrien Vergé
d08eb22081 Rules: Add the 'brackets' rule 2016-01-14 10:46:16 +01:00
Adrien Vergé
350213b165 Initial commit 2016-01-14 10:46:14 +01:00