Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 34d738e

Browse files
committed
Merge pull request #77 from adrienverge/add-yamllint-linter
Use yamllint to check YAML source
2 parents ce55ff5 + a7dc229 commit 34d738e

File tree

8 files changed

+28
-42
lines changed

8 files changed

+28
-42
lines changed

README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Current linters:
7373

7474
- YAML
7575

76-
* Custom via `PyYAML <http://pyyaml.org/>`_
76+
* `yamllint <https://github.com/adrienverge/yamllint>`_
7777

7878
- INI
7979

@@ -256,6 +256,7 @@ Contributors
256256

257257
* `Rovanion Luckey <https://github.com/Rovanion>`_
258258
* `Radek Simko <https://github.com/radeksimko>`_
259+
* `Adrien Vergé <https://github.com/adrienverge>`_
259260

260261

261262
Changelog

gitlint/configs/config.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,19 @@ yaml:
180180
extensions:
181181
- .yaml
182182
- .yml
183-
command: yaml_linter.py
184-
filter: "(?P<message>.+)$"
185-
installation: "Run pip install PyYAML."
183+
command: yamllint
184+
arguments:
185+
- "--format"
186+
- "parsable"
187+
- "--config-data"
188+
- "relaxed"
189+
# Matches either:
190+
# - syntax error, on any line
191+
# - other error, on a modified line only
192+
filter: "^{filename}:(?P<line>{lines}|\\d+\
193+
(?=:\\d+: \\[error\\] syntax error:)):(?P<column>\\d+): \
194+
\\[(?P<severity>\\S+)\\] (?P<message>.+)$"
195+
installation: "Run pip install yamllint."
186196

187197
# INI
188198
ini:

scripts/custom_linters/yaml_linter.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

scripts/install-linters.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ gem install scss-lint
2626
pip install http://closure-linter.googlecode.com/files/closure_linter-latest.tar.gz
2727
pip install pylint
2828
pip install pep8
29-
pip install pyYAML
29+
pip install yamllint
3030
pip install docutils
3131
pip install html-linter
3232

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
'scripts/pre-commit.git-lint.sh',
3232
'scripts/pre-commit.hg-lint.sh',
3333
'scripts/custom_linters/ini_linter.py',
34-
'scripts/custom_linters/yaml_linter.py',
3534
'scripts/custom_linters/jpegtran-linter.sh',
3635
'scripts/custom_linters/optipng-linter.sh',
3736
'scripts/custom_linters/pngcrush-linter.sh',

test/e2etest/data/yaml/error.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
already-present error:
2+
duplicated-key: number 1
3+
duplicated-key: number 2
4+
15
"foo": "bar
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
already-present error:
2+
duplicated-key: number 1
3+
duplicated-key: number 2
4+
15
"foo": "bar"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
already-present error:
2+
duplicated-key: number 1
3+
duplicated-key: number 2
4+
15
"foo"

0 commit comments

Comments
 (0)