Adrien Vergé
6c8af97a40
Tests: unblacklist remaining spec examples
...
Since !!tags are now supported.
2016-02-05 11:14:37 +01:00
Adrien Vergé
647d84ff94
Rules: indentation: Handle tags
2016-02-05 11:13:44 +01:00
Adrien Vergé
8eb0d0ad74
Tests: unblacklist spec example 7.16
...
As is it supported -- it just lacks some indentation.
2016-02-05 09:52:09 +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é
ba140ad42c
Tests: Remove ghost character from YAML spec example
2016-02-01 23:27:49 +01:00
Adrien Vergé
f6bab05e8a
Rules: Add the 'key-duplicates' rule
2016-02-01 22:26:18 +01:00
Adrien Vergé
c16eec4681
Style: Fix indentation not multiple of four
2016-02-01 21:36:35 +01:00
Adrien Vergé
68618be4cc
Rules: indentation: Handle sets
...
Sets are like mappings, that do not contain values. Example:
set:
? key one
? key two
? [non, scalar, key]
2016-02-01 17:52:46 +01:00
Adrien Vergé
431a379c81
Tests: Add tests from YAML 1.2 specification
...
Write all examples from http://www.yaml.org/spec/1.2/spec.html in
independent files in tests/yaml-1.2-spec-examples; and test them with
yamllint.
2016-02-01 17: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é
14c99da2bb
Tests: Add test cases for empty flows
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é
7cb7b4f669
Rules: commas: Add 'min-spaces-after'
...
Since such constructions are allowed and valid YAML:
- [one,two, three,four]
this commit adds a `min-spaces-after` option that defaults to 1.
2016-02-01 12:13:10 +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é
97c446907c
Rules: line-length: Add option allow-non-breakable-words
2016-01-24 22:46:10 +01:00
Adrien Vergé
5ed496f471
Distribution: Remove unneeded setup_requires
...
With the new project layout, `pyyaml` is not needed anymore for parsing
setup.py.
2016-01-24 17:57:11 +01:00
Adrien Vergé
7b147cb411
Tests: Remove Python 2.6 from CI tests
...
Because:
1. It is old. VERY old.
2. Some useful methods (`assertRaisesRegexp`, `assertIsInstance`) are
only available from Python 2.7.
2016-01-24 17:39:36 +01:00
Adrien Vergé
fc108e7cee
Config: Refactor to use YamlLintConfig objects
2016-01-24 17:39:27 +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é
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é
847f7e3fff
Rules: comments: Fix bug when multi-line scalar
...
YAML content like the following one produced an error, because the
ScalarToken associated whose value is "this is plain text" ends at the
beginning of the 5th line (the one with the comment):
---
string: >
this is plain text
# comment
2016-01-20 10:45:59 +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é
ad5cec9c6c
Config: Allow overriding only one option when extending
2016-01-19 21:49:58 +01:00
Adrien Vergé
8288a6f331
Rules: colons: Apply to '?' also
2016-01-19 19:45:13 +01:00
Adrien Vergé
9d8b0d4d2c
Rules: commas: Don't allow a comma on a new line
...
Forbid such constructions:
[ a, b, c
, d, e ]
2016-01-19 19:42:56 +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é
effb4db3b4
Tests: Rules: Remove unused line and column args
...
Now that every test case use the `problem=(x, y)` syntax.
2016-01-19 17:18:57 +01:00
Adrien Vergé
f09aef4f89
Rules: comments-indentation: Allow two levels
...
Previously only comments that were indented like the following content
line were allowed, e.g.:
prev: line:
# commented line
current: line
With this change, such new cases are also allowed:
prev: line
# commented line 1
# commented line 2
current: line
2016-01-19 17:18:57 +01:00
Adrien Vergé
97e2210ec9
Don't treat non-importable YAML as syntax error
...
`yaml.load()` exceptions are not necessarily syntax errors. For
instance, the following YAML source cannot be `load()`ed into a Python
object, but is valid nonetheless:
? - Detroit Tigers
- Chicago cubs
:
- 2001-07-23
? [ New York Yankees,
Atlanta Braves ]
: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
This commit detects syntax errors from `yaml.parse()` exceptions rather
than `yaml.load_all()`.
2016-01-15 18:46:49 +01:00
Adrien Vergé
233a70adb3
Rules: Add the 'comments-indentation' rule
2016-01-14 21:04:41 +01:00
Adrien Vergé
e81b73c111
Rules: indentation: Rewrite algorithm
2016-01-14 20:57:35 +01:00
Adrien Vergé
3989a09d32
Rules: comments: Allow empty comments
2016-01-14 19:58:35 +01:00
Adrien Vergé
5cc900f2a8
Rules: document-start: Allow directives
2016-01-14 19:58:05 +01:00
Adrien Vergé
851b9ac42c
Rules: Add the 'comments' rule
2016-01-14 11:17:01 +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é
a5b384ab21
Rules: Add the 'commas' rule
2016-01-14 10:46:16 +01:00
Adrien Vergé
07c5b4177c
Rewrite syntax errors handling and test them
...
If a syntax errors occurs at the same place than a regular yamllint rule
error, only the yamllint one is issued.
2016-01-14 10:46:16 +01:00
Adrien Vergé
bf96bdde01
Tests: Remove assertIsInstance to support Python 2.6
2016-01-14 10:46:16 +01:00
Adrien Vergé
350213b165
Initial commit
2016-01-14 10:46:14 +01:00