Commit Graph

433 Commits

Author SHA1 Message Date
Adrien Vergé
6a24781f96 Tests: indentation: Add explicit keys test cases 2016-01-20 10:45:52 +01:00
Adrien Vergé
33224a04e4 yamllint version 0.3.0 2016-01-19 22:58:59 +01:00
Adrien Vergé
fd9d2a00ff Doc: Update README with examples 2016-01-19 22:57:12 +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é
fb14cbdbd9 Config: Allow options to be in a pre-defined list 2016-01-19 21:12:11 +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é
d617eb70ae Rules: Keep a persistent context for token rules
This will be needed to build a clean indentation checking algorithm.
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é
01c12f2462 Syntax errors: Use the BaseLoader for safety 2016-01-19 16:35:57 +01:00
Adrien Vergé
918f15b68d Make syntax errors prevail over yamllint 'warnings'
When both a syntax error (unability to parse a document) and a cosmetic
yamllint problem are found at the same place, the yamllint problem had
the priority -- and the syntax error was not displayed.

This had the following problem: if a rule is at the 'warning' level, its
problems will not make the `yamllint` script return a failure return
code (`!= 0`), even when it should (because there was a syntax error,
precisely).

This commit changes this behavior by preferring yamllint problems only
when they have the 'error' level.
2016-01-15 18:46:49 +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é
1934206cef Rules: comments-indentation: Fix typo 2016-01-15 18:46:40 +01:00
Adrien Vergé
1235eba94e yamllint version 0.2.0 2016-01-15 09:39:50 +01:00
Adrien Vergé
11a14d4df8 Distribution: Update program description 2016-01-14 21:08:10 +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é
cfea0661ed Rules: Make max-spaces-* generic
The goal being to use them in the 'colons', 'hyphens', 'commas', etc.
rules.
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é
e2d68dac14 Tests: Travis and Coveralls integration 2016-01-14 10:46:16 +01:00
Adrien Vergé
47b44fe56c Distribution: Add a setup.py script 2016-01-14 10:46:16 +01:00
Adrien Vergé
350213b165 Initial commit 2016-01-14 10:46:14 +01:00