Skip to content

Commit

Permalink
Merge pull request #204 from tisnik/use-one-central-file-for-qa-files
Browse files Browse the repository at this point in the history
Use one central file for QA files
  • Loading branch information
tisnik authored Jul 24, 2019
2 parents a23d978 + e08279a commit 05164b9
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 18 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ The first script checks the indentation, line lengths, variable names, white spa
script checks all documentation strings - its presence and format. Please fix any warnings and errors reported by these
scripts.

List of directories containing source code, that needs to be checked, are stored in a file `directories.txt`

#### Code complexity measurement

The scripts `measure-cyclomatic-complexity.sh` and `measure-maintainability-index.sh` are used to measure code complexity. These scripts can be run w/o any arguments:
Expand Down Expand Up @@ -127,6 +129,8 @@ Please note that due to Python's dynamic nature, static code analyzers are likel

Because of this potential problems, only code detected with more than 90% of confidence is reported.

List of directories containing source code, that needs to be checked, are stored in a file `directories.txt`

#### Common issues detection

The script `detect-common-errors.sh` can be used to detect common errors in the repository. This script can be run w/o any arguments:
Expand All @@ -137,6 +141,8 @@ The script `detect-common-errors.sh` can be used to detect common errors in the

Please note that only semantical problems are reported.

List of directories containing source code, that needs to be checked, are stored in a file `directories.txt`

#### Check for scripts written in BASH

The script named `check-bashscripts.sh` can be used to check all BASH scripts (in fact: all files with the `.sh` extension) for various possible issues, incompatibilities, and caveats. This script can be run w/o any arguments:
Expand Down
16 changes: 11 additions & 5 deletions check-docstyle.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/bin/bash

directories="src tests tools"
separate_files="setup.py"
IFS=$'\n'

# list of directories with sources to check
directories=$(cat directories.txt)

# list of separate files to check
separate_files=$(cat 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 pydocstyle
Expand Down Expand Up @@ -58,7 +64,7 @@ done
echo
echo "----------------------------------------------------"
echo "Checking documentation strings in the following files"
echo $separate_files
echo "$separate_files"
echo "----------------------------------------------------"

check_files "$separate_files"
Expand Down
13 changes: 9 additions & 4 deletions detect-common-errors.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/bin/bash

directories="src tests tools"
separate_files="setup.py"
IFS=$'\n'

# list of directories with sources to check
directories=$(cat directories.txt)

# list of separate files to check
separate_files=$(cat 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 pyflakes
Expand Down
13 changes: 9 additions & 4 deletions detect-dead-code.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
#!/bin/bash

directories="src tests tools"
separate_files="setup.py"
IFS=$'\n'

# list of directories with sources to check
directories=$(cat directories.txt)

# list of separate files to check
separate_files=$(cat 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 vulture
Expand Down
3 changes: 3 additions & 0 deletions directories.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src
tests
tools
1 change: 1 addition & 0 deletions files.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setup.py
16 changes: 11 additions & 5 deletions run-linter.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash

directories="src tests tools"
separate_files="setup.py"
IFS=$'\n'

# list of directories with sources to check
directories=$(cat directories.txt)

# list of separate files to check
separate_files=$(cat files.txt)

pass=0
fail=0

Expand Down Expand Up @@ -47,14 +53,14 @@ done
echo
echo "----------------------------------------------------"
echo "Running Python linter against selected files:"
echo $separate_files
echo "$separate_files"
echo "----------------------------------------------------"

# check for individual files
for source in $separate_files
do
echo $source
pycodestyle $source
echo "$source"
pycodestyle "$source"
if [ $? -eq 0 ]
then
echo " Pass"
Expand Down

0 comments on commit 05164b9

Please sign in to comment.