From a9d7076d804c1d708ebc398baa5f38911065a749 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 1/7] List of all repositories that needs to be checked --- directories.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 directories.txt diff --git a/directories.txt b/directories.txt new file mode 100644 index 0000000..ba2777b --- /dev/null +++ b/directories.txt @@ -0,0 +1,3 @@ +src +tests +tools From 5d103e401cd3bde59552826a4e4c4c28eed005d8 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 2/7] List of all separate files that needs to be checked --- files.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 files.txt diff --git a/files.txt b/files.txt new file mode 100644 index 0000000..659ddbf --- /dev/null +++ b/files.txt @@ -0,0 +1 @@ +setup.py From 8ca9b62b9709ce2ba4c48a46ca3e3f471628f214 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 3/7] Update the script check-docstyle.sh to use directories.txt --- check-docstyle.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/check-docstyle.sh b/check-docstyle.sh index e273211..ee3d395 100755 --- a/check-docstyle.sh +++ b/check-docstyle.sh @@ -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 @@ -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" From 8f2b70d403811a263b9c84d13a802fe7cf82aa54 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 4/7] Update the script detect-common-errors.sh to use directories.txt --- detect-common-errors.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/detect-common-errors.sh b/detect-common-errors.sh index c9bddc2..3a1401b 100755 --- a/detect-common-errors.sh +++ b/detect-common-errors.sh @@ -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 From 4037644e72aca58d8c21540e85928f2ea9e42b8d Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 5/7] Update the script detect-dead-code.sh to use directories.txt --- detect-dead-code.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/detect-dead-code.sh b/detect-dead-code.sh index d48f094..2b9bd95 100755 --- a/detect-dead-code.sh +++ b/detect-dead-code.sh @@ -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 From 6ed713b320904b1ba908841d54740f894b0dc351 Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 6/7] Update the script run-linter.sh to use directories.txt --- run-linter.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/run-linter.sh b/run-linter.sh index ce07226..73f8021 100755 --- a/run-linter.sh +++ b/run-linter.sh @@ -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 @@ -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" From e08279a0f524fce485f75e5784abb4b13c1cb48e Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Wed, 24 Jul 2019 10:03:19 +0200 Subject: [PATCH 7/7] Update documentation --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9d2c4d4..1e1f288 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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: @@ -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: