Layout/LineLength needs nuance
Author: forthrinCreated Jul 15, 2026Updated Sep 18, 2026
Labelsfeature request
Before submitting
- I have searched the existing issues and this hasn't been requested yet.
Cop name
Layout/LineLength
Is your feature request related to a problem?
Layout/LineLength is one of the cops that have the most different causes, to name some:
- SQL statements
- CLI commands
- URLs
- Object tree access
- RegExp (list of keywords)
- Rescue (network) classes
- Call chains
By contrast, the manual is disproportionately helpful in exemplifying and remedying the causes:
https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Layout/LineLength
Describe the solution you'd like
Initial thought is to split the cop into different cops (now there is something T-1000 didn't think of...), addressing the usual suspects with specific individual recommendations.
Code examples
# Some brief illustrative cop message examples (for now):
- "Write SQL statement as HEREDOC"
- "Piece together the CLI statement as an array"
- "Scan for words and intersect with array"Describe alternatives you've considered
Putting long statements in YAML file it not always viable as it might cause a lot of buffer switching.
Additional context
No response
Source: rubocop/rubocop