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=efm in just a few lines.efm
+
+in just a
+
+ few lines.
+
+null-ls, Ruff is already integrated.null-ls
+, Ruff is already integrated.
+