File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 4646 if : github.event_name != 'push'
4747 run : |
4848 shopt -s globstar
49- MAX_LINE_LENGTH=100 bash ci/check_line_lengths .sh src/**/*.md
49+ MAX_LINE_LENGTH=100 bash ci/lengthcheck .sh src/**/*.md
5050
5151 - name : Install latest nightly Rust toolchain
5252 if : steps.mdbook-cache.outputs.cache-hit != 'true'
Original file line number Diff line number Diff line change @@ -67,20 +67,20 @@ including the `<!-- toc -->` marker at the place where you want the TOC.
6767### Pre-commit script
6868
6969We also test that line lengths are less than 100 columns. To test this locally,
70- you can run ` ci/check_line_lengths .sh ` .
70+ you can run ` ci/lengthcheck .sh ` .
7171
7272You can also set this to run automatically.
7373
7474On Linux:
7575
7676``` bash
77- ln -s ../../ci/check_line_lengths .sh .git/hooks/pre-commit
77+ ln -s ../../ci/lengthcheck .sh .git/hooks/pre-commit
7878```
7979
8080On Windows:
8181
8282``` powershell
83- New-Item -Path .git/hooks/pre-commit -ItemType HardLink -Value <absolute_path/to/check_line_lengths .sh>
83+ New-Item -Path .git/hooks/pre-commit -ItemType HardLink -Value $(Resolve-Path ci/lengthcheck .sh)
8484```
8585
8686## How to fix toolstate failures
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3+ # Check files for lines that are too long.
4+
35if [ " $1 " == " --help" ]; then
46 echo ' Usage:' " [MAX_LINE_LENGTH=n] $0 [file ...]"
57 exit 1
@@ -10,8 +12,7 @@ if [ "$MAX_LINE_LENGTH" == "" ]; then
1012fi
1113
1214if [ " $1 " == " " ]; then
13- shopt -s globstar
14- files=( src/** /* .md )
15+ files=( src/* .md src/* /* .md src/* /* /* .md )
1516else
1617 files=( " $@ " )
1718fi
@@ -22,7 +23,6 @@ echo "Offending files and lines:"
2223(( bad_lines = 0 ))
2324(( inside_block = 0 ))
2425for file in " ${files[@]} " ; do
25- echo " $file "
2626 (( line_no = 0 ))
2727 while IFS=" " read -r line || [[ -n " $line " ]] ; do
2828 (( line_no++ ))
@@ -34,7 +34,7 @@ for file in "${files[@]}"; do
3434 && ! [[ " $line " =~ " | " | " -|-" | " ://" | " ]:" | \[\^ [^\ ]+\] : ]] \
3535 && (( "${# line} " > $MAX_LINE_LENGTH )) ; then
3636 (( bad_lines++ ))
37- echo -e " \t$line_no : $line "
37+ echo -e " \t$file : $ line_no : $line "
3838 fi
3939 done < " $file "
4040done
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ There are issues for beginners and advanced compiler devs alike!
311311Just a few things to keep in mind:
312312
313313- Please limit line length to 100 characters. This is enforced by CI, and you can run the checks
314- locally with ` ci/check_line_lengths .sh ` .
314+ locally with ` ci/lengthcheck .sh ` .
315315
316316- When contributing text to the guide, please contextualize the information with some time period
317317 and/or a reason so that the reader knows how much to trust or mistrust the information.
You can’t perform that action at this time.
0 commit comments