Skip to content

Commit 2322ff6

Browse files
committed
ci(yamllint): add rule empty-values & use new yaml-files setting
* Semi-automated using myii/ssf-formula#27 * Fix (or ignore) errors shown below: ```bash mysql-formula$ yamllint -s . ./mysql/osfamilymap.yaml 46:14 error empty value in block mapping (empty-values) 66:14 error empty value in block mapping (empty-values) 67:14 error empty value in block mapping (empty-values) 68:16 error empty value in block mapping (empty-values) 69:17 error empty value in block mapping (empty-values) 70:16 error empty value in block mapping (empty-values) 87:7 error empty value in block mapping (empty-values) 216:14 error empty value in block mapping (empty-values) 217:17 error empty value in block mapping (empty-values) ./mysql/defaults.yaml 29:10 error empty value in block mapping (empty-values) 30:11 error empty value in block mapping (empty-values) ```
1 parent ef36766 commit 2322ff6

File tree

4 files changed

+30
-7
lines changed

4 files changed

+30
-7
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ jobs:
5656
before_install: skip
5757
script:
5858
# Install and run `yamllint`
59-
- pip install --user yamllint
60-
# yamllint disable-line rule:line-length
61-
- yamllint -s . .yamllint pillar.example test/salt/pillar/mysql.sls
59+
# Need at least `v1.17.0` for the `yaml-files` setting
60+
- pip install --user yamllint>=1.17.0
61+
- yamllint -s .
6262
# Install and run `commitlint`
6363
- npm install @commitlint/config-conventional -D
6464
- npm install @commitlint/travis-cli -D

.yamllint

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,26 @@ extends: default
66

77
# Files to ignore completely
88
# 1. All YAML files under directory `node_modules/`, introduced during the Travis run
9-
# 2. Any YAML files using Jinja (result in `yamllint` syntax errors)
9+
# 2. Any SLS files under directory `test/`, which are actually state files
10+
# 3. Any YAML files using Jinja (result in `yamllint` syntax errors)
1011
ignore: |
1112
node_modules/
13+
test/**/states/**/*.sls
1214
mysql/supported_sections.yaml
1315
16+
yaml-files:
17+
# Default settings
18+
- '*.yaml'
19+
- '*.yml'
20+
- .yamllint
21+
# SaltStack Formulas additional settings
22+
- '*.example'
23+
- test/**/*.sls
24+
1425
rules:
26+
empty-values:
27+
forbid-in-block-mappings: true
28+
forbid-in-flow-mappings: true
1529
line-length:
1630
# Increase from default of `80`
1731
# Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`)

mysql/defaults.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ mysql:
2626

2727
macos:
2828
userhomes: /Users
29-
user:
30-
group:
29+
# `user` and `group` are set from `map.jinja`
30+
# user: ~
31+
# group: ~
3132
dl:
3233
tmpdir: /tmp/mysqltmp
3334
prefix: /usr/local

mysql/osfamilymap.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ RedHat:
4343
config:
4444
file: /etc/my.cnf
4545
sections:
46-
client:
46+
client: {}
4747
mysqld_safe:
4848
log_error: /var/log/mysql/mysqld.log
4949
pid_file: /var/run/mysql/mysqld.pid
@@ -63,11 +63,14 @@ Suse:
6363
client:
6464
socket: /var/run/mysql/mysql.sock
6565
mysqld:
66+
# Empty values below to be resolved, disabling the rule in the meantime
67+
# yamllint disable rule:empty-values
6668
port:
6769
user:
6870
socket:
6971
datadir:
7072
tmpdir:
73+
# yamllint enable rule:empty-values
7174
innodb_file_format: Barracuda
7275
innodb_file_per_table: 'ON'
7376
server-id: 1
@@ -84,6 +87,8 @@ Arch:
8487
clientpkg: mariadb-clients
8588
service: mysqld
8689
pythonpkg: mysql-python
90+
# Empty value below to be resolved, disabling the rule in the meantime
91+
# yamllint disable-line rule:empty-values
8792
dev:
8893

8994
config:
@@ -213,8 +218,11 @@ FreeBSD:
213218
client:
214219
socket: /tmp/mysql.sock
215220
mysqld:
221+
# Empty values below to be resolved, disabling the rule in the meantime
222+
# yamllint disable rule:empty-values
216223
user:
217224
datadir:
225+
# yamllint enable rule:empty-values
218226
socket: /tmp/mysql.sock
219227
skip-external-locking: noarg_present
220228
key_buffer_size: 16M

0 commit comments

Comments
 (0)