diff --git a/ci/check_line_lengths.sh b/ci/check_line_lengths.sh index 8001ea9a..27711806 100755 --- a/ci/check_line_lengths.sh +++ b/ci/check_line_lengths.sh @@ -3,17 +3,23 @@ echo "Checking line lengths in all source files <= $MAX_LINE_LENGTH chars..." echo "Offending files and lines:" -(( success = 1 )) +(( bad_lines = 0 )) +(( inside_block = 0 )) for file in "$@" ; do echo "$file" (( line_no = 0 )) while IFS="" read -r line || [[ -n "$line" ]] ; do (( line_no++ )) - if (( "${#line}" > $MAX_LINE_LENGTH )) ; then - (( success = 0 )) + if [[ "$line" =~ ^'```' ]] ; then + (( inside_block = !$inside_block )) + continue + fi + if ! (( $inside_block )) && ! [[ "$line" =~ " | "|"://"|\[\^[^\ ]+\]: ]] && (( "${#line}" > $MAX_LINE_LENGTH )) ; then + (( bad_lines++ )) echo -e "\t$line_no : $line" fi done < "$file" done -(( $success )) && echo "No offending lines found." +echo "$bad_lines offending lines found." +(( $bad_lines == 0 ))