Fix linters

- fixes conflicts between virtualenv and pre-commit
- removes custom symlink detection that was not portable with
  already existing symlink check.
- updated bashate config to not be verbose
- updated outdated ansible-lint hook calling method

Change-Id: I52cf07c0965c60d2b5149ccea136e53f261be42d
This commit is contained in:
Rabi Mishra 2020-08-24 14:18:24 +05:30 committed by Sorin Sbarnea
parent 03c9bfa541
commit 7c90153dda
3 changed files with 6 additions and 41 deletions

View File

@ -9,6 +9,7 @@ repos:
- id: check-byte-order-marker - id: check-byte-order-marker
- id: check-executables-have-shebangs - id: check-executables-have-shebangs
- id: check-merge-conflict - id: check-merge-conflict
- id: check-symlinks
- id: debug-statements - id: debug-statements
- id: check-yaml - id: check-yaml
files: .*\.(yaml|yml)$ files: .*\.(yaml|yml)$
@ -32,18 +33,12 @@ repos:
rev: v4.3.1 rev: v4.3.1
hooks: hooks:
- id: ansible-lint - id: ansible-lint
files: \.(yaml|yml)$
entry: >-
ansible-lint --force-color -v -x "ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
--exclude=tripleo_ansible/roles.galaxy
# TODO(cloudnull): These codes were added to pass the lint check.
# Things found within roles.galaxy are external
# and not something maintained here.
- repo: https://github.com/openstack-dev/bashate.git - repo: https://github.com/openstack-dev/bashate.git
rev: 2.0.0 rev: 2.0.0
hooks: hooks:
- id: bashate - id: bashate
entry: bashate --error . --verbose --ignore=E006,E040 entry: bashate --error . --ignore=E006,E040
verbose: false
# Run bashate check for all bash scripts # Run bashate check for all bash scripts
# Ignores the following rules: # Ignores the following rules:
# E006: Line longer than 79 columns (as many scripts use jinja # E006: Line longer than 79 columns (as many scripts use jinja

View File

@ -1,30 +0,0 @@
#!/usr/bin/env bash
# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
## Shell Opts ----------------------------------------------------------------
set -o pipefail
set -eu
## Vars ----------------------------------------------------------------------
export PROJECT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))/../"
## Main ----------------------------------------------------------------------
echo 'Checking for broken symlinks: '
find ${PROJECT_DIR} -type l ! -exec test -e {} \; -print 2>&1 | grep . && exit 1 || (echo clear && exit 0)

View File

@ -50,14 +50,14 @@ sitepackages = False
setenv = setenv =
UPPER_CONSTRAINTS_FILE=file:///dev/null UPPER_CONSTRAINTS_FILE=file:///dev/null
deps = deps =
pre-commit pre-commit>=2.7.1
virtualenv<20 # known to break things virtualenv>=20.0.31
-r {toxinidir}/ansible-requirements.txt -r {toxinidir}/ansible-requirements.txt
commands = commands =
pip check
bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/tripleo_ansible/roles.galaxy' \ bash -c "ANSIBLE_ROLES_PATH='{toxinidir}/tripleo_ansible/roles.galaxy' \
ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-role-requirements.yml" ansible-galaxy install -fr {toxinidir}/tripleo_ansible/ansible-role-requirements.yml"
python -m pre_commit run -a python -m pre_commit run -a
bash -c '{toxinidir}/scripts/detect-broken-symlinks.sh'
[testenv:releasenotes] [testenv:releasenotes]
basepython = python3 basepython = python3