Skip to content

Commit

Permalink
Merge pull request #130 from tisnik/move-qa-scripts-to-qa-dir-
Browse files Browse the repository at this point in the history
Move all QA scripts to "qa" subdirectory
  • Loading branch information
tisnik committed Sep 11, 2019
2 parents 515fdf4 + 5bdd403 commit e80b4f1
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 12 deletions.
3 changes: 0 additions & 3 deletions check-bashscripts.sh

This file was deleted.

File renamed without changes.
9 changes: 9 additions & 0 deletions qa/check-bashscripts.sh
@@ -0,0 +1,9 @@
#!/bin/bash

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

pushd "${SCRIPT_DIR}/.." > /dev/null

shellcheck -e 2181 -e 1091 ./*.sh

popd > /dev/null
12 changes: 10 additions & 2 deletions check-docstyle.sh → qa/check-docstyle.sh
@@ -1,12 +1,16 @@
#!/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
Expand All @@ -21,6 +25,8 @@ function prepare_venv() {
${VIRTUALENV} -p python3 venv && source venv/bin/activate && python3 "$(which pip3)" install pydocstyle
}

pushd "${SCRIPT_DIR}/.."

# run the pydocstyle for all files that are provided in $1
function check_files() {
for source in $1
Expand Down Expand Up @@ -69,6 +75,7 @@ echo "----------------------------------------------------"

check_files "$separate_files"

popd

if [ $fail -eq 0 ]
then
Expand All @@ -78,3 +85,4 @@ else
echo "Documentation strings should be added and/or fixed in $fail source files out of $total files"
exit 1
fi

13 changes: 11 additions & 2 deletions detect-common-errors.sh → qa/detect-common-errors.sh
@@ -1,12 +1,16 @@
#!/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
Expand All @@ -21,6 +25,8 @@ function prepare_venv() {
${VIRTUALENV} -p python3 venv && source venv/bin/activate && python3 "$(which pip3)" install pyflakes
}

pushd "${SCRIPT_DIR}/.."

# run the pyflakes for all files that are provided in $1
function check_files() {
for source in $1
Expand Down Expand Up @@ -67,6 +73,8 @@ echo

check_files "$separate_files"

popd

if [ $fail -eq 0 ]
then
echo "All checks passed for $pass source files"
Expand All @@ -75,3 +83,4 @@ else
echo "$fail source files out of $total files needs to be checked and fixed"
exit 1
fi

13 changes: 10 additions & 3 deletions detect-dead-code.sh → qa/detect-dead-code.sh
@@ -1,21 +1,25 @@
#!/bin/bash

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

directories="rudra tests tools"
separate_files="setup.py"

pass=0
fail=0

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

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

pushd "${SCRIPT_DIR}/.."

# run the vulture for all files that are provided in $1
function check_files() {
for source in $1
Expand Down Expand Up @@ -64,6 +68,8 @@ echo

check_files "$separate_files"

popd

if [ $fail -eq 0 ]
then
echo "All checks passed for $pass source files"
Expand All @@ -72,3 +78,4 @@ else
echo "$fail source files out of $total files seems to contain dead code and/or unused imports"
exit 1
fi

File renamed without changes.
File renamed without changes.
@@ -1,5 +1,9 @@
#!/bin/bash

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

pushd "${SCRIPT_DIR}/.."

function prepare_venv() {
VIRTUALENV=$(which virtualenv) || :
if [ -z "$VIRTUALENV" ]; then
Expand All @@ -14,6 +18,8 @@ function prepare_venv() {

radon cc -s -a -i venv .

popd

if [[ "$1" == "--fail-on-error" ]]
then
defects="$(radon cc -s -n D -i venv . | wc -l)"
Expand Down
@@ -1,5 +1,9 @@
#!/bin/bash

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

pushd "${SCRIPT_DIR}/.."

function prepare_venv() {
VIRTUALENV=$(which virtualenv) || :
if [ -z "$VIRTUALENV" ]; then
Expand All @@ -14,6 +18,8 @@ function prepare_venv() {

radon mi -s -i venv .

popd

if [[ "$1" == "--fail-on-error" ]]
then
defects="$(radon mi -s -n B -i venv . | wc -l)"
Expand Down
13 changes: 11 additions & 2 deletions run-linter.sh → qa/run-linter.sh
@@ -1,12 +1,16 @@
#!/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
Expand All @@ -21,6 +25,9 @@ function prepare_venv() {
${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 e80b4f1

Please sign in to comment.