about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide
diff options
context:
space:
mode:
authorAlexander Regueiro <alexreg@me.com>2018-02-24 01:43:36 +0000
committerWho? Me?! <mark-i-m@users.noreply.github.com>2018-03-26 20:28:00 -0500
commitb5bd9cbb9b8b2228858808dd674626f6cac8b05e (patch)
tree4c07684c9c1a8751d4cebc8003d3af67e20780e3 /src/doc/rustc-dev-guide
parent5f4e24d4ec123c5ea79f4e3c8f7b56c77ee29788 (diff)
downloadrust-b5bd9cbb9b8b2228858808dd674626f6cac8b05e.tar.gz
rust-b5bd9cbb9b8b2228858808dd674626f6cac8b05e.zip
Ignore line check on certain types of lines or in certain blocks.
Diffstat (limited to 'src/doc/rustc-dev-guide')
-rwxr-xr-xsrc/doc/rustc-dev-guide/ci/check_line_lengths.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/ci/check_line_lengths.sh b/src/doc/rustc-dev-guide/ci/check_line_lengths.sh
index 8001ea9a7c3..27711806a0f 100755
--- a/src/doc/rustc-dev-guide/ci/check_line_lengths.sh
+++ b/src/doc/rustc-dev-guide/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 ))