@@ -416,7 +416,7 @@ function bashunit::coverage::get_hit_lines() {
416416 # Only count hits that correspond to executable lines
417417 # This prevents >100% coverage when DEBUG trap fires on non-executable lines
418418 local count=0
419- local line_num
419+ local line_num=0
420420 for line_num in $hit_lines ; do
421421 local line_content
422422 line_content=$( sed -n " ${line_num} p" " $file " 2> /dev/null) || continue
@@ -437,7 +437,7 @@ function bashunit::coverage::get_line_hits() {
437437 return
438438 fi
439439
440- local count
440+ local count=0
441441 count=$( grep -c " ^${file} :${lineno} $" " $_BASHUNIT_COVERAGE_DATA_FILE " 2> /dev/null) || count=0
442442 echo " $count "
443443}
@@ -562,7 +562,7 @@ function bashunit::coverage::get_function_coverage() {
562562
563563 local executable=0
564564 local hit=0
565- local lineno
565+ local lineno=0
566566
567567 for (( lineno = fn_start; lineno <= fn_end; lineno++ )) ; do
568568 local line_content
@@ -616,7 +616,7 @@ function bashunit::coverage::report_text() {
616616 echo " Coverage Report"
617617 echo " ---------------"
618618
619- local file
619+ local file= " "
620620 while IFS= read -r file; do
621621 [[ -z " $file " || ! -f " $file " ]] && continue
622622 has_files=true
@@ -773,7 +773,7 @@ function bashunit::coverage::report_html() {
773773 local total_hit=0
774774 local -a file_data=()
775775 local file_data_count=0
776- local file
776+ local file= " "
777777
778778 while IFS= read -r file; do
779779 [[ -z " $file " || ! -f " $file " ]] && continue
@@ -787,7 +787,7 @@ function bashunit::coverage::report_html() {
787787 total_hit=$(( total_hit + hit))
788788
789789 local display_file=" ${file# " $( pwd) " / } "
790- local safe_filename
790+ local safe_filename= " "
791791 safe_filename=$( bashunit::coverage::path_to_filename " $file " )
792792
793793 file_data[file_data_count]=" $display_file |$hit |$executable |$pct |$safe_filename " ; file_data_count=$(( file_data_count + 1 ))
@@ -1192,7 +1192,7 @@ function bashunit::coverage::generate_file_html() {
11921192 # Index: line number, Value: newline-separated list of "test_file:test_function"
11931193 # Using indexed array for Bash 3.0 compatibility (no associative arrays)
11941194 local -a tests_by_line=()
1195- local _line_and_test
1195+ local _line_and_test= " "
11961196 while IFS= read -r _line_and_test; do
11971197 [[ -z " $_line_and_test " ]] && continue
11981198 local _tln=" ${_line_and_test%% |* } "
0 commit comments