markdownlint: enforce 100 char max length (#4698)

This commit is contained in:
Julian LaNeve 2023-05-28 22:45:56 -04:00 committed by GitHub
parent cb45b25879
commit 5756829344
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 76 additions and 36 deletions

View File

@ -14,4 +14,7 @@ indent_size = 2
indent_size = 4 indent_size = 4
[*.snap] [*.snap]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.md]
max_line_length = 100

14
.markdownlint.yaml Normal file
View File

@ -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

View File

@ -17,12 +17,6 @@ repos:
rev: v0.33.0 rev: v0.33.0
hooks: hooks:
- id: markdownlint-fix - id: markdownlint-fix
args:
- --disable
- MD013 # line-length
- MD033 # no-inline-html
- MD041 # first-line-h1
- --
- repo: https://github.com/crate-ci/typos - repo: https://github.com/crate-ci/typos
rev: v1.14.8 rev: v1.14.8

View File

@ -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)) ### `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 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.) examples.)
When Ruff determines the enabled rule set, it has to reconcile `select` and `ignore` from a variety When Ruff determines the enabled rule set, it has to reconcile `select` and `ignore` from a variety

View File

@ -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 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. 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 1. Run Ruff locally against your file and verify the output is as expected. Once you're satisfied
added a new rule named `E402`, you could with the output (you see the violations you expect, and no others), proceed to the next step.
run `cargo run -p ruff_cli -- check crates/ruff/resources/test/fixtures/pycodestyle/E402.py --no-cache --select E402`. For example, if you're adding a new rule named `E402`, you would run:
Once you're satisfied with the output (you see the violations you expect, and no others), proceed
to the next step. ```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 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 a rule to a pre-existing set, you should be able to find a similar example to pattern-match

View File

@ -24,17 +24,18 @@ An extremely fast Python linter, written in Rust.
<i>Linting the CPython codebase from scratch.</i> <i>Linting the CPython codebase from scratch.</i>
</p> </p>
- ⚡️ 10-100x faster than existing linters - ⚡️ 10-100x faster than existing linters
- 🐍 Installable via `pip` - 🐍 Installable via `pip`
- 🛠️ `pyproject.toml` support - 🛠️ `pyproject.toml` support
- 🤝 Python 3.11 compatibility - 🤝 Python 3.11 compatibility
- 📦 Built-in caching, to avoid re-analyzing unchanged files - 📦 Built-in caching, to avoid re-analyzing unchanged files
- 🔧 Autofix support, for automatic error correction (e.g., automatically remove unused imports) - 🔧 Autofix support, for automatic error correction (e.g., automatically remove unused imports)
- 📏 Over [500 built-in rules](https://beta.ruff.rs/docs/rules/) - 📏 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 - ⚖️ [Near-parity](https://beta.ruff.rs/docs/faq/#how-does-ruff-compare-to-flake8) with the
- 🔌 Native re-implementations of dozens of Flake8 plugins, like flake8-bugbear built-in Flake8 rule set
- ⌨️ First-party editor integrations for [VS Code](https://github.com/astral-sh/ruff-vscode) and [more](https://github.com/astral-sh/ruff-lsp) - 🔌 Native re-implementations of dozens of Flake8 plugins, like flake8-bugbear
- 🌎 Monorepo-friendly, with [hierarchical and cascading configuration](https://beta.ruff.rs/docs/configuration/#pyprojecttoml-discovery) - ⌨️ 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 Ruff aims to be orders of magnitude faster than alternative tools while integrating more
functionality behind a single, common interface. 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), [**Timothy Crosley**](https://twitter.com/timothycrosley/status/1606420868514877440),
creator of [isort](https://github.com/PyCQA/isort): 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 [**Tim Abbott**](https://github.com/charliermarsh/ruff/issues/465#issuecomment-1317400028), lead
developer of [Zulip](https://github.com/zulip/zulip): 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) - [FastAPI](https://github.com/tiangolo/fastapi)
- [Gradio](https://github.com/gradio-app/gradio) - [Gradio](https://github.com/gradio-app/gradio)
- [Great Expectations](https://github.com/great-expectations/great_expectations) - [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) - [Hatch](https://github.com/pypa/hatch)
- [Home Assistant](https://github.com/home-assistant/core) - [Home Assistant](https://github.com/home-assistant/core)
- [Ibis](https://github.com/ibis-project/ibis) - [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)) - Modern Treasury ([Python SDK](https://github.com/Modern-Treasury/modern-treasury-python-sdk))
- Mozilla ([Firefox](https://github.com/mozilla/gecko-dev)) - Mozilla ([Firefox](https://github.com/mozilla/gecko-dev))
- [MegaLinter](https://github.com/oxsecurity/megalinter) - [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)) - Netflix ([Dispatch](https://github.com/Netflix/dispatch))
- [Neon](https://github.com/neondatabase/neon) - [Neon](https://github.com/neondatabase/neon)
- [ONNX](https://github.com/onnx/onnx) - [ONNX](https://github.com/onnx/onnx)

View File

@ -12,8 +12,9 @@ cargo benchmark
## Benchmark driven Development ## Benchmark driven Development
You can use `--save-baseline=<name>` to store an initial baseline benchmark (e.g. on `main`) and then use You can use `--save-baseline=<name>` to store an initial baseline benchmark (e.g. on `main`) and
`--benchmark=<name>` to compare against that benchmark. Criterion will print a message telling you if the benchmark improved/regressed compared to that baseline. then use `--benchmark=<name>` to compare against that benchmark. Criterion will print a message
telling you if the benchmark improved/regressed compared to that baseline.
```shell ```shell
# Run once on your "baseline" code # Run once on your "baseline" code
@ -46,7 +47,8 @@ cargo install critcmp
## Tips ## Tips
- Use `cargo benchmark <filter>` to only run specific benchmarks. For example: `cargo benchmark linter/pydantic` to only run the pydantic tests. - Use `cargo benchmark <filter>` 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 --quiet` for a more cleaned up output (without statistical relevance)
- Use `cargo benchmark --quick` to get faster results (more prone to noise) - 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 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 - You may want to pass an additional filter to run a single test file

View File

@ -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. - `0` if no violations were found, or if all present violations were fixed automatically.
- `1` if violations were found. - `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. This convention mirrors that of tools like ESLint, Prettier, and RuboCop.

View File

@ -194,7 +194,16 @@ let g:ale_fixers = {
</details> </details>
<details> <details>
<summary>Ruff can also be integrated via <a href="https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#efm"><code>efm</code></a> in just a <a href="https://github.com/JafarAbdi/myconfigs/blob/6f0b6b2450e92ec8fc50422928cd22005b919110/efm-langserver/config.yaml#L14-L20">few lines</a>.</summary> <summary>
Ruff can also be integrated via
<a href="https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#efm">
<code>efm</code>
</a>
in just a
<a href="https://github.com/JafarAbdi/myconfigs/blob/6f0b6b2450e92ec8fc50422928cd22005b919110/efm-langserver/config.yaml#L14-L20">
few lines.
</a>
</summary>
<br> <br>
```yaml ```yaml
@ -211,7 +220,12 @@ tools:
</details> </details>
<details> <details>
<summary>For neovim users using <a href="https://github.com/jose-elias-alvarez/null-ls.nvim"><code>null-ls</code></a>, Ruff is already <a href="https://github.com/jose-elias-alvarez/null-ls.nvim">integrated</a>.</summary> <summary>
For neovim users using
<a href="https://github.com/jose-elias-alvarez/null-ls.nvim">
<code>null-ls</code>
</a>, Ruff is already <a href="https://github.com/jose-elias-alvarez/null-ls.nvim">integrated</a>.
</summary>
<br> <br>
```lua ```lua

View File

@ -6,7 +6,8 @@ Ruff is available as [`ruff`](https://pypi.org/project/ruff/) on PyPI:
pip install ruff 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 ```shell
brew install ruff brew install ruff

View File

@ -6,7 +6,8 @@ Utilities for benchmarking Ruff.
Run `./scripts/benchmarks/run.sh` to clone the benchmarking target (CPython). 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 ## Running Benchmarks