File tree 4 files changed +9
-9
lines changed
4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 46
46
if : github.event_name != 'push'
47
47
run : |
48
48
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
50
50
51
51
- name : Install latest nightly Rust toolchain
52
52
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.
67
67
### Pre-commit script
68
68
69
69
We 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 ` .
71
71
72
72
You can also set this to run automatically.
73
73
74
74
On Linux:
75
75
76
76
``` bash
77
- ln -s ../../ci/check_line_lengths .sh .git/hooks/pre-commit
77
+ ln -s ../../ci/lengthcheck .sh .git/hooks/pre-commit
78
78
```
79
79
80
80
On Windows:
81
81
82
82
``` 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)
84
84
```
85
85
86
86
## How to fix toolstate failures
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ # Check files for lines that are too long.
4
+
3
5
if [ " $1 " == " --help" ]; then
4
6
echo ' Usage:' " [MAX_LINE_LENGTH=n] $0 [file ...]"
5
7
exit 1
@@ -10,8 +12,7 @@ if [ "$MAX_LINE_LENGTH" == "" ]; then
10
12
fi
11
13
12
14
if [ " $1 " == " " ]; then
13
- shopt -s globstar
14
- files=( src/** /* .md )
15
+ files=( src/* .md src/* /* .md src/* /* /* .md )
15
16
else
16
17
files=( " $@ " )
17
18
fi
@@ -22,7 +23,6 @@ echo "Offending files and lines:"
22
23
(( bad_lines = 0 ))
23
24
(( inside_block = 0 ))
24
25
for file in " ${files[@]} " ; do
25
- echo " $file "
26
26
(( line_no = 0 ))
27
27
while IFS=" " read -r line || [[ -n " $line " ]] ; do
28
28
(( line_no++ ))
@@ -34,7 +34,7 @@ for file in "${files[@]}"; do
34
34
&& ! [[ " $line " =~ " | " | " -|-" | " ://" | " ]:" | \[\^ [^\ ]+\] : ]] \
35
35
&& (( "${# line} " > $MAX_LINE_LENGTH )) ; then
36
36
(( bad_lines++ ))
37
- echo -e " \t$line_no : $line "
37
+ echo -e " \t$file : $ line_no : $line "
38
38
fi
39
39
done < " $file "
40
40
done
Original file line number Diff line number Diff line change @@ -311,7 +311,7 @@ There are issues for beginners and advanced compiler devs alike!
311
311
Just a few things to keep in mind:
312
312
313
313
- 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 ` .
315
315
316
316
- When contributing text to the guide, please contextualize the information with some time period
317
317
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