about summary refs log tree commit diff
path: root/src/doc/rustc-dev-guide
diff options
context:
space:
mode:
authorNilstrieb <48135649+Nilstrieb@users.noreply.github.com>2024-03-30 17:46:30 +0100
committerGitHub <noreply@github.com>2024-03-30 17:46:30 +0100
commit3da49452e09bfa9a9841b7877140677f6ee2e728 (patch)
tree0b882d763cefaebd4f9192bc242fdefe6e26346b /src/doc/rustc-dev-guide
parent3b787cfdcbec4dfad40ad9b48704d912311103b4 (diff)
downloadrust-3da49452e09bfa9a9841b7877140677f6ee2e728.tar.gz
rust-3da49452e09bfa9a9841b7877140677f6ee2e728.zip
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.
Diffstat (limited to 'src/doc/rustc-dev-guide')
-rw-r--r--src/doc/rustc-dev-guide/.github/workflows/ci.yml6
-rw-r--r--src/doc/rustc-dev-guide/README.md19
-rwxr-xr-xsrc/doc/rustc-dev-guide/ci/lengthcheck.sh43
-rw-r--r--src/doc/rustc-dev-guide/src/contributing.md6
4 files changed, 3 insertions, 71 deletions
diff --git a/src/doc/rustc-dev-guide/.github/workflows/ci.yml b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
index 7b57831a109..0132d6983e8 100644
--- a/src/doc/rustc-dev-guide/.github/workflows/ci.yml
+++ b/src/doc/rustc-dev-guide/.github/workflows/ci.yml
@@ -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: |
diff --git a/src/doc/rustc-dev-guide/README.md b/src/doc/rustc-dev-guide/README.md
index 131651e3871..500dcf9e43b 100644
--- a/src/doc/rustc-dev-guide/README.md
+++ b/src/doc/rustc-dev-guide/README.md
@@ -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
diff --git a/src/doc/rustc-dev-guide/ci/lengthcheck.sh b/src/doc/rustc-dev-guide/ci/lengthcheck.sh
deleted file mode 100755
index 76d677be74b..00000000000
--- a/src/doc/rustc-dev-guide/ci/lengthcheck.sh
+++ /dev/null
@@ -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 ))
diff --git a/src/doc/rustc-dev-guide/src/contributing.md b/src/doc/rustc-dev-guide/src/contributing.md
index bad02e56b7a..4afa09b13be 100644
--- a/src/doc/rustc-dev-guide/src/contributing.md
+++ b/src/doc/rustc-dev-guide/src/contributing.md
@@ -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.