Skip to content
Snippets Groups Projects
Commit c68ce755 authored by Jan Frenzel's avatar Jan Frenzel
Browse files

Removed debug statements in check-code-style.sh.

parent 7223b44e
No related branches found
No related tags found
2 merge requests!673Automated merge from preview to main,!655Resolve "Lint test scripts in doc.zih.tu-dresden.de/util"
...@@ -51,7 +51,7 @@ function style_check() { ...@@ -51,7 +51,7 @@ function style_check() {
# If shell script is provided # If shell script is provided
test_res_count=$(grep -cP "${pattern}" $myfile || true) test_res_count=$(grep -cP "${pattern}" $myfile || true)
if [[ "${test_res_count}" -gt "0" ]]; then if [[ "${test_res_count}" -gt "0" ]]; then
echo -e "[WARNING] ${warning}" #\nThis coding style was not used for following lines:" echo -e "[WARNING] ${warning}"
echo "[WARNING] This coding style was not used for following lines in file $(realpath ${myfile}):" echo "[WARNING] This coding style was not used for following lines in file $(realpath ${myfile}):"
grep -nP "${pattern}" $myfile grep -nP "${pattern}" $myfile
echo "" echo ""
...@@ -70,7 +70,7 @@ function style_check() { ...@@ -70,7 +70,7 @@ function style_check() {
test_res_count="$(echo "${test_string}" | grep -cnP "${pattern}")" test_res_count="$(echo "${test_string}" | grep -cnP "${pattern}")"
fi fi
if [[ "${test_res_count}" -gt "0" ]]; then if [[ "${test_res_count}" -gt "0" ]]; then
echo -e "[WARNING] ${warning}" # This coding style was not used for following lines:" echo -e "[WARNING] ${warning}"
echo "[WARNING] This coding style was not used for following lines in file $(realpath ${myfile}):" echo "[WARNING] This coding style was not used for following lines in file $(realpath ${myfile}):"
grep -no -F "$(echo "${test_string}" | grep -P "${pattern}")" "${myfile}" grep -no -F "$(echo "${test_string}" | grep -P "${pattern}")" "${myfile}"
echo "" echo ""
...@@ -102,23 +102,18 @@ if [ $# -eq 1 ]; then ...@@ -102,23 +102,18 @@ if [ $# -eq 1 ]; then
-a | --all) -a | --all)
echo "Checking in all files." echo "Checking in all files."
files=$(find $basedir -name '*.md' -o -name '*.sh') files=$(find $basedir -name '*.md' -o -name '*.sh')
#file_num=$(find $basedir -name '*.md' -o -name '*.sh' | wc -l) #For debugging
;; ;;
*) *)
files="$1" files="$1"
file_num=1
;; ;;
esac esac
elif [ $# -eq 0 ]; then elif [ $# -eq 0 ]; then
echo "Search in git-changed files." echo "Search in git-changed files."
files=`git diff --name-only "$(git merge-base HEAD "$branch")" | grep -e '.md$' -e '.sh$' || true` files=`git diff --name-only "$(git merge-base HEAD "$branch")" | grep -e '.md$' -e '.sh$' || true`
#For debugging
#file_num=$(git diff --name-only "$(git merge-base HEAD "$branch")" | grep -c -e '.md$' -e '.sh$' || true)
else else
usage usage
fi fi
#counter=0 #For debugging
any_fails=false any_fails=false
for file in $files; do for file in $files; do
...@@ -189,8 +184,6 @@ for file in $files; do ...@@ -189,8 +184,6 @@ for file in $files; do
if style_check "${file}" "${pattern}" "${warning}"; then if style_check "${file}" "${pattern}" "${warning}"; then
any_fails=true any_fails=true
fi fi
#((counter=counter+1)) #For debugging
#echo -e "Checked ${counter}/${file_num} files\n" #For debugging
done done
if [[ "${any_fails}" == true ]]; then if [[ "${any_fails}" == true ]]; then
exit 1 exit 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment