From 03d15e9acb49c4c1636396439265dfd53bc9fec6 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Tue, 6 Aug 2019 20:58:14 +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 apt-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:") pillar.example 7:1 error trailing spaces (trailing-spaces) test/salt/pillar/repositories.pillar.sls 1:1 warning missing document start "---" (document-start) 19:1 error too many blank lines (1 > 0) (empty-lines) test/salt/pillar/preferences.pillar.sls 1:1 warning missing document start "---" (document-start) ``` --- .travis.yml | 13 +++++++++---- .yamllint | 16 ++++++++++++++++ pillar.example | 2 +- test/integration/preferences/inspec.yml | 3 +++ test/integration/repositories/inspec.yml | 3 +++ test/salt/pillar/preferences.pillar.sls | 3 +++ test/salt/pillar/repositories.pillar.sls | 4 +++- 7 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .yamllint diff --git a/.travis.yml b/.travis.yml index 02d86de..7239ea1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ --- stages: - test - - commitlint + - lint - name: release if: branch = master AND type != pull_request @@ -33,16 +33,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/repositories.pillar.sls test/salt/pillar/preferences.pillar.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/pillar.example b/pillar.example index 1fb1288..7d5bef2 100644 --- a/pillar.example +++ b/pillar.example @@ -4,7 +4,7 @@ apt: # Set the right keyring for the distro (ie ubuntu-keyring or ...) keyring_package: debian-archive-keyring - + remove_sources_list: true clean_sources_list_d: true diff --git a/test/integration/preferences/inspec.yml b/test/integration/preferences/inspec.yml index 0e5fb71..f4cb7a4 100644 --- a/test/integration/preferences/inspec.yml +++ b/test/integration/preferences/inspec.yml @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- name: preferences title: apt formula maintainer: SaltStack Formulas diff --git a/test/integration/repositories/inspec.yml b/test/integration/repositories/inspec.yml index 5b58b4b..5cda415 100644 --- a/test/integration/repositories/inspec.yml +++ b/test/integration/repositories/inspec.yml @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- name: repositories title: apt formula maintainer: SaltStack Formulas diff --git a/test/salt/pillar/preferences.pillar.sls b/test/salt/pillar/preferences.pillar.sls index f207765..ba42d6a 100644 --- a/test/salt/pillar/preferences.pillar.sls +++ b/test/salt/pillar/preferences.pillar.sls @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- apt: remove_preferences: true clean_preferences_d: true diff --git a/test/salt/pillar/repositories.pillar.sls b/test/salt/pillar/repositories.pillar.sls index 142b878..3487665 100644 --- a/test/salt/pillar/repositories.pillar.sls +++ b/test/salt/pillar/repositories.pillar.sls @@ -1,3 +1,6 @@ +# -*- coding: utf-8 -*- +# vim: ft=yaml +--- apt: remove_sources_list: true clean_sources_list_d: true @@ -16,4 +19,3 @@ apt: arch: [amd64] comps: [] key_url: https://cli-assets.heroku.com/apt/release.key -