Commit Graph

6 Commits (15f820442788d6015793eddb8baced7f061fd19b)

Author SHA1 Message Date
Jan Wille 7d9c824b83 new-lines: add `type: platform` config option
The new option infers the correct newline character(s) from the
operating system running yamllint.
3 years ago
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.
3 years ago
Brad Solomon 512fe17047
Fix bug with CRLF in new-lines and require-starting-space
Pound-signs followed by a lone CRLF should not
raise if require-starting-space is specified.

If require-starting-space is true, *and* either:
- new-lines: disbale, or
- newlines: type: dos
is specified, a line with `#\r` or `#\r\n` should
not raise a false positive.

This commit also uses a Set for O(1) membership testing
and uses the correct escape sequence for the nul byte.

If we find a CRLF when looking for Unix newlines, yamllint
should always raise, regardless of logic with
require-starting-space.

Closes: Issue #171.
5 years ago
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
Adrien Vergé 6b5948c06b Tests: Reorganize common and global tests 9 years ago
Adrien Vergé 350213b165 Initial commit 9 years ago