Browse Source

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
tags/1.7.0
Rabi Mishra 1 month ago
committed by Sorin Sbarnea
parent
commit
7c90153dda
3 changed files with 6 additions and 41 deletions
  1. +3
    -8
      .pre-commit-config.yaml
  2. +0
    -30
      scripts/detect-broken-symlinks.sh
  3. +3
    -3
      tox.ini

+ 3
- 8
.pre-commit-config.yaml View File

@@ -9,6 +9,7 @@ repos:
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: check-yaml
files: .*\.(yaml|yml)$
@@ -32,18 +33,12 @@ repos:
rev: v4.3.1
hooks:
- 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
rev: 2.0.0
hooks:
- id: bashate
entry: bashate --error . --verbose --ignore=E006,E040
entry: bashate --error . --ignore=E006,E040
verbose: false
# Run bashate check for all bash scripts
# Ignores the following rules:
# E006: Line longer than 79 columns (as many scripts use jinja


+ 0
- 30
scripts/detect-broken-symlinks.sh 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)

+ 3
- 3
tox.ini View File

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

[testenv:releasenotes]
basepython = python3


Loading…
Cancel
Save