Skip to content

Commit 534b0eb

Browse files
committed
refactor(yamllint): restructure ignores like yaml-files
1 parent 5d3bbf1 commit 534b0eb

File tree

3 files changed

+32
-21
lines changed

3 files changed

+32
-21
lines changed

ssf/defaults.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ ssf_node_anchors:
116116
use_tofs: false
117117
yamllint:
118118
extends: default
119-
ignore: []
119+
ignore:
120+
default:
121+
- 'node_modules/'
122+
additional_ssf:
123+
- 'test/**/states/**/*.sls'
124+
additional: []
120125
yaml-files:
121126
default:
122127
- '*.yaml'

ssf/files/default/.yamllint

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# -*- coding: utf-8 -*-
22
# vim: ft=yaml
33
---
4-
{%- macro format_ignore(ignore_parent, first_ignores=[], width=4) %}
4+
{%- macro format_ignore(ignore_parent, width=4) %}
55
{%- filter indent(width) %}
66
{%- if ignore_parent.ignore is defined %}
77
ignore: |
8-
{%- for first_ignore in first_ignores %}
9-
{{ first_ignore }}
10-
{%- endfor %}
118
{%- for file in ignore_parent.ignore %}
129
{{ file }}
1310
{%- endfor %}
@@ -19,15 +16,21 @@ extends: {{ yamllint.extends }}
1916

2017
# Files to ignore completely
2118
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
19+
# 2. Any SLS files under directory `test/`, which are actually state files
2220
{%- if semrel_formula == 'ssf' %}
23-
# 2. All Jinja templates under `ssf/files/` (result in `yamllint` syntax errors)
21+
# 3. All Jinja templates under `ssf/files/` (result in `yamllint` syntax errors)
2422
# Not disabling via. `*.yml` since we may end up with non-Jinja YAML files here
2523
{%- elif semrel_formula == 'mysql' %}
26-
# 2. Any YAML files using Jinja (result in `yamllint` syntax errors)
24+
# 3. Any YAML files using Jinja (result in `yamllint` syntax errors)
2725
{%- elif semrel_formula == 'postgres' %}
28-
# 2. All YAML files heavily reliant on Jinja; these can be tackled in a subsequent PR
26+
# 3. All YAML files heavily reliant on Jinja; these can be tackled in a subsequent PR
2927
{%- endif %}
30-
{{- format_ignore(yamllint, first_ignores=['node_modules/'], width=0) }}
28+
{%- set yl_ignores = {'ignore':
29+
yamllint.ignore.default +
30+
yamllint.ignore.additional_ssf +
31+
yamllint.ignore.additional
32+
} %}
33+
{{- format_ignore(yl_ignores, width=0) }}
3134

3235
yaml-files:
3336
{%- set yl_yf = yamllint.get('yaml-files') %}

ssf/formulas.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,8 @@ ssf:
678678
- [debian , 8 , 2017.7, 2, default]
679679
yamllint:
680680
ignore:
681-
- mysql/supported_sections.yaml
681+
additional:
682+
- mysql/supported_sections.yaml
682683
semrel_files: *semrel_files_default
683684
nginx:
684685
context:
@@ -854,12 +855,13 @@ ssf:
854855
use_tofs: true
855856
yamllint:
856857
ignore:
857-
- pillar.example
858-
- postgres/codenamemap.yaml
859-
- postgres/osfamilymap.yaml
860-
- postgres/osmap.yaml
861-
- postgres/repo.yaml
862-
- test/salt/pillar/postgres.sls
858+
additional:
859+
- pillar.example
860+
- postgres/codenamemap.yaml
861+
- postgres/osfamilymap.yaml
862+
- postgres/osmap.yaml
863+
- postgres/repo.yaml
864+
- test/salt/pillar/postgres.sls
863865
semrel_files: *semrel_files_default
864866
prometheus:
865867
context:
@@ -935,11 +937,12 @@ ssf:
935937
use_tofs: true
936938
yamllint:
937939
ignore:
938-
- ssf/files/default/.cirrus.yml
939-
- ssf/files/default/.travis.yml
940-
- ssf/files/default/.yamllint
941-
- ssf/files/default/kitchen.yml
942-
- ssf/files/default/inspec/inspec.yml
940+
additional:
941+
- ssf/files/default/.cirrus.yml
942+
- ssf/files/default/.travis.yml
943+
- ssf/files/default/.yamllint
944+
- ssf/files/default/kitchen.yml
945+
- ssf/files/default/inspec/inspec.yml
943946
rules:
944947
commas:
945948
ignore:

0 commit comments

Comments
 (0)