-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add formatter to line-length
documentation
#8150
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
29142df
to
1c1aed4
Compare
@@ -107,7 +107,7 @@ To configure Ruff, let's create a `pyproject.toml` file in our project's root di | |||
|
|||
```toml | |||
[tool.ruff] | |||
# Set the maximum line length to 79 characters. | |||
# Set the maximum line length to 79. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm undecided if we should remove characters
from here. I don't think mentioning it is necessary, most will assume characters anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of removing it
1c1aed4
to
de85ade
Compare
/// The length is determined by the number of characters per line, except for lines containing East Asian characters or emojis. | ||
/// For these lines, the [unicode width](https://unicode.org/reports/tr11/) of each character is added up to determine the length. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// The length is determined by the number of characters per line, except for lines containing East Asian characters or emojis. | |
/// For these lines, the [unicode width](https://unicode.org/reports/tr11/) of each character is added up to determine the length. | |
/// The length is determined by the [unicode width](https://unicode.org/reports/tr11/). For ASCII text, | |
/// this is number of characters, but for others such as East Asian characters or emoji, the width varies. | |
/// Note that the unicode width does not necessarily line up with columns in your editor. |
@@ -107,7 +107,7 @@ To configure Ruff, let's create a `pyproject.toml` file in our project's root di | |||
|
|||
```toml | |||
[tool.ruff] | |||
# Set the maximum line length to 79 characters. | |||
# Set the maximum line length to 79. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of removing it
/// documentation (`W505`), including standalone comments. By default, | ||
/// this is set to null which disables reporting violations. | ||
/// | ||
/// The length is determined by the number of characters per line, except for lines containinAsian characters or emojis. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
containinAsian
typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most certainly
Summary
This PR updates the
line-length
option documentation to mention its usage in the formatter.I used this as an opportunity to clarify how the line-length is measured (using unicode width rather than characters) and removed the
(characters)
unit from theline-too-long
anddoc-line-too-long
lints.Closes #7574
Closes #7573
Note: I decided not to rename the options to
-width
, at least for now. Mainly because performing the renaming causes other inconsistencies:line-too-long
would need to be renamed toline-too-wide
. Same fordoc-line-too-long
ignore-overlong-task-comments
option would need to be renamed toignore-overwide-task-comments
.While I like
width
more, it seemed out of scope to rush these changes before the formatter release (and change it as part of a patch release).Test Plan
I generated and reviewed the build documentation.