From 073f66eef0198760f2bf8865d27b8562d7165deb Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 6 Aug 2019 21:00:10 +0100 Subject: [PATCH] feat(yamllint): include for this repo and apply rules throughout * Semi-automated using `ssf-formula` (v0.5.0) * Fix errors shown below: ```bash vault-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") ./kitchen.yml 20:89 error line too long (96 > 88 characters) (line-length) ./vault/defaults.yaml 4:1 warning missing document start "---" (document-start) 9:13 warning truthy value should be one of [false, true] (truthy) 10:20 warning truthy value should be one of [false, true] (truthy) 12:14 warning truthy value should be one of [false, true] (truthy) ./vault/osfamilymap.yaml 4:1 warning missing document start "---" (document-start) ./vault/initfamilymap.yaml 4:1 warning missing document start "---" (document-start) pillar.example 4:1 warning missing document start "---" (document-start) 7:13 warning truthy value should be one of [false, true] (truthy) 8:20 warning truthy value should be one of [false, true] (truthy) 54:1 error too many blank lines (1 > 0) (empty-lines) test/salt/pillar/install_binary.sls 1:1 warning missing document start "---" (document-start) 2:89 error line too long (110 > 88 characters) (line-length) 4:20 warning truthy value should be one of [false, true] (truthy) test/salt/pillar/dev_server.sls 1:1 warning missing document start "---" (document-start) 2:13 warning truthy value should be one of [false, true] (truthy) test/salt/pillar/prod_server.sls 1:1 warning missing document start "---" (document-start) 8:14 warning truthy value should be one of [false, true] (truthy) ``` --- .travis.yml | 13 +++++++++---- .yamllint | 16 ++++++++++++++++ kitchen.yml | 3 ++- pillar.example | 9 ++++----- test/integration/dev_server/inspec.yml | 3 +++ test/integration/install_binary/inspec.yml | 3 +++ test/integration/prod_server/inspec.yml | 3 +++ test/salt/pillar/dev_server.sls | 5 ++++- test/salt/pillar/install_binary.sls | 9 +++++++-- test/salt/pillar/prod_server.sls | 5 ++++- vault/defaults.yaml | 10 +++++----- vault/initfamilymap.yaml | 4 ++-- vault/osfamilymap.yaml | 4 ++-- 13 files changed, 64 insertions(+), 23 deletions(-) create mode 100644 .yamllint diff --git a/.travis.yml b/.travis.yml index 5d4ce94..4791dc7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ --- stages: - test - - commitlint + - lint - name: release if: branch = master AND type != pull_request @@ -45,16 +45,21 @@ script: jobs: include: - # Define the commitlint stage - - stage: commitlint + # Define the `lint` stage (runs `yamllint` and `commitlint`) + - stage: lint language: node_js node_js: lts/* 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/install_binary.sls test/salt/pillar/dev_server.sls test/salt/pillar/prod_server.sls + # Install and run `commitlint` - npm install @commitlint/config-conventional -D - npm install @commitlint/travis-cli -D - commitlint-travis - # Define the release stage that runs semantic-release + # Define the release stage that runs `semantic-release` - stage: release language: node_js node_js: lts/* diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..3a90f57 --- /dev/null +++ b/.yamllint @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- +# Extend the `default` configuration provided by `yamllint` +extends: default + +# Files to ignore completely +# 1. All YAML files under directory `node_modules/`, introduced during the Travis run +ignore: | + node_modules/ + +rules: + line-length: + # Increase from default of `80` + # Based on https://github.com/PyCQA/flake8-bugbear#opinionated-warnings (`B950`) + max: 88 diff --git a/kitchen.yml b/kitchen.yml index ef86cbd..f2fd776 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -17,7 +17,8 @@ platforms: platform: rhel run_command: /sbin/init provision_command: - - curl -L https://bootstrap.saltstack.com | sh -s -- -X # install latest stable Salt + # install latest stable Salt + - curl -L https://bootstrap.saltstack.com | sh -s -- -X ## SALT `develop` - name: debian-9-develop-py3 diff --git a/pillar.example b/pillar.example index a7ad891..94c176e 100644 --- a/pillar.example +++ b/pillar.example @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent - +# vim: ft=yaml +--- vault: version: 1.1.0 platform: linux_amd64 - dev_mode: False - verify_download: True + dev_mode: false + verify_download: true config: storage: consul: @@ -51,4 +51,3 @@ vault: oEIgXTMyCILo34Fa/C6VCm2WBgz9zZO8/rHIiQm1J5zqz0DrDwKBUM9C =LYpS -----END PGP PUBLIC KEY BLOCK----- - diff --git a/test/integration/dev_server/inspec.yml b/test/integration/dev_server/inspec.yml index 5bd7c00..c855429 100644 --- a/test/integration/dev_server/inspec.yml +++ b/test/integration/dev_server/inspec.yml @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- name: dev_server title: vault formula maintainer: SaltStack Formulas diff --git a/test/integration/install_binary/inspec.yml b/test/integration/install_binary/inspec.yml index 4c1b5c8..b923123 100644 --- a/test/integration/install_binary/inspec.yml +++ b/test/integration/install_binary/inspec.yml @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- name: install_binary title: vault formula maintainer: SaltStack Formulas diff --git a/test/integration/prod_server/inspec.yml b/test/integration/prod_server/inspec.yml index cd35e76..d0dd008 100644 --- a/test/integration/prod_server/inspec.yml +++ b/test/integration/prod_server/inspec.yml @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- name: prod_server title: vault formula maintainer: SaltStack Formulas diff --git a/test/salt/pillar/dev_server.sls b/test/salt/pillar/dev_server.sls index 34c654e..e52fc48 100644 --- a/test/salt/pillar/dev_server.sls +++ b/test/salt/pillar/dev_server.sls @@ -1,2 +1,5 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- vault: - dev_mode: True + dev_mode: true diff --git a/test/salt/pillar/install_binary.sls b/test/salt/pillar/install_binary.sls index e45fc8d..d69b55c 100644 --- a/test/salt/pillar/install_binary.sls +++ b/test/salt/pillar/install_binary.sls @@ -1,4 +1,9 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- vault: - # version: 1.0.3 # test upgrades by doing a double-converge, changing the version pillar between each one + # test upgrades by doing a double-converge, changing the version pillar + # between each one + # version: 1.0.3 version: 1.1.0 - verify_download: False + verify_download: false diff --git a/test/salt/pillar/prod_server.sls b/test/salt/pillar/prod_server.sls index a21a5f3..6fbbf43 100644 --- a/test/salt/pillar/prod_server.sls +++ b/test/salt/pillar/prod_server.sls @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- vault: config: storage: @@ -5,7 +8,7 @@ vault: path: /var/lib/vault/data tls_disable: 1 self_signed_cert: - enabled: True + enabled: true hostname: localhost password: localhost country: GB diff --git a/vault/defaults.yaml b/vault/defaults.yaml index 504ff7f..67cddb3 100644 --- a/vault/defaults.yaml +++ b/vault/defaults.yaml @@ -1,15 +1,15 @@ # -*- coding: utf-8 -*- -# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent - +# vim: ft=yaml +--- vault: version: 1.1.0 platform: linux_amd64 gpg_pkg: gnupg2 setcap_pkg: libcap - dev_mode: False - verify_download: True + dev_mode: false + verify_download: true self_signed_cert: - enabled: False + enabled: false config: listener: tcp: diff --git a/vault/initfamilymap.yaml b/vault/initfamilymap.yaml index b68f4e0..58ef056 100644 --- a/vault/initfamilymap.yaml +++ b/vault/initfamilymap.yaml @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent - +# vim: ft=yaml +--- systemd: service: path: /etc/systemd/system/vault.service diff --git a/vault/osfamilymap.yaml b/vault/osfamilymap.yaml index f79a276..c75535c 100644 --- a/vault/osfamilymap.yaml +++ b/vault/osfamilymap.yaml @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -# vim: ft=sls syntax=yaml softtabstop=2 tabstop=2 shiftwidth=2 expandtab autoindent - +# vim: ft=yaml +--- Debian: setcap_pkg: libcap2-bin