From bf8108469fb80ab36c44ab75b127858c63c65b66 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Wed, 15 Feb 2023 21:20:35 +0100 Subject: [PATCH] Remove auto-generated table of contents --- README.md | 47 +-------------------- crates/ruff_dev/src/generate_rules_table.rs | 16 +------ 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 4552e4efca..c067ccf1e7 100644 --- a/README.md +++ b/README.md @@ -117,52 +117,7 @@ This README is also available as [documentation](https://beta.ruff.rs/docs/). 1. [Installation and Usage](#installation-and-usage) 1. [Configuration](#configuration) -1. [Supported Rules](#supported-rules) - 1. [Pyflakes (F)](#pyflakes-f) - 1. [pycodestyle (E, W)](#pycodestyle-e-w) - 1. [mccabe (C90)](#mccabe-c90) - 1. [isort (I)](#isort-i) - 1. [pep8-naming (N)](#pep8-naming-n) - 1. [pydocstyle (D)](#pydocstyle-d) - 1. [pyupgrade (UP)](#pyupgrade-up) - 1. [flake8-2020 (YTT)](#flake8-2020-ytt) - 1. [flake8-annotations (ANN)](#flake8-annotations-ann) - 1. [flake8-bandit (S)](#flake8-bandit-s) - 1. [flake8-blind-except (BLE)](#flake8-blind-except-ble) - 1. [flake8-boolean-trap (FBT)](#flake8-boolean-trap-fbt) - 1. [flake8-bugbear (B)](#flake8-bugbear-b) - 1. [flake8-builtins (A)](#flake8-builtins-a) - 1. [flake8-commas (COM)](#flake8-commas-com) - 1. [flake8-comprehensions (C4)](#flake8-comprehensions-c4) - 1. [flake8-datetimez (DTZ)](#flake8-datetimez-dtz) - 1. [flake8-debugger (T10)](#flake8-debugger-t10) - 1. [flake8-django (DJ)](#flake8-django-dj) - 1. [flake8-errmsg (EM)](#flake8-errmsg-em) - 1. [flake8-executable (EXE)](#flake8-executable-exe) - 1. [flake8-implicit-str-concat (ISC)](#flake8-implicit-str-concat-isc) - 1. [flake8-import-conventions (ICN)](#flake8-import-conventions-icn) - 1. [flake8-logging-format (G)](#flake8-logging-format-g) - 1. [flake8-no-pep420 (INP)](#flake8-no-pep420-inp) - 1. [flake8-pie (PIE)](#flake8-pie-pie) - 1. [flake8-print (T20)](#flake8-print-t20) - 1. [flake8-pyi (PYI)](#flake8-pyi-pyi) - 1. [flake8-pytest-style (PT)](#flake8-pytest-style-pt) - 1. [flake8-quotes (Q)](#flake8-quotes-q) - 1. [flake8-raise (RSE)](#flake8-raise-rse) - 1. [flake8-return (RET)](#flake8-return-ret) - 1. [flake8-self (SLF)](#flake8-self-slf) - 1. [flake8-simplify (SIM)](#flake8-simplify-sim) - 1. [flake8-tidy-imports (TID)](#flake8-tidy-imports-tid) - 1. [flake8-type-checking (TCH)](#flake8-type-checking-tch) - 1. [flake8-unused-arguments (ARG)](#flake8-unused-arguments-arg) - 1. [flake8-use-pathlib (PTH)](#flake8-use-pathlib-pth) - 1. [eradicate (ERA)](#eradicate-era) - 1. [pandas-vet (PD)](#pandas-vet-pd) - 1. [pygrep-hooks (PGH)](#pygrep-hooks-pgh) - 1. [Pylint (PL)](#pylint-pl) - 1. [tryceratops (TRY)](#tryceratops-try) - 1. [NumPy-specific rules (NPY)](#numpy-specific-rules-npy) - 1. [Ruff-specific rules (RUF)](#ruff-specific-rules-ruf) +1. [Supported Rules](#supported-rules) 1. [Editor Integrations](#editor-integrations) 1. [FAQ](#faq) 1. [Contributing](#contributing) diff --git a/crates/ruff_dev/src/generate_rules_table.rs b/crates/ruff_dev/src/generate_rules_table.rs index 179a251a90..97c6a45f0f 100644 --- a/crates/ruff_dev/src/generate_rules_table.rs +++ b/crates/ruff_dev/src/generate_rules_table.rs @@ -11,9 +11,6 @@ use crate::utils::replace_readme_section; const TABLE_BEGIN_PRAGMA: &str = "\n"; const TABLE_END_PRAGMA: &str = ""; -const TOC_BEGIN_PRAGMA: &str = ""; -const TOC_END_PRAGMA: &str = ""; - const FIX_SYMBOL: &str = "🛠"; const URL_PREFIX: &str = "https://beta.ruff.rs/docs/rules"; @@ -57,7 +54,6 @@ fn generate_table(table_out: &mut String, rules: impl IntoIterator, pub fn main(args: &Args) -> Result<()> { // Generate the table string. let mut table_out = format!("The {FIX_SYMBOL} emoji indicates that a rule is automatically fixable by the `--fix` command-line option.\n\n"); - let mut toc_out = String::new(); for linter in Linter::iter() { let codes_csv: String = match linter.common_prefix() { "" => linter @@ -72,14 +68,6 @@ pub fn main(args: &Args) -> Result<()> { table_out.push('\n'); table_out.push('\n'); - toc_out.push_str(&format!( - " 1. [{} ({})](#{}-{})\n", - linter.name(), - codes_csv, - linter.name().to_lowercase().replace(' ', "-"), - codes_csv.to_lowercase().replace(',', "-").replace(' ', "") - )); - if let Some(url) = linter.url() { let host = url .trim_start_matches("https://") @@ -121,10 +109,8 @@ pub fn main(args: &Args) -> Result<()> { } if args.dry_run { - print!("Table of Contents: {toc_out}\n Rules Tables: {table_out}"); + print!("Rules Tables: {table_out}"); } else { - // Extra newline in the markdown numbered list looks weird - replace_readme_section(toc_out.trim_end(), TOC_BEGIN_PRAGMA, TOC_END_PRAGMA)?; replace_readme_section(&table_out, TABLE_BEGIN_PRAGMA, TABLE_END_PRAGMA)?; }