From ccfc78e2d5d886ec26f3c740189a320eee59dc15 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 3 May 2023 01:19:38 +0200 Subject: [PATCH] faq: Clarify how Ruff and Black treat line-length. (#4180) --- docs/faq.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/faq.md b/docs/faq.md index af7693b049..4cb6e3c8fa 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -8,6 +8,12 @@ the `line-length` setting is consistent between the two. As a project, Ruff is designed to be used alongside Black and, as such, will defer implementing stylistic lint rules that are obviated by autoformatting. +Note that Ruff and Black treat line-length enforcement a little differently. Black makes a +best-effort attempt to adhere to the `line-length`, but avoids automatic line-wrapping in some cases +(e.g., within comments). Ruff, on the other hand, will flag rule `E501` for any line that exceeds +the `line-length` setting. As such, if `E501` is enabled, Ruff can still trigger line-length +violations even when Black is enabled. + ## How does Ruff compare to Flake8? (Coming from Flake8? Try [`flake8-to-ruff`](https://pypi.org/project/flake8-to-ruff/) to