Skip to content

Commit

Permalink
refactor(yamllint): restructure ignores like yaml-files
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Sep 10, 2019
1 parent 5d3bbf1 commit 534b0eb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 21 deletions.
7 changes: 6 additions & 1 deletion ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,12 @@ ssf_node_anchors:
use_tofs: false
yamllint:
extends: default
ignore: []
ignore:
default:
- 'node_modules/'
additional_ssf:
- 'test/**/states/**/*.sls'
additional: []
yaml-files:
default:
- '*.yaml'
Expand Down
19 changes: 11 additions & 8 deletions ssf/files/default/.yamllint
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
{%- macro format_ignore(ignore_parent, first_ignores=[], width=4) %}
{%- macro format_ignore(ignore_parent, width=4) %}
{%- filter indent(width) %}
{%- if ignore_parent.ignore is defined %}
ignore: |
{%- for first_ignore in first_ignores %}
{{ first_ignore }}
{%- endfor %}
{%- for file in ignore_parent.ignore %}
{{ file }}
{%- endfor %}
Expand All @@ -19,15 +16,21 @@ extends: {{ yamllint.extends }}

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

yaml-files:
{%- set yl_yf = yamllint.get('yaml-files') %}
Expand Down
27 changes: 15 additions & 12 deletions ssf/formulas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,8 @@ ssf:
- [debian , 8 , 2017.7, 2, default]
yamllint:
ignore:
- mysql/supported_sections.yaml
additional:
- mysql/supported_sections.yaml
semrel_files: *semrel_files_default
nginx:
context:
Expand Down Expand Up @@ -854,12 +855,13 @@ ssf:
use_tofs: true
yamllint:
ignore:
- pillar.example
- postgres/codenamemap.yaml
- postgres/osfamilymap.yaml
- postgres/osmap.yaml
- postgres/repo.yaml
- test/salt/pillar/postgres.sls
additional:
- pillar.example
- postgres/codenamemap.yaml
- postgres/osfamilymap.yaml
- postgres/osmap.yaml
- postgres/repo.yaml
- test/salt/pillar/postgres.sls
semrel_files: *semrel_files_default
prometheus:
context:
Expand Down Expand Up @@ -935,11 +937,12 @@ ssf:
use_tofs: true
yamllint:
ignore:
- ssf/files/default/.cirrus.yml
- ssf/files/default/.travis.yml
- ssf/files/default/.yamllint
- ssf/files/default/kitchen.yml
- ssf/files/default/inspec/inspec.yml
additional:
- ssf/files/default/.cirrus.yml
- ssf/files/default/.travis.yml
- ssf/files/default/.yamllint
- ssf/files/default/kitchen.yml
- ssf/files/default/inspec/inspec.yml
rules:
commas:
ignore:
Expand Down

0 comments on commit 534b0eb

Please sign in to comment.