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 "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 ))
|
||||
|
|
|
|||
Loading…
Reference in New Issue