Skip to content

Commit

Permalink
Updated the script run-linter.sh to be able to run from qa subdirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Sep 6, 2019
1 parent 2b898b6 commit 837f583
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions qa/run-linter.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
#!/bin/bash

# Script to check all Python scripts for PEP-8 issues

SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"

IFS=$'\n'

# list of directories with sources to check
directories=$(cat directories.txt)
directories=$(cat ${SCRIPT_DIR}/directories.txt)

# list of separate files to check
separate_files=$(cat files.txt)
separate_files=$(cat ${SCRIPT_DIR}/files.txt)

pass=0
fail=0

function prepare_venv() {
VIRTUALENV=$(which virtualenv)
VIRTUALENV="$(which virtualenv)"
if [ $? -eq 1 ]; then
# python36 which is in CentOS does not have virtualenv binary
VIRTUALENV=$(which virtualenv-3)
VIRTUALENV="$(which virtualenv-3)"
fi

${VIRTUALENV} -p python3 venv && source venv/bin/activate && python3 "$(which pip3)" install pycodestyle
}

pushd "${SCRIPT_DIR}/.."


echo "----------------------------------------------------"
echo "Running Python linter against following directories:"
echo "$directories"
Expand Down Expand Up @@ -80,3 +87,5 @@ else
echo "Linter fail, $fail source files out of $total source files need to be fixed"
exit 1
fi

popd

0 comments on commit 837f583

Please sign in to comment.