Skip to content

Commit

Permalink
feat: Lint .yamllint by default
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienverge committed Aug 26, 2019
1 parent ce0336e commit b62b424
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ configuration option. The default is:
yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'
The same rules as for ignoring paths apply (``.gitignore``-style path pattern,
see below).
Expand Down
2 changes: 2 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,11 +448,13 @@ def test_run_with_ignored_path(self):
out = sys.stdout.getvalue()
out = '\n'.join(sorted(out.splitlines()))

docstart = '[warning] missing document start "---" (document-start)'
keydup = '[error] duplication of key "key" in mapping (key-duplicates)'
trailing = '[error] trailing spaces (trailing-spaces)'
hyphen = '[error] too many spaces after hyphen (hyphens)'

self.assertEqual(out, '\n'.join((
'./.yamllint:1:1: ' + docstart,
'./bin/file.lint-me-anyway.yaml:3:3: ' + keydup,
'./bin/file.lint-me-anyway.yaml:4:17: ' + trailing,
'./bin/file.lint-me-anyway.yaml:5:5: ' + hyphen,
Expand Down
1 change: 1 addition & 0 deletions yamllint/conf/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
braces: enable
Expand Down
2 changes: 1 addition & 1 deletion yamllint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, content=None, file=None):
self.ignore = None

self.yaml_files = pathspec.PathSpec.from_lines(
'gitwildmatch', ['*.yaml', '*.yml'])
'gitwildmatch', ['*.yaml', '*.yml', '.yamllint'])

if file is not None:
with open(file) as f:
Expand Down

0 comments on commit b62b424

Please sign in to comment.