From 49d7c63ac70b77183ed526a47b70850ec4cc54d4 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sat, 30 Mar 2024 17:39:18 +0100 Subject: [PATCH] Delete length check 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. --- .github/workflows/ci.yml | 6 ------ README.md | 19 ------------------ ci/lengthcheck.sh | 43 ---------------------------------------- src/contributing.md | 6 +++--- 4 files changed, 3 insertions(+), 71 deletions(-) delete mode 100755 ci/lengthcheck.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b57831a1..0132d6983 100644 --- a/.github/workflows/ci.yml +++ b/.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/README.md b/README.md index 131651e38..500dcf9e4 100644 --- a/README.md +++ b/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 `` 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/ci/lengthcheck.sh b/ci/lengthcheck.sh deleted file mode 100755 index 76d677be7..000000000 --- a/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/contributing.md b/src/contributing.md index bad02e56b..4afa09b13 100644 --- a/src/contributing.md +++ b/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.