From 152b42bc3b32a624ed0748ceef1a911f268d9956 Mon Sep 17 00:00:00 2001 From: Tin Lam Date: Mon, 12 Nov 2018 02:26:22 -0600 Subject: [PATCH] Consolidate linter jobs Consolidating all the linting to a single job rather than having a one-off just to lint for trailing whitespaces. As most of this projects are python, this should already be covered by PEP8, but will be scanning for yamls with trailing whitespaces. Change-Id: Iee33a69ff234d21c08217faa33a19e11dfef0ad9 Signed-off-by: Tin Lam --- .zuul.yaml | 9 --------- tools/gate/playbooks/zuul-linter.yaml | 20 -------------------- tools/gate/whitespace-linter.sh | 13 +++++++++++++ tox.ini | 3 +++ 4 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 tools/gate/playbooks/zuul-linter.yaml create mode 100755 tools/gate/whitespace-linter.sh diff --git a/.zuul.yaml b/.zuul.yaml index 870b68e7..ef871107 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -17,13 +17,11 @@ check: jobs: - openstack-tox-pep8 - - airship-pegleg-linter - airship-pegleg-doc-build - airship-pegleg-docker-build-gate gate: jobs: - openstack-tox-pep8 - - airship-pegleg-linter - airship-pegleg-doc-build - airship-pegleg-docker-build-gate post: @@ -36,13 +34,6 @@ - name: primary label: ubuntu-xenial -- job: - name: airship-pegleg-linter - description: | - Lints all files by checking them for whitespace. - run: tools/gate/playbooks/zuul-linter.yaml - nodeset: airship-pegleg-single-node - - job: name: airship-pegleg-doc-build description: | diff --git a/tools/gate/playbooks/zuul-linter.yaml b/tools/gate/playbooks/zuul-linter.yaml deleted file mode 100644 index 7a903715..00000000 --- a/tools/gate/playbooks/zuul-linter.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2017 The Openstack-Helm Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -- hosts: primary - tasks: - - name: Execute a Whitespace Linter check - command: find . -not -path "*/\.*" -not -path "*/doc/build/*" -not -path "*/doc/source/images/*" -not -name "*.tgz" -type f -exec egrep -l " +$" {} \; - register: result - failed_when: result.stdout != "" diff --git a/tools/gate/whitespace-linter.sh b/tools/gate/whitespace-linter.sh new file mode 100755 index 00000000..7e48b834 --- /dev/null +++ b/tools/gate/whitespace-linter.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -xe +RES=$(find . \ + -not -path "*/\.*" \ + -not -path "*/doc/build/*" \ + -not -path "*/doc/source/images/*" \ + -not -name "*.tgz" \ + -type f -exec egrep -l " +$" {} \;) + +if [[ -n $RES ]]; then + exit 1; +fi diff --git a/tox.ini b/tox.ini index bb2ce13f..5f1f07b2 100644 --- a/tox.ini +++ b/tox.ini @@ -31,8 +31,11 @@ basepython = python3 deps = -r{toxinidir}/test-requirements.txt commands = + bash -c "{toxinidir}/tools/gate/whitespace-linter.sh" bandit -r pegleg -n 5 flake8 {toxinidir}/pegleg +whitelist_externals = + bash [testenv:docs] basepython = python3