Ignore line check on certain types of lines or in certain blocks.
This commit is contained in:
parent
95092971ab
commit
34ec755d27
|
|
@ -3,17 +3,23 @@
|
||||||
echo "Checking line lengths in all source files <= $MAX_LINE_LENGTH chars..."
|
echo "Checking line lengths in all source files <= $MAX_LINE_LENGTH chars..."
|
||||||
|
|
||||||
echo "Offending files and lines:"
|
echo "Offending files and lines:"
|
||||||
(( success = 1 ))
|
(( bad_lines = 0 ))
|
||||||
|
(( inside_block = 0 ))
|
||||||
for file in "$@" ; do
|
for file in "$@" ; do
|
||||||
echo "$file"
|
echo "$file"
|
||||||
(( line_no = 0 ))
|
(( line_no = 0 ))
|
||||||
while IFS="" read -r line || [[ -n "$line" ]] ; do
|
while IFS="" read -r line || [[ -n "$line" ]] ; do
|
||||||
(( line_no++ ))
|
(( line_no++ ))
|
||||||
if (( "${#line}" > $MAX_LINE_LENGTH )) ; then
|
if [[ "$line" =~ ^'```' ]] ; then
|
||||||
(( success = 0 ))
|
(( inside_block = !$inside_block ))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! (( $inside_block )) && ! [[ "$line" =~ " | "|"://"|\[\^[^\ ]+\]: ]] && (( "${#line}" > $MAX_LINE_LENGTH )) ; then
|
||||||
|
(( bad_lines++ ))
|
||||||
echo -e "\t$line_no : $line"
|
echo -e "\t$line_no : $line"
|
||||||
fi
|
fi
|
||||||
done < "$file"
|
done < "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
(( $success )) && echo "No offending lines found."
|
echo "$bad_lines offending lines found."
|
||||||
|
(( $bad_lines == 0 ))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue