Merge "Drop redundant pep8 scripts"
This commit is contained in:
@@ -1,45 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
# Print a list and return with error if any executable files are found.
|
|
||||||
# Compatible with both python 2 and 3.
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import stat
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
|
||||||
print("Usage: %s <directory>" % sys.argv[0])
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
directory = sys.argv[1]
|
|
||||||
|
|
||||||
executable = []
|
|
||||||
|
|
||||||
for root, mydir, myfile in os.walk(directory):
|
|
||||||
for f in myfile:
|
|
||||||
path = os.path.join(root, f)
|
|
||||||
if os.path.islink(path):
|
|
||||||
# permissions are irrelevant for symlinked files
|
|
||||||
continue
|
|
||||||
mode = os.lstat(path).st_mode
|
|
||||||
if stat.S_IXUSR & mode:
|
|
||||||
executable.append(path)
|
|
||||||
|
|
||||||
if executable:
|
|
||||||
print("Executable files found:")
|
|
||||||
for f in executable:
|
|
||||||
print(f)
|
|
||||||
|
|
||||||
sys.exit(1)
|
|
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
tree=$1
|
|
||||||
|
|
||||||
tmpfile=$(mktemp)
|
|
||||||
|
|
||||||
find $tree -name '*.py' \
|
|
||||||
| xargs grep -l 'import log' \
|
|
||||||
| xargs grep -l '^LOG =' \
|
|
||||||
| xargs grep -c 'LOG' \
|
|
||||||
| grep ':1$' \
|
|
||||||
| awk -F ':' '{print $1}' > $tmpfile
|
|
||||||
|
|
||||||
count=$(wc -l < $tmpfile)
|
|
||||||
|
|
||||||
if [[ count -eq 0 ]]; then
|
|
||||||
rm $tmpfile
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo 'Found files with unused LOG variable (see https://review.opendev.org/#/c/301054):'
|
|
||||||
cat $tmpfile
|
|
||||||
rm $tmpfile
|
|
||||||
exit 1
|
|
5
tox.ini
5
tox.ini
@@ -44,13 +44,8 @@ commands = oslo_debug_helper {posargs}
|
|||||||
skip_install = true
|
skip_install = true
|
||||||
deps =
|
deps =
|
||||||
pre-commit
|
pre-commit
|
||||||
allowlist_externals =
|
|
||||||
{toxinidir}/tools/check_exec.py
|
|
||||||
{toxinidir}/tools/check_logging.sh
|
|
||||||
commands =
|
commands =
|
||||||
pre-commit run --all-files --show-diff-on-failure
|
pre-commit run --all-files --show-diff-on-failure
|
||||||
{toxinidir}/tools/check_exec.py {toxinidir}/manila
|
|
||||||
{toxinidir}/tools/check_logging.sh {toxinidir}/manila
|
|
||||||
|
|
||||||
[testenv:genconfig]
|
[testenv:genconfig]
|
||||||
allowlist_externals = bash
|
allowlist_externals = bash
|
||||||
|
Reference in New Issue
Block a user