From 575682934483f51b3707fba703be5c8fff8802aa Mon Sep 17 00:00:00 2001
From: Julian LaNeve
Date: Sun, 28 May 2023 22:45:56 -0400
Subject: [PATCH] markdownlint: enforce 100 char max length (#4698)
---
.editorconfig | 5 ++++-
.markdownlint.yaml | 14 ++++++++++++++
.pre-commit-config.yaml | 6 ------
BREAKING_CHANGES.md | 3 ++-
CONTRIBUTING.md | 12 +++++++-----
README.md | 34 +++++++++++++++++++--------------
crates/ruff_benchmark/README.md | 11 +++++++----
docs/configuration.md | 3 ++-
docs/editor-integrations.md | 18 +++++++++++++++--
docs/installation.md | 3 ++-
scripts/benchmarks/README.md | 3 ++-
11 files changed, 76 insertions(+), 36 deletions(-)
create mode 100644 .markdownlint.yaml
diff --git a/.editorconfig b/.editorconfig
index 776563c1e1..11c29680d7 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -14,4 +14,7 @@ indent_size = 2
indent_size = 4
[*.snap]
-trim_trailing_whitespace = false
\ No newline at end of file
+trim_trailing_whitespace = false
+
+[*.md]
+max_line_length = 100
\ No newline at end of file
diff --git a/.markdownlint.yaml b/.markdownlint.yaml
new file mode 100644
index 0000000000..66c4aeca0e
--- /dev/null
+++ b/.markdownlint.yaml
@@ -0,0 +1,14 @@
+# default to true for all rules
+default: true
+
+# MD033/no-inline-html
+MD033: false
+
+# MD041/first-line-h1
+MD041: false
+
+# MD013/line-length
+MD013:
+ line_length: 100
+ code_blocks: false
+ ignore_code_blocks: true
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4283cdcfef..cf2933368a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -17,12 +17,6 @@ repos:
rev: v0.33.0
hooks:
- id: markdownlint-fix
- args:
- - --disable
- - MD013 # line-length
- - MD033 # no-inline-html
- - MD041 # first-line-h1
- - --
- repo: https://github.com/crate-ci/typos
rev: v1.14.8
diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md
index c76d5b82a6..b935fed041 100644
--- a/BREAKING_CHANGES.md
+++ b/BREAKING_CHANGES.md
@@ -86,7 +86,8 @@ the intention of adding a stable public API in the future.
### `select`, `extend-select`, `ignore`, and `extend-ignore` have new semantics ([#2312](https://github.com/charliermarsh/ruff/pull/2312))
Previously, the interplay between `select` and its related options could lead to unexpected
-behavior. For example, `ruff --select E501 --ignore ALL` and `ruff --select E501 --extend-ignore ALL` behaved differently. (See [#2312](https://github.com/charliermarsh/ruff/pull/2312) for more
+behavior. For example, `ruff --select E501 --ignore ALL` and `ruff --select E501 --extend-ignore ALL`
+behaved differently. (See [#2312](https://github.com/charliermarsh/ruff/pull/2312) for more
examples.)
When Ruff determines the enabled rule set, it has to reconcile `select` and `ignore` from a variety
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 958539b111..2ccec828a0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -166,11 +166,13 @@ Once you've completed the code for the rule itself, you can define tests with th
want to test. The file name should match the rule name (e.g., `E402.py`), and it should include
examples of both violations and non-violations.
-1. Run Ruff locally against your file and verify the output is as expected. For example, if you
- added a new rule named `E402`, you could
- run `cargo run -p ruff_cli -- check crates/ruff/resources/test/fixtures/pycodestyle/E402.py --no-cache --select E402`.
- Once you're satisfied with the output (you see the violations you expect, and no others), proceed
- to the next step.
+1. Run Ruff locally against your file and verify the output is as expected. Once you're satisfied
+ with the output (you see the violations you expect, and no others), proceed to the next step.
+ For example, if you're adding a new rule named `E402`, you would run:
+
+ ```shell
+ cargo run -p ruff_cli -- check crates/ruff/resources/test/fixtures/pycodestyle/E402.py --no-cache
+ ```
1. Add the test to the relevant `crates/ruff/src/rules/[linter]/mod.rs` file. If you're contributing
a rule to a pre-existing set, you should be able to find a similar example to pattern-match
diff --git a/README.md b/README.md
index fc94c4fc12..afa9c13220 100644
--- a/README.md
+++ b/README.md
@@ -24,17 +24,18 @@ An extremely fast Python linter, written in Rust.
Linting the CPython codebase from scratch.
-- ⚡️ 10-100x faster than existing linters
-- 🐍 Installable via `pip`
-- 🛠️ `pyproject.toml` support
-- 🤝 Python 3.11 compatibility
-- 📦 Built-in caching, to avoid re-analyzing unchanged files
-- 🔧 Autofix support, for automatic error correction (e.g., automatically remove unused imports)
-- 📏 Over [500 built-in rules](https://beta.ruff.rs/docs/rules/)
-- ⚖️ [Near-parity](https://beta.ruff.rs/docs/faq/#how-does-ruff-compare-to-flake8) with the built-in Flake8 rule set
-- 🔌 Native re-implementations of dozens of Flake8 plugins, like flake8-bugbear
-- ⌨️ First-party editor integrations for [VS Code](https://github.com/astral-sh/ruff-vscode) and [more](https://github.com/astral-sh/ruff-lsp)
-- 🌎 Monorepo-friendly, with [hierarchical and cascading configuration](https://beta.ruff.rs/docs/configuration/#pyprojecttoml-discovery)
+- ⚡️ 10-100x faster than existing linters
+- 🐍 Installable via `pip`
+- 🛠️ `pyproject.toml` support
+- 🤝 Python 3.11 compatibility
+- 📦 Built-in caching, to avoid re-analyzing unchanged files
+- 🔧 Autofix support, for automatic error correction (e.g., automatically remove unused imports)
+- 📏 Over [500 built-in rules](https://beta.ruff.rs/docs/rules/)
+- ⚖️ [Near-parity](https://beta.ruff.rs/docs/faq/#how-does-ruff-compare-to-flake8) with the
+ built-in Flake8 rule set
+- 🔌 Native re-implementations of dozens of Flake8 plugins, like flake8-bugbear
+- ⌨️ First-party editor integrations for [VS Code](https://github.com/astral-sh/ruff-vscode) and [more](https://github.com/astral-sh/ruff-lsp)
+- 🌎 Monorepo-friendly, with [hierarchical and cascading configuration](https://beta.ruff.rs/docs/configuration/#pyprojecttoml-discovery)
Ruff aims to be orders of magnitude faster than alternative tools while integrating more
functionality behind a single, common interface.
@@ -84,7 +85,8 @@ of [Conda](https://docs.conda.io/en/latest/):
[**Timothy Crosley**](https://twitter.com/timothycrosley/status/1606420868514877440),
creator of [isort](https://github.com/PyCQA/isort):
-> Just switched my first project to Ruff. Only one downside so far: it's so fast I couldn't believe it was working till I intentionally introduced some errors.
+> Just switched my first project to Ruff. Only one downside so far: it's so fast I couldn't believe
+> it was working till I intentionally introduced some errors.
[**Tim Abbott**](https://github.com/charliermarsh/ruff/issues/465#issuecomment-1317400028), lead
developer of [Zulip](https://github.com/zulip/zulip):
@@ -352,7 +354,9 @@ Ruff is used by a number of major open-source projects and companies, including:
- [FastAPI](https://github.com/tiangolo/fastapi)
- [Gradio](https://github.com/gradio-app/gradio)
- [Great Expectations](https://github.com/great-expectations/great_expectations)
-- Hugging Face ([Transformers](https://github.com/huggingface/transformers), [Datasets](https://github.com/huggingface/datasets), [Diffusers](https://github.com/huggingface/diffusers))
+- Hugging Face ([Transformers](https://github.com/huggingface/transformers),
+ [Datasets](https://github.com/huggingface/datasets),
+ [Diffusers](https://github.com/huggingface/diffusers))
- [Hatch](https://github.com/pypa/hatch)
- [Home Assistant](https://github.com/home-assistant/core)
- [Ibis](https://github.com/ibis-project/ibis)
@@ -364,7 +368,9 @@ Ruff is used by a number of major open-source projects and companies, including:
- Modern Treasury ([Python SDK](https://github.com/Modern-Treasury/modern-treasury-python-sdk))
- Mozilla ([Firefox](https://github.com/mozilla/gecko-dev))
- [MegaLinter](https://github.com/oxsecurity/megalinter)
-- Microsoft ([Semantic Kernel](https://github.com/microsoft/semantic-kernel), [ONNX Runtime](https://github.com/microsoft/onnxruntime), [LightGBM](https://github.com/microsoft/LightGBM))
+- Microsoft ([Semantic Kernel](https://github.com/microsoft/semantic-kernel),
+ [ONNX Runtime](https://github.com/microsoft/onnxruntime),
+ [LightGBM](https://github.com/microsoft/LightGBM))
- Netflix ([Dispatch](https://github.com/Netflix/dispatch))
- [Neon](https://github.com/neondatabase/neon)
- [ONNX](https://github.com/onnx/onnx)
diff --git a/crates/ruff_benchmark/README.md b/crates/ruff_benchmark/README.md
index 3e85474385..3151b03b95 100644
--- a/crates/ruff_benchmark/README.md
+++ b/crates/ruff_benchmark/README.md
@@ -12,8 +12,9 @@ cargo benchmark
## Benchmark driven Development
-You can use `--save-baseline=` to store an initial baseline benchmark (e.g. on `main`) and then use
-`--benchmark=` to compare against that benchmark. Criterion will print a message telling you if the benchmark improved/regressed compared to that baseline.
+You can use `--save-baseline=` to store an initial baseline benchmark (e.g. on `main`) and
+then use `--benchmark=` to compare against that benchmark. Criterion will print a message
+telling you if the benchmark improved/regressed compared to that baseline.
```shell
# Run once on your "baseline" code
@@ -46,7 +47,8 @@ cargo install critcmp
## Tips
-- Use `cargo benchmark ` to only run specific benchmarks. For example: `cargo benchmark linter/pydantic` to only run the pydantic tests.
+- Use `cargo benchmark ` to only run specific benchmarks. For example: `cargo benchmark linter/pydantic`
+ to only run the pydantic tests.
- Use `cargo benchmark --quiet` for a more cleaned up output (without statistical relevance)
- Use `cargo benchmark --quick` to get faster results (more prone to noise)
@@ -84,5 +86,6 @@ Then run the profiler with
cargo instruments -t time --bench linter --profile release-debug -p ruff_benchmark -- --profile-time=1
```
-- `-t`: Specifies what to profile. Useful options are `time` to profile the wall time and `alloc` for profiling the allocations.
+- `-t`: Specifies what to profile. Useful options are `time` to profile the wall time and `alloc`
+ for profiling the allocations.
- You may want to pass an additional filter to run a single test file
diff --git a/docs/configuration.md b/docs/configuration.md
index d7ad03733d..9397019f53 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -442,7 +442,8 @@ By default, Ruff exits with the following status codes:
- `0` if no violations were found, or if all present violations were fixed automatically.
- `1` if violations were found.
-- `2` if Ruff terminates abnormally due to invalid configuration, invalid CLI options, or an internal error.
+- `2` if Ruff terminates abnormally due to invalid configuration, invalid CLI options, or an
+ internal error.
This convention mirrors that of tools like ESLint, Prettier, and RuboCop.
diff --git a/docs/editor-integrations.md b/docs/editor-integrations.md
index 6264f45c9c..45b1e2da49 100644
--- a/docs/editor-integrations.md
+++ b/docs/editor-integrations.md
@@ -194,7 +194,16 @@ let g:ale_fixers = {
-Ruff can also be integrated via efm in just a few lines.
+
+Ruff can also be integrated via
+
+ efm
+
+in just a
+
+ few lines.
+
+
```yaml
@@ -211,7 +220,12 @@ tools:
-For neovim users using null-ls, Ruff is already integrated.
+
+For neovim users using
+
+ null-ls
+, Ruff is already integrated.
+
```lua
diff --git a/docs/installation.md b/docs/installation.md
index 689d04c4b0..259946f851 100644
--- a/docs/installation.md
+++ b/docs/installation.md
@@ -6,7 +6,8 @@ Ruff is available as [`ruff`](https://pypi.org/project/ruff/) on PyPI:
pip install ruff
```
-For **macOS Homebrew** and **Linuxbrew** users, Ruff is also available as [`ruff`](https://formulae.brew.sh/formula/ruff) on Homebrew:
+For **macOS Homebrew** and **Linuxbrew** users, Ruff is also available as [`ruff`](https://formulae.brew.sh/formula/ruff)
+on Homebrew:
```shell
brew install ruff
diff --git a/scripts/benchmarks/README.md b/scripts/benchmarks/README.md
index 18e66ef78c..d54171c0c2 100644
--- a/scripts/benchmarks/README.md
+++ b/scripts/benchmarks/README.md
@@ -6,7 +6,8 @@ Utilities for benchmarking Ruff.
Run `./scripts/benchmarks/run.sh` to clone the benchmarking target (CPython).
-If you're looking to benchmark Ruff against other tools, you'll also need to run `poetry install` to create a virtual environment with the required dependencies.
+If you're looking to benchmark Ruff against other tools, you'll also need to run `poetry install`
+to create a virtual environment with the required dependencies.
## Running Benchmarks