-
Notifications
You must be signed in to change notification settings - Fork 506
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
Configuration to ignore max-line-length for strings #2453
Comments
Raw string literals ("""...""") are already excluded from max line length violations as they are typically used in multiline contexts like:
Strings on the other hand are often used in combination with other elements on the same line. It then becomes unclear what to do if that line exceeds the maximum. Should it be accepted because the line contains a string anywhere, or only when it is the last element on the line? And what if it is the last element, but followed by an EOL comment. But it might be reasonable to allow lines that only contain on single string literal to exceed the max line length. This is something that can be considered for the next minor release as this is not a regression bug. |
Last element on the line is the most important for now (i.e. my logging example). A bit trickier would be: log.info {
"Long line of logging with a variable ${foo.bar} you might want to keep in one line"
} I would want to still keep that in one line. Let me think a little deeper about other cases. |
From the parser perspective this log statement still contains a single string. Following would however not be accepted:
|
Add a configuration to allow for long strings exceeding
max-line-length
.Splitting long lines of strings over multiple lines can obstruct readability of code.
Optional: differentiation between single (
"
) and multiline ("""
) strings.Expected Behavior
Rule should ignore the long string if it's the only code in line or if the line could not be broken down otherwise.
Current Behavior
Additional information
The text was updated successfully, but these errors were encountered: