Commit c9cc531 1 parent 0b37fe0 commit c9cc531 Copy full SHA for c9cc531
File tree 3 files changed +16
-3
lines changed
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,10 @@ Scanned/Changed scripts: \`${#list_of_changed_scripts[@]}\`
72
72
get_number_of () {
73
73
[[ $# -le 0 ]] && return 1
74
74
75
- jq ' .defects | length' " ../${1} .log"
75
+ file=" ../${1} .log"
76
+ [[ -s " ${file} " ]] || return 1
77
+
78
+ jq ' .defects | length' " ${file} "
76
79
}
77
80
78
81
# Create full Markdown style link to results
Original file line number Diff line number Diff line change @@ -19,7 +19,10 @@ get_fixes () {
19
19
# It expects file '../fixes.log' to contain fixes
20
20
# $? - return value is always 0
21
21
evaluate_and_print_fixes () {
22
- if [[ -s ../fixes.log ]]; then
22
+ gather_statistics " ../fixes.log"
23
+
24
+ num_of_fixes=$( get_number_of fixes)
25
+ if [[ " ${num_of_fixes} " -gt 0 ]]; then
23
26
echo -e " ✅ ${GREEN} Fixed defects${NOCOLOR} "
24
27
csgrep --embed-context 2 ../fixes.log
25
28
else
@@ -45,7 +48,7 @@ evaluate_and_print_defects () {
45
48
gather_statistics " ../defects.log"
46
49
47
50
num_of_defects=$( get_number_of defects)
48
- if [[ -s ../defects.log ]] && [[ " ${num_of_defects} " -gt 0 ]] ; then
51
+ if [[ " ${num_of_defects} " -gt 0 ]] ; then
49
52
print_statistics
50
53
51
54
echo -e " ✋ ${YELLOW} Defects, NEEDS INSPECTION${NOCOLOR} "
Original file line number Diff line number Diff line change @@ -17,6 +17,13 @@ setup () {
17
17
assert_failure 1
18
18
}
19
19
20
+ @test " get_number_of() - No such file or directory" {
21
+ source " ${PROJECT_ROOT} /src/summary.sh"
22
+
23
+ run get_number_of " asdfsghdfadshgfadsdshgfadsfghfjdsdf.log"
24
+ assert_failure 1
25
+ }
26
+
20
27
@test " get_number_of() - defects" {
21
28
source " ${PROJECT_ROOT} /src/summary.sh"
22
29
You can’t perform that action at this time.
0 commit comments