-
Notifications
You must be signed in to change notification settings - Fork 503
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
Ignore back ticked function names in max_line_length rule #1007
Labels
Comments
paul-dingemans
pushed a commit
to paul-dingemans/ktlint
that referenced
this issue
Dec 12, 2020
Tokens starting and ending with a backtick should be ignored entirely when validating whether a line exceeds the maximum length of a line. Such tokens can not be spit into multiple lines. For example when writing JUnit test it is a common pattern to write the function names between back ticks instead of using the DisplayName annotation.
I am not sure that ktlint should allow such behaviour by default. In the the end max line constraint exists to ensure that code is readable on width constraint text areas. Probably could be optionally enabled via |
That is a fair point. I will make it optional. |
paul-dingemans
pushed a commit
to paul-dingemans/ktlint
that referenced
this issue
Dec 19, 2020
romtsn
pushed a commit
that referenced
this issue
Mar 7, 2021
* Ignore tokens between backticks in rule max line length (#1007) Tokens starting and ending with a backtick should be ignored entirely when validating whether a line exceeds the maximum length of a line. Such tokens can not be spit into multiple lines. For example when writing JUnit test it is a common pattern to write the function names between back ticks instead of using the DisplayName annotation.
Closed by #1008 |
This was referenced Mar 16, 2021
romtsn
pushed a commit
to paul-dingemans/ktlint
that referenced
this issue
Aug 8, 2021
…) (pinterest#1008) * Ignore tokens between backticks in rule max line length (pinterest#1007) Tokens starting and ending with a backtick should be ignored entirely when validating whether a line exceeds the maximum length of a line. Such tokens can not be spit into multiple lines. For example when writing JUnit test it is a common pattern to write the function names between back ticks instead of using the DisplayName annotation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When writing unit tests, it is a common pattern enclose the function name enclosed between back-ticks. Those function names can however not be split into multiple lines. Therefore such function names should be excludes from the max_line_length rule.
Originally posted by @k1dbl4ck in #659 (comment)
Would like to add that back ticked function names in tests should also be handled / ignored:
The text was updated successfully, but these errors were encountered: