Delete length check (#1952)

It's super annoying to be forced to use this bad convention, and
apparently everyone agrees. The only reason no improvements have been
done is because those were blocked on writing a better checker.

I strongly believe that no checker is better than a bad checker, so
let's just delete it in the meantime. I kindly asked anyone who sees
this to complain about overly long sentences in review in the future, I
think we can make this turn out fine.
This commit is contained in:
Nilstrieb 2024-03-30 17:46:30 +01:00 committed by GitHub
parent 69c820a470
commit 023c0f2592
4 changed files with 3 additions and 71 deletions

View File

@ -42,12 +42,6 @@ jobs:
~/book/linkcheck
key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
- name: Check line lengths
if: github.event_name != 'push'
run: |
shopt -s globstar
MAX_LINE_LENGTH=100 bash ci/lengthcheck.sh src/**/*.md
- name: Install latest nightly Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |

View File

@ -64,25 +64,6 @@ We use `mdbook-linkcheck` to validate URLs included in our documentation.
We use `mdbook-toc` to auto-generate TOCs for long sections. You can invoke the preprocessor by
including the `<!-- toc -->` marker at the place where you want the TOC.
### Pre-commit script
We also test that line lengths are less than 100 columns. To test this locally,
you can run `ci/lengthcheck.sh`.
You can also set this to run automatically.
On Linux:
```bash
ln -s ../../ci/lengthcheck.sh .git/hooks/pre-commit
```
On Windows:
```powershell
New-Item -Path .git/hooks/pre-commit -ItemType HardLink -Value $(Resolve-Path ci/lengthcheck.sh)
```
## How to fix toolstate failures
> **NOTE**: Currently, we do not track the rustc-dev-guide toolstate due to

View File

@ -1,43 +0,0 @@
#!/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
fi
if [ "$MAX_LINE_LENGTH" == "" ]; then
MAX_LINE_LENGTH=100
fi
if [ "$1" == "" ]; then
files=( src/*.md src/*/*.md src/*/*/*.md )
else
files=( "$@" )
fi
echo "Checking line lengths in all source files <= $MAX_LINE_LENGTH chars..."
echo "Offending files and lines:"
(( bad_lines = 0 ))
(( inside_block = 0 ))
for file in "${files[@]}"; do
(( line_no = 0 ))
while IFS="" read -r line || [[ -n "$line" ]] ; do
(( line_no++ ))
if [[ "$line" =~ ^'```' ]] ; then
(( inside_block = !$inside_block ))
continue
fi
if ! (( $inside_block )) \
&& ! [[ "$line" =~ " | "|"-|-"|"://"|"]:"|\[\^[^\ ]+\]: ]] \
&& (( "${#line}" > $MAX_LINE_LENGTH )) ; then
(( bad_lines++ ))
echo -e "\t$file:$line_no : $line"
fi
done < "$file"
done
echo "$bad_lines offending lines found."
(( $bad_lines == 0 ))

View File

@ -316,9 +316,9 @@ There are issues for beginners and advanced compiler devs alike!
Just a few things to keep in mind:
- Please limit line length to 100 characters.
This is enforced by CI,
and you can run the checks locally with `ci/lengthcheck.sh`.
- Please try to avoid overly long lines and use semantic line breaks (so break the line after a sentence).
There is no strict limit on line lengths, let the sentence or part of the sentence flow to its proper end on the same line.
There is currently nothing stopping anyone from creating overly long lines, just do your best to avoid them.
- When contributing text to the guide, please contextualize the information with some time period
and/or a reason so that the reader knows how much to trust or mistrust the information.