Commit Graph

12 Commits (2c6493c2e982716fc3d40e01cb98b12298a8c0c5)

Author SHA1 Message Date
Adrien Vergé fec2c2fba7 fix(parser): Correctly handle DOS new lines in 'line' rules
Do not consider the trailing `\r` of a line a part of it.
6 years ago
Hugo c281d48507 Drop support for EOL Python 2.6 6 years ago
Adrien Vergé c8032c086b line-length: Add tests for lines containing unicode characters
Some unicode characters span accross multiple bytes. Python 3 is OK with
that, but Python 2 reports an incorrect number of characters.

Related to https://github.com/adrienverge/yamllint/issues/146
6 years ago
Adrien Vergé 21e81b6435 fix(rules): Use `true`/`false`, not `yes`/`no`
Although `yes` and `no` are recognized as booleans by the pyyaml parser,
the correct keywords are `true` and `false` (as highlighted by the newly
added `truthy` rule).

This commit replaces the use of `yes`/`no` by `true`/`false` and
advertise it in the docs, but also makes sure this change is
backward-compatible (so that `yes` and `no` still work).
8 years ago
Adrien Vergé f656cf42d2 fix(line-length): Wrap token scanning securely
With `allow-non-breakable-inline-mappings` enabled, every long line is
passed through `loader.peek_token()`. Even lines that are not valid
YAML. For this reason, this code must be wrapped in a `try`/`except`
block.

Closes: #21
8 years ago
Adrien Vergé d3cd8ba332 line-length: Generalize ...-inline-mappings for corner cases
This commit refactors the `allow-non-breakable-inline-mappings` logic to
use YAML tokens and avoid crashes or erroneous reports on cases like:

```yaml
- {a: "http://localhost/very/very/very/very/very/very/long/url"
   }
```

```yaml
dict:
  {a: long long long long long long long, b: nospace}
```

```yaml
- long_line: http://localhost/very/very/long/url
```

```yaml
long_line: and+some+space+at+the+end       <-- extra spaces
```

For reference see:
https://github.com/adrienverge/yamllint/pull/17#issuecomment-247805799
8 years ago
Allan Lewis e56a7c788c line_length: Extract inline logic to new config option
This commit extracts the inline mappings logic defined in the previous
commit to a separate config option, as suggested by @adrienverge. I'll
squash this into the previous commit if the change is accepted. (I named
the option slightly differently to what was suggested as I think my
proposal reads better without consulting the docs: I'd be happy to
reconsider this.)
8 years ago
Allan Lewis d017631aff line_length: Allow mapping values with long unbreakable lines 8 years ago
Michele Bariani 867970258e Patch allow-non-breakable-words on '-' 9 years ago
Adrien Vergé 6b5948c06b Tests: Reorganize common and global tests 9 years ago
Adrien Vergé 97c446907c Rules: line-length: Add option `allow-non-breakable-words` 9 years ago
Adrien Vergé 350213b165 Initial commit 9 years ago