Skip to content

Commit

Permalink
ci(yamllint): add rule empty-values & use new yaml-files setting
Browse files Browse the repository at this point in the history
* Semi-automated using myii/ssf-formula#27
* Fix errors shown below:

```bash
vim-formula$ yamllint -s .
./pillar.example
  21:8      error    empty value in block mapping  (empty-values)
  22:9      error    empty value in block mapping  (empty-values)
  23:8      error    empty value in block mapping  (empty-values)
  25:13     error    empty value in block mapping  (empty-values)
  26:15     error    empty value in block mapping  (empty-values)
  27:15     error    empty value in block mapping  (empty-values)
  28:15     error    empty value in block mapping  (empty-values)
  29:15     error    empty value in block mapping  (empty-values)
  30:12     error    empty value in block mapping  (empty-values)
  32:12     error    empty value in block mapping  (empty-values)
  34:18     error    empty value in block mapping  (empty-values)
  35:18     error    empty value in block mapping  (empty-values)
  37:8      error    empty value in block mapping  (empty-values)
  38:8      error    empty value in block mapping  (empty-values)
  39:13     error    empty value in block mapping  (empty-values)
  43:12     error    empty value in block mapping  (empty-values)

./test/salt/pillar/vim.sls
  7:12      error    empty value in block mapping  (empty-values)
```
  • Loading branch information
myii committed Sep 10, 2019
1 parent 7c61040 commit f5e8b84
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ jobs:
before_install: skip
script:
# Install and run `yamllint`
- pip install --user yamllint
# yamllint disable-line rule:line-length
- yamllint -s . .yamllint pillar.example test/salt/pillar/vim.sls
# Need at least `v1.17.0` for the `yaml-files` setting
- pip install --user yamllint>=1.17.0
- yamllint -s .
# Install and run `commitlint`
- npm install @commitlint/config-conventional -D
- npm install @commitlint/travis-cli -D
Expand Down
14 changes: 14 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,24 @@ 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
ignore: |
node_modules/
test/**/states/**/*.sls
yaml-files:
# Default settings
- '*.yaml'
- '*.yml'
- .yamllint
# SaltStack Formulas additional settings
- '*.example'
- test/**/*.sls

rules:
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
line-length:
# Increase from default of `80`
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)
Expand Down
34 changes: 18 additions & 16 deletions pillar.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
vim:
managed_vimrc: true
Expand All @@ -18,29 +20,29 @@ vim:
/srv/*.map: 'set filetype=sls'

settings:
et:
cin:
ru:
et: ~
cin: ~
ru: ~
bs: indent,eol,start
showcmd:
showmatch:
smartcase:
incsearch:
autowrite:
hidden:
showcmd: ~
showmatch: ~
smartcase: ~
incsearch: ~
autowrite: ~
hidden: ~
mouse: a
number:
number: ~
backspace: 2
noerrorbells:
novisualbell:
noerrorbells: ~
novisualbell: ~
background: dark
ai:
si:
cindent:
ai: ~
si: ~
cindent: ~
tabstop: 8
softtabstop: 8
shiftwidth: 8
nowrap:
nowrap: ~
swapsync: ''

mappings:
Expand Down
4 changes: 3 additions & 1 deletion test/salt/pillar/vim.sls
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
# vim: ft=yaml
---
vim:
managed_vimrc: true
config:
syntax: 'on'
settings:
number:
number: ~

0 comments on commit f5e8b84

Please sign in to comment.