@@ -9,15 +9,15 @@ Here is an example, to add in your .pre-commit-config.yaml
99
1010.. code :: yaml
1111
12- ---
13- # Update the rev variable with the release version that you want, from the yamllint repo
14- # You can pass your custom .yamllint with args attribute.
15- repos :
16- - repo : https://github.com/adrienverge/yamllint.git
17- rev : v1.29.0
18- hooks :
19- - id : yamllint
20- args : [--strict, -c=/path/to/.yamllint]
12+ ---
13+ # Update the rev variable with the release version that you want, from the yamllint repo
14+ # You can pass your custom .yamllint with args attribute.
15+ repos :
16+ - repo : https://github.com/adrienverge/yamllint.git
17+ rev : v1.29.0
18+ hooks :
19+ - id : yamllint
20+ args : [--strict, -c=/path/to/.yamllint]
2121
2222
2323 Integration with GitHub Actions
@@ -32,20 +32,20 @@ A minimal example workflow using GitHub Actions:
3232
3333.. code :: yaml
3434
35- ---
36- on : push # yamllint disable-line rule:truthy
35+ ---
36+ on : push # yamllint disable-line rule:truthy
3737
38- jobs :
39- lint :
40- runs-on : ubuntu-latest
41- steps :
42- - uses : actions/checkout@v3
38+ jobs :
39+ lint :
40+ runs-on : ubuntu-latest
41+ steps :
42+ - uses : actions/checkout@v3
4343
44- - name : Install yamllint
45- run : pip install yamllint
44+ - name : Install yamllint
45+ run : pip install yamllint
4646
47- - name : Lint YAML files
48- run : yamllint .
47+ - name : Lint YAML files
48+ run : yamllint .
4949
5050 Integration with GitLab
5151------------------------
@@ -57,38 +57,38 @@ report.
5757
5858.. code :: yaml
5959
60- ---
61- lint :
62- stage : lint
63- script :
64- - pip install yamllint
65- - mkdir reports
66- - >
67- yamllint -f parsable . | tee >(awk '
68- BEGIN {FS = ":"; ORS="\n"; first=1}
69- {
70- gsub(/^[ \t]+|[ \t]+$|"/, "", $4);
71- match($4, /^\[(warning|error)\](.*)\((.*)\)$/, a);
72- sev = (a[1] == "error" ? "major" : "minor");
73- if (first) {
74- first=0;
75- printf("[");
76- } else {
77- printf(",");
78- }
79- printf("{\"location\":{\"path\":\"%s\",\"lines\":{\"begin\":%s",\
80- "\"end\":%s}},\"severity\":\"%s\",\"check_name\":\"%s\","\
81- "\"categories\":[\"Style\"],\"type\":\"issue\","\
82- "\"description\":\"%s\"}", $1, $2, $3, sev, a[3], a[2]);
83- }
84- END { if (!first) printf("]\n"); }' > reports/codequality.json)
85- artifacts :
86- when : always
87- paths :
88- - reports
89- expire_in : 1 week
90- reports :
91- codequality : reports/codequality.json
60+ ---
61+ lint :
62+ stage : lint
63+ script :
64+ - pip install yamllint
65+ - mkdir reports
66+ - >
67+ yamllint -f parsable . | tee >(awk '
68+ BEGIN {FS = ":"; ORS="\n"; first=1}
69+ {
70+ gsub(/^[ \t]+|[ \t]+$|"/, "", $4);
71+ match($4, /^\[(warning|error)\](.*)\((.*)\)$/, a);
72+ sev = (a[1] == "error" ? "major" : "minor");
73+ if (first) {
74+ first=0;
75+ printf("[");
76+ } else {
77+ printf(",");
78+ }
79+ printf("{\"location\":{\"path\":\"%s\",\"lines\":{\"begin\":%s",\
80+ "\"end\":%s}},\"severity\":\"%s\",\"check_name\":\"%s\","\
81+ "\"categories\":[\"Style\"],\"type\":\"issue\","\
82+ "\"description\":\"%s\"}", $1, $2, $3, sev, a[3], a[2]);
83+ }
84+ END { if (!first) printf("]\n"); }' > reports/codequality.json)
85+ artifacts :
86+ when : always
87+ paths :
88+ - reports
89+ expire_in : 1 week
90+ reports :
91+ codequality : reports/codequality.json
9292
9393 Integration with Arcanist
9494-------------------------
@@ -98,13 +98,13 @@ You can configure yamllint to run on ``arc lint``. Here is an example
9898
9999.. code :: json
100100
101- {
102- "linters" : {
103- "yamllint" : {
104- "type" : " script-and-regex" ,
105- "script-and-regex.script" : " yamllint" ,
106- "script-and-regex.regex" : " /^(?P<line>\\ d+):(?P<offset>\\ d+) +(?P<severity>warning|error) +(?P<message>.*) +\\ ((?P<name>.*)\\ )$/m" ,
107- "include" : " (\\ .(yml|yaml)$)"
108- }
109- }
110- }
101+ {
102+ "linters" : {
103+ "yamllint" : {
104+ "type" : " script-and-regex" ,
105+ "script-and-regex.script" : " yamllint" ,
106+ "script-and-regex.regex" : " /^(?P<line>\\ d+):(?P<offset>\\ d+) +(?P<severity>warning|error) +(?P<message>.*) +\\ ((?P<name>.*)\\ )$/m" ,
107+ "include" : " (\\ .(yml|yaml)$)"
108+ }
109+ }
110+ }
0 commit comments