Skip to content

[CI] Limit max line length#116

Open
adam-smnk wants to merge 1 commit intollvm:mainfrom
adam-smnk:ci-ruff-enable-e501
Open

[CI] Limit max line length#116
adam-smnk wants to merge 1 commit intollvm:mainfrom
adam-smnk:ci-ruff-enable-e501

Conversation

@adam-smnk
Copy link
Copy Markdown
Member

Enables linter's E501 rule to enforce maximum line length. The rule is separate from the code formatter and primarily targets blocks of comments, strings, documentation etc.
Ruff version is also bumped to allow more control over the linter such as disabling rules for blocks of code.

Files are reformatted to adhere to the new linter rule. There is no auto fix available, offending cases have to be addressed manually.

Enables linter's E501 rule to enforce maximum line length.
The rule is separate from the code formatter and primarily targets
blocks of comments, strings, documentation etc.
Ruff version is also bumped to allow more control over the linter such
as disabling rules for blocks of code.

Files are reformatted to adhere to the new linter rule.
There is no auto fix available, offending cases have to be addressed
manually.
@rengolin
Copy link
Copy Markdown
Member

rengolin commented Apr 9, 2026

There is no auto fix available, offending cases have to be addressed manually.

Hmm, that's unfortunate. It becomes a game of cat and mouse. If the tool doesn't do that on its own, then the value of having this check is greatly reduced.

@adam-smnk
Copy link
Copy Markdown
Member Author

As the line length applies to raw string blocks, like comments, docs etc., it's reasonable that the final layout is driven by human intention. If needed rule can be selectively disabled. Otherwise, offending text has to be reformatted such that it retains its original semantics (like ASCII art/graph for an extreme example).
That's why I think there's no auto fix for this particular rule.

Ultimately, the final linter pass enforces better readability for these raw strings.
Code formatting is unchanged and its fixes remain automatic.

Copy link
Copy Markdown
Contributor

@tkarna tkarna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Long comments seem to be a recurring issue so enforcing a limit sounds like a good idea even if it has to be addressed manually.

Nit: the diff shows some code changes as well so the code line limit is also different now?

@adam-smnk
Copy link
Copy Markdown
Member Author

Nit: the diff shows some code changes as well so the code line limit is also different now?

There are two types:

  • changes to strings within code - they were broken up manually to respect max length limit
  • lambda formatting - I think some new formatting rule got triggered after bumping ruff version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants