2323
2424compile_notebooks () {
2525 local failed_nb=()
26- local failed_script =()
26+ local failed_scripts =()
2727
2828 # Check if changed scripts match the notebooks
2929
@@ -50,7 +50,7 @@ compile_notebooks () {
5050
5151 # Fail if the generated notebook doesn't match the current version of the notebook
5252 if ! diff -q " $target_nb " " $tmp_nb " > /dev/null; then
53- failed_script +=(" ${source_script} " )
53+ failed_scripts +=(" ${source_script} " )
5454 failed_nb+=(" ${target_nb} " )
5555 fi
5656 done
@@ -71,11 +71,13 @@ compile_notebooks () {
7171 local target_script=" ${source_nb/ .ipynb/ _nb.py} "
7272
7373 # Skip if the script has already failed
74- for failed_script in " ${failed_scripts[@]} " ; do
75- if [[ " $target_script " == " $failed_script " ]]; then
76- continue 2
77- fi
78- done
74+ if [[ ${# failed_scripts[@]} -gt 0 ]]; then
75+ for failed_script in " ${failed_scripts[@]} " ; do
76+ if [[ " $target_script " == " $failed_script " ]]; then
77+ continue 2
78+ fi
79+ done
80+ fi
7981
8082 local tmp_script=" $( mktemp) _nb.py"
8183 cp " $target_script " " $tmp_script "
@@ -92,7 +94,7 @@ compile_notebooks () {
9294
9395 # Fail if the generated notebook doesn't match the current version of the notebook
9496 if ! diff -q " $target_script " " $tmp_script " > /dev/null; then
95- failed_script +=(" ${target_script} " )
97+ failed_scripts +=(" ${target_script} " )
9698 failed_nb+=(" ${source_nb} " )
9799 fi
98100 done
@@ -103,7 +105,7 @@ compile_notebooks () {
103105 echo " The following notebooks don't match the source script:"
104106 echo " "
105107 for i in " ${! failed_nb[@]} " ; do
106- echo " ✖ ${failed_nb[$i]} <> ${failed_script [$i]} " >&2
108+ echo " ✖ ${failed_nb[$i]} <> ${failed_scripts [$i]} " >&2
107109 done
108110 echo " "
109111 echo " Please use one of the following options to fix the issue:"
0 commit comments