diff options
| author | jyn <github@jyn.dev> | 2023-04-08 22:08:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-09 12:08:46 +0900 |
| commit | 8c838fb2fbcfae52b24d361cfe3152930a5a01d5 (patch) | |
| tree | 06f7d6301334524a8c209893ae5cf32900ca75ec /src/doc/rustc-dev-guide/ci | |
| parent | 41dac679da4639f540a82b92733a895b8d20a434 (diff) | |
Various improvements to `check_line_lengths.sh` (#1667)
Diffstat (limited to 'src/doc/rustc-dev-guide/ci')
| -rwxr-xr-x | src/doc/rustc-dev-guide/ci/lengthcheck.sh (renamed from src/doc/rustc-dev-guide/ci/check_line_lengths.sh) | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/rustc-dev-guide/ci/check_line_lengths.sh b/src/doc/rustc-dev-guide/ci/lengthcheck.sh index 31cda5c65e9..76d677be74b 100755 --- a/src/doc/rustc-dev-guide/ci/check_line_lengths.sh +++ b/src/doc/rustc-dev-guide/ci/lengthcheck.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# Check files for lines that are too long. + if [ "$1" == "--help" ]; then echo 'Usage:' "[MAX_LINE_LENGTH=n] $0 [file ...]" exit 1 @@ -10,8 +12,7 @@ if [ "$MAX_LINE_LENGTH" == "" ]; then fi if [ "$1" == "" ]; then - shopt -s globstar - files=( src/**/*.md ) + files=( src/*.md src/*/*.md src/*/*/*.md ) else files=( "$@" ) fi @@ -22,7 +23,6 @@ echo "Offending files and lines:" (( bad_lines = 0 )) (( inside_block = 0 )) for file in "${files[@]}"; do - echo "$file" (( line_no = 0 )) while IFS="" read -r line || [[ -n "$line" ]] ; do (( line_no++ )) @@ -34,7 +34,7 @@ for file in "${files[@]}"; do && ! [[ "$line" =~ " | "|"-|-"|"://"|"]:"|\[\^[^\ ]+\]: ]] \ && (( "${#line}" > $MAX_LINE_LENGTH )) ; then (( bad_lines++ )) - echo -e "\t$line_no : $line" + echo -e "\t$file:$line_no : $line" fi done < "$file" done |
