diff --git a/src/summary.sh b/src/summary.sh index 5ec1765f..f1aaf2b0 100644 --- a/src/summary.sh +++ b/src/summary.sh @@ -72,7 +72,10 @@ Scanned/Changed scripts: \`${#list_of_changed_scripts[@]}\` get_number_of () { [[ $# -le 0 ]] && return 1 - jq '.defects | length' "../${1}.log" + file="../${1}.log" + [[ -s "${file}" ]] || return 1 + + jq '.defects | length' "${file}" } # Create full Markdown style link to results diff --git a/src/validation.sh b/src/validation.sh index 8d1667e7..1b96c9b3 100644 --- a/src/validation.sh +++ b/src/validation.sh @@ -19,7 +19,10 @@ get_fixes () { # It expects file '../fixes.log' to contain fixes # $? - return value is always 0 evaluate_and_print_fixes () { - if [[ -s ../fixes.log ]]; then + gather_statistics "../fixes.log" + + num_of_fixes=$(get_number_of fixes) + if [[ "${num_of_fixes}" -gt 0 ]]; then echo -e "✅ ${GREEN}Fixed defects${NOCOLOR}" csgrep --embed-context 2 ../fixes.log else @@ -45,7 +48,7 @@ evaluate_and_print_defects () { gather_statistics "../defects.log" num_of_defects=$(get_number_of defects) - if [[ -s ../defects.log ]] && [[ "${num_of_defects}" -gt 0 ]] ; then + if [[ "${num_of_defects}" -gt 0 ]] ; then print_statistics echo -e "✋ ${YELLOW}Defects, NEEDS INSPECTION${NOCOLOR}"