mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
Remove auto-generated table of contents
This commit is contained in:
parent
a2277cfeba
commit
bf8108469f
2 changed files with 2 additions and 61 deletions
47
README.md
47
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) <!-- Begin auto-generated table of contents. -->
|
||||
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)<!-- End auto-generated table of contents. -->
|
||||
1. [Supported Rules](#supported-rules)
|
||||
1. [Editor Integrations](#editor-integrations)
|
||||
1. [FAQ](#faq)
|
||||
1. [Contributing](#contributing)
|
||||
|
|
|
@ -11,9 +11,6 @@ use crate::utils::replace_readme_section;
|
|||
const TABLE_BEGIN_PRAGMA: &str = "<!-- Begin auto-generated sections. -->\n";
|
||||
const TABLE_END_PRAGMA: &str = "<!-- End auto-generated sections. -->";
|
||||
|
||||
const TOC_BEGIN_PRAGMA: &str = "<!-- Begin auto-generated table of contents. -->";
|
||||
const TOC_END_PRAGMA: &str = "<!-- End auto-generated table of contents. -->";
|
||||
|
||||
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<Item = Rule>,
|
|||
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)?;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue