From f52eb378987ac0cacaf3a079ca03067107173661 Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Wed, 27 Nov 2019 13:34:37 +0000 Subject: [PATCH] feat(travis): run `shellcheck` during lint job * https://github.com/saltstack-formulas/template-formula/pull/180#issuecomment-558612422 --- .travis.yml | 6 +++++- ssf/defaults.yaml | 4 ++-- ssf/files/default/.travis.yml | 8 ++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6eaad65f..eac5d509 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,7 +24,7 @@ jobs: - language: 'node_js' node_js: 'lts/*' env: 'Lint' - name: 'Lint: salt-lint, yamllint, rubocop & commitlint' + name: 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' before_install: 'skip' script: # Install and run `salt-lint` @@ -38,6 +38,10 @@ jobs: # Install and run `rubocop` - gem install rubocop - rubocop -d + # Run `shellcheck` (already pre-installed in Travis) + - shellcheck --version + - git ls-files | grep '\.sh$\|\.bash$\|\.ksh$' + | xargs shellcheck # Install and run `commitlint` - npm i -D @commitlint/config-conventional @commitlint/travis-cli diff --git a/ssf/defaults.yaml b/ssf/defaults.yaml index 48e7fb48..21a21798 100644 --- a/ssf/defaults.yaml +++ b/ssf/defaults.yaml @@ -22,8 +22,8 @@ ssf_node_anchors: # An alternative method could be to use: # `git describe --abbrev=0 --tags` # yamllint disable rule:line-length - title: 'ci(travis): use default matrix after `centos-6` image fix' - body: '* Automated using https://github.com/myii/ssf-formula/pull/105' + title: 'ci(travis): run `shellcheck` during lint job [skip ci]' + body: '* Automated using https://github.com/myii/ssf-formula/pull/106' # yamllint enable rule:line-length github: owner: 'saltstack-formulas' diff --git a/ssf/files/default/.travis.yml b/ssf/files/default/.travis.yml index 0b9fa9e1..5ef15789 100644 --- a/ssf/files/default/.travis.yml +++ b/ssf/files/default/.travis.yml @@ -23,10 +23,10 @@ fast_finish: true {#- Prepare variables used for linters #} {%- set comment_linters = '# Run all of the linters in a single job' %} -{%- set name_linters = 'Lint: salt-lint, yamllint, rubocop & commitlint' %} +{%- set name_linters = 'Lint: salt-lint, yamllint, rubocop, shellcheck & commitlint' %} {%- if not travis.use_single_job_for_linters %} {%- set comment_linters = comment_linters ~ ' (except `rubocop`)' %} -{%- set name_linters = 'Lint: salt-lint, yamllint & commitlint' %} +{%- set name_linters = 'Lint: salt-lint, yamllint, shellcheck & commitlint' %} {%- endif %} {#- Prepare variable used for `saltcheck` #} {%- set use_saltcheck = False %} @@ -137,6 +137,10 @@ jobs: {%- if travis.use_single_job_for_linters %} {{- format_rubocop_linter() }} {%- endif %} + # Run `shellcheck` (already pre-installed in Travis) + - shellcheck --version + - git ls-files | grep '\.sh$\|\.bash$\|\.ksh$' + | xargs shellcheck # Install and run `commitlint` - npm i -D @commitlint/config-conventional @commitlint/travis-cli