Adrien Vergé
46e9108419
Rules: indentation: Add 'consistent' option for 'indent-sequences'
...
Using `indent-sequences: consistent` allows block sequences to be
indented or not to be, as long as it remains the same within the file.
2016-03-06 15:42:16 +01:00
Adrien Vergé
9a7eec34b1
Rules: indentation: Fix spaces: consitent with broken flows
2016-03-06 08:26:09 +01:00
Adrien Vergé
5b62548ece
Tests: indentation: Use 'spaces: consistent' by default
2016-03-06 08:26:09 +01:00
Adrien Vergé
5693b1dddf
Rules: indentation: Add 'consistent' option for 'spaces'
...
Using `spaces: consistent` allows any number of spaces, as long as it
remains the same within the file.
2016-03-04 16:03:53 +01:00
Adrien Vergé
647d84ff94
Rules: indentation: Handle tags
2016-02-05 11:13:44 +01:00
Adrien Vergé
4bc3d5a01c
Rules: indentation: Handle anchors
2016-02-04 22:10:40 +01:00
Adrien Vergé
48c7d65c54
parser: Provide nextnext for token rules
...
Because the indentation rule sometimes needs to look two tokens forward
(in case of anchors for instance).
2016-02-04 22:10:40 +01:00
Adrien Vergé
62fa4cbe39
Tests: indentation: Test the indent stack
...
The "indentation stack" is iteratively built by the `check()` function
of the indentation rule. It is important, since everything in the rule
relies on it.
This patch adds tests to make sure the stack is correctly built for some
known structures.
2016-02-04 22:10:40 +01:00
Adrien Vergé
9a82b99d4b
Rules: indentation: Fix multi-line flows
...
To detect this as correct indentations:
top:
rules: [
{
foo: 1
},
{
foo: 2
bar: [
a, b, c
],
},
]
2016-02-03 12:05:22 +01:00
Adrien Vergé
6b5948c06b
Tests: Reorganize common and global tests
2016-02-01 16:56:32 +01:00
Adrien Vergé
dd163ed551
Rules: indentation: Fix flow sequences with multi-line scalars
...
Typically sequences like this:
["multi
line 1", "multi
line 2"]
2016-02-01 16:56:32 +01:00
Adrien Vergé
cae100071a
Rules: indentation: Add support for cleared sequence entries
...
The following construction is valid YAML, and its indentation should be
correctly handled:
- this is
-
a
-
sequence:
with cleared entries
2016-02-01 14:59:52 +01:00
Adrien Vergé
4410bc3e23
Rules: indentation: Fix check-multi-line-strings
...
For strings that continue on next line at a lower indentation level:
Blaise Pascal: Je vous écris une longue lettre parce que
je n'ai pas le temps d'en écrire une courte.
2016-01-25 11:01:42 +01:00
Adrien Vergé
1bfd18097a
Rules: indentation: Add 'check-multi-line-strings' option
...
This options allows the user to control whether to lint indentation
inside multi-line scalars or not.
When enabled, such YAML source will be detected as a problem:
- C code: void main() {
printf("foo");
}
whereas this one would not:
- C code: void main() {
printf("foo");
}
2016-01-22 14:23:37 +01:00
Adrien Vergé
67d13d60ae
Rules: indentation: Check multi-line scalars
2016-01-20 17:39:11 +01:00
Adrien Vergé
6a24781f96
Tests: indentation: Add explicit keys test cases
2016-01-20 10:45:52 +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é
39c878c819
Rules: indentation: Rewrite the algorithm (again)
...
Use a new, better thought algorithm that keeps an history stack with all
the parents indentations.
2016-01-19 19:42:56 +01:00
Adrien Vergé
222f7a27c1
Make syntax errors prevail over all yamllint problems
2016-01-19 17:18:57 +01:00
Adrien Vergé
e81b73c111
Rules: indentation: Rewrite algorithm
2016-01-14 20:57:35 +01:00
Adrien Vergé
350213b165
Initial commit
2016-01-14 10:46:14 +01:00