From 9775305bce7cc274212db88a8cd0b75694884d10 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 10 Sep 2019 05:53:26 +0100 Subject: [PATCH] ci(yamllint): add rule `empty-values` & use new `yaml-files` setting * Semi-automated using https://github.com/myii/ssf-formula/pull/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) ``` --- .travis.yml | 6 +++--- .yamllint | 16 +++++++++++++++- mysql/defaults.yaml | 5 +++-- mysql/osfamilymap.yaml | 7 ++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5b346ef4..2b11670f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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/mysql.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 diff --git a/.yamllint b/.yamllint index 8cee7a46..d3330993 100644 --- a/.yamllint +++ b/.yamllint @@ -6,12 +6,26 @@ extends: default # Files to ignore completely # 1. All YAML files under directory `node_modules/`, introduced during the Travis run -# 2. Any YAML files using Jinja (result in `yamllint` syntax errors) +# 2. Any SLS files under directory `test/`, which are actually state files +# 3. Any YAML files using Jinja (result in `yamllint` syntax errors) ignore: | node_modules/ + test/**/states/**/*.sls mysql/supported_sections.yaml +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`) diff --git a/mysql/defaults.yaml b/mysql/defaults.yaml index 0e960371..83f556dc 100644 --- a/mysql/defaults.yaml +++ b/mysql/defaults.yaml @@ -26,8 +26,9 @@ mysql: macos: userhomes: /Users - user: - group: + # `user` and `group` are set from `map.jinja` + # user: ~ + # group: ~ dl: tmpdir: /tmp/mysqltmp prefix: /usr/local diff --git a/mysql/osfamilymap.yaml b/mysql/osfamilymap.yaml index 9e032db5..6f84d318 100644 --- a/mysql/osfamilymap.yaml +++ b/mysql/osfamilymap.yaml @@ -43,7 +43,7 @@ RedHat: config: file: /etc/my.cnf sections: - client: + client: {} mysqld_safe: log_error: /var/log/mysql/mysqld.log pid_file: /var/run/mysql/mysqld.pid @@ -63,11 +63,13 @@ Suse: client: socket: /var/run/mysql/mysql.sock mysqld: + # yamllint disable rule:empty-values port: user: socket: datadir: tmpdir: + # yamllint enable rule:empty-values innodb_file_format: Barracuda innodb_file_per_table: 'ON' server-id: 1 @@ -84,6 +86,7 @@ Arch: clientpkg: mariadb-clients service: mysqld pythonpkg: mysql-python + # yamllint disable-line rule:empty-values dev: config: @@ -213,8 +216,10 @@ FreeBSD: client: socket: /tmp/mysql.sock mysqld: + # yamllint disable rule:empty-values user: datadir: + # yamllint enable rule:empty-values socket: /tmp/mysql.sock skip-external-locking: noarg_present key_buffer_size: 16M