Skip to content

Commit

Permalink
feat(yamllint): add .git/ to ignores
Browse files Browse the repository at this point in the history
https://gitlab.com/myii/openvpn-formula/-/jobs/1076814969#L135

```
Check YAML syntax with yamllint..........................................Failed
- hook id: yamllint
- duration: 1.17s
- exit code: 1
./.git/refs/remotes/origin/ci/move-to-kitchen.windows.yml
  1:1       warning  missing document start "---"  (document-start)
./.git/logs/refs/remotes/origin/ci/move-to-kitchen.windows.yml
  1:89      error    line too long (378 > 88 characters)  (line-length)
  1:164     error    syntax error: found character '\t' that cannot start any token (syntax)
```

Happened when the branch name ended in `.yml`; shouldn't be checking
under `.git/` anyway.
  • Loading branch information
myii committed Mar 5, 2021
1 parent 9db4753 commit c8fc3dd
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 114 deletions.
11 changes: 7 additions & 4 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
extends: 'default'

# 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
# 3. Any YAML files under directory `.kitchen/`, introduced during local testing
# 4. All Jinja templates under `ssf/files/` (result in `yamllint` syntax errors)
# 1. All YAML files under directory `.cache/`, introduced during the GitLab CI run
# 2. All YAML files under directory `.git/`
# 3. All YAML files under directory `node_modules/`, introduced during the Travis run
# 4. Any SLS files under directory `test/`, which are actually state files
# 5. Any YAML files under directory `.kitchen/`, introduced during local testing
# 6. 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
ignore: |
.cache/
.git/
node_modules/
test/**/states/**/*.sls
.kitchen/
Expand Down
5 changes: 3 additions & 2 deletions ssf/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ ssf_node_anchors:
# An alternative method could be to use:
# `git describe --abbrev=0 --tags`
# yamllint disable rule:line-length rule:quoted-strings
title: "chore(rubocop): allow use of '`'YAML.load'`' for '`'_mapdata.rb'`' [skip ci]"
body: '* Automated using https://github.com/myii/ssf-formula/pull/296'
title: "chore(yamllint): add '`'.git/'`' to ignores [skip ci]"
body: '* Automated using https://github.com/myii/ssf-formula/pull/297'
# yamllint enable rule:line-length rule:quoted-strings
github:
owner: 'saltstack-formulas'
Expand Down Expand Up @@ -237,6 +237,7 @@ ssf_node_anchors:
ignore:
default:
- '.cache/'
- '.git/'
- 'node_modules/'
additional_ssf:
- 'test/**/states/**/*.sls'
Expand Down
26 changes: 19 additions & 7 deletions ssf/files/default/.yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,21 @@ ignore: |
{%- endfilter %}
{%- endmacro %}
# Extend the `{{ yamllint.extends }}` configuration provided by `yamllint`
extends: {{ yamllint.extends }}
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
# 3. Any YAML files under directory `.kitchen/`, introduced during local testing
# 1. All YAML files under directory `.cache/`, introduced during the GitLab CI run
# 2. All YAML files under directory `.git/`
# 3. All YAML files under directory `node_modules/`, introduced during the Travis run
# 4. Any SLS files under directory `test/`, which are actually state files
# 5. Any YAML files under directory `.kitchen/`, introduced during local testing
{%- if semrel_formula == 'ssf' %}
# 4. All Jinja templates under `ssf/files/` (result in `yamllint` syntax errors)
# 6. 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' %}
# 4. Any YAML files using Jinja (result in `yamllint` syntax errors)
# 6. Any YAML files using Jinja (result in `yamllint` syntax errors)
{%- elif semrel_formula in ['postgres', 'salt'] %}
# 4. All YAML files heavily reliant on Jinja; these can be tackled in a subsequent PR
# 6. All YAML files heavily reliant on Jinja; these can be tackled in a subsequent PR
{%- endif %}
{%- set yl_ignores = {'ignore':
yamllint.ignore.default +
Expand Down Expand Up @@ -91,3 +93,13 @@ rules:
{{- format_ignore(yl_ov) }}
forbid-implicit-octal: {{ yl_ov.get('forbid-implicit-octal') }}
forbid-explicit-octal: {{ yl_ov.get('forbid-explicit-octal') }}
{%- if semrel_formula == 'ssf' %}
{#- TODO: Arrange this section as all of the others above #}
# yamllint disable rule:comments-indentation
# Disable this rule for the time being due to numerous violations detected after
# update to `1.22.0` (Fix quoted-strings rule not working on sequences items), see:
# https://github.com/adrienverge/yamllint/blob/master/CHANGELOG.rst#1220-2020-04-13
# quoted-strings:
# quote-type: 'single'
# yamllint enable rule:comments-indentation
{%- endif %}
101 changes: 0 additions & 101 deletions ssf/files/tofs_ssf-formula/.yamllint

This file was deleted.

0 comments on commit c8fc3dd

Please sign in to comment.