From 0aa0935c7cc1797107c6e28f04bab6bf31606ac8 Mon Sep 17 00:00:00 2001 From: Felipe Monteiro Date: Sun, 14 Oct 2018 17:52:32 -0400 Subject: [PATCH] chore: Combine pep8 with whitespace linter This patch set combines whitespace linter and pep8 together (as both do code linting) into the same job by dropping the .zuul.yaml whitespace-linter job and rolling it up into the same pep8 tox.ini check, just like Deckhand [0]. [0] https://github.com/openstack/airship-deckhand/blob/0462b7b929f3ab3ca0b26817ef6e052116d16e45/tox.ini#L106 Change-Id: I31ed60adfd431157ffc96a0f4d5d77d54af37352 --- .zuul.yaml | 7 ------- tools/gate/playbooks/zuul-linter.yaml | 20 -------------------- tools/whitespace-linter.sh | 16 ++++++++++++++++ tox.ini | 3 +++ 4 files changed, 19 insertions(+), 27 deletions(-) delete mode 100644 tools/gate/playbooks/zuul-linter.yaml create mode 100644 tools/whitespace-linter.sh diff --git a/.zuul.yaml b/.zuul.yaml index 95d77a36..ceaaf0f8 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -19,25 +19,18 @@ check: jobs: - openstack-tox-pep8 - - airship-armada-linter - airship-armada-lint-pep8 - airship-armada-ubuntu - airship-armada-docker-build-gate gate: jobs: - openstack-tox-pep8 - - airship-armada-linter - airship-armada-lint-pep8 - airship-armada-docker-build-gate post: jobs: - airship-armada-docker-publish -- job: - name: airship-armada-linter - run: tools/gate/playbooks/zuul-linter.yaml - nodeset: airship-armada-single-node - - job: name: airship-armada roles: diff --git a/tools/gate/playbooks/zuul-linter.yaml b/tools/gate/playbooks/zuul-linter.yaml deleted file mode 100644 index 7b6fb37f..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 -name "*.tgz" -type f -exec egrep -l " +$" {} \; - register: result - failed_when: result.stdout != "" \ No newline at end of file diff --git a/tools/whitespace-linter.sh b/tools/whitespace-linter.sh new file mode 100644 index 00000000..62ad0b60 --- /dev/null +++ b/tools/whitespace-linter.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -xe + +RES=$(find . \ + -not -path "*/\.*" \ + -not -path "*/*.egg-info/*" \ + -not -path "*/releasenotes/build/*" \ + -not -path "*/doc/build/*" \ + -not -name "*.tgz" \ + -not -name "*.html" \ + -not -name "*.pyc" \ + -type f -exec egrep -l " +$" {} \;) + +if [[ -n $RES ]]; then + exit 1 +fi diff --git a/tox.ini b/tox.ini index 768ac6e5..2cb7cd14 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ setenv= usedevelop = True install_command = pip install {opts} {packages} whitelist_externals = + bash find rm commands = @@ -69,6 +70,8 @@ deps = .[bandit] {[testenv]deps} commands = + # Whitespace linter (for chart files) + bash {toxinidir}/tools/whitespace-linter.sh yapf -dr {toxinidir}/armada {toxinidir}/setup.py flake8 {posargs} # Run security linter as part of the pep8 gate instead of a separate zuul job.