Skip to content
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 tokens between backticks in rule max line length (#1007) #1008

Merged

Conversation

paul-dingemans
Copy link
Collaborator

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.

Currently I just ignore all ASTNodes starting and ending with a back tick. Such a node no longer counts in the calculation of the length of the line. This is not explicitly limited to method names neither to unit test only. However I do think this approach is valid. Tokens can only contain back ticked values whenever this is allowed by Kotlin. Such tokens can never be split in multiple lines.

Paul Dingemans added 2 commits December 12, 2020 21:06
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.
@paul-dingemans
Copy link
Collaborator Author

The identifiers between back ticks can now optionally be ignored. By default this option is disabled so the behaviour is not changed for existing users.

@paul-dingemans
Copy link
Collaborator Author

@Tapchicoma Sorry that I reach out to you in this way but I have found no other way to do so. I am wondering what else I can do to get my PR's merged. I am aware that you are volunteer on this project. I am willingly to give a long term commitment on the project if you would appreciate that. But for that I need to know how my contributions will be merged more smoothly.

@Tapchicoma
Copy link
Collaborator

@paul-dingemans sorry for missing your last comment in this PR.

As far as I know @romtsn want to review your PRs.

Regarding #1038 PR, that I've started to review, could you split it into two:

romtsn and others added 25 commits March 7, 2021 21:41
Previously, when ktlint failed to find '.editorconfig', file path was not
passed to the rules. This lead for wrong "filename" rule behaviour.
To clarify how the IntelliJ IDEA code style setting configuration process works, add an brief explanation about what each command does and clarify that the code samples are command line calls, not config file entries
* Deprecate shorcuts for import-ordering

* Update CHANGELOG.md
…emoved (pinterest#1026)

* Fix string-template for dot-expression of which the redundant toString is removed (pinterest#996)

The no-unused-imports rule fails on the existence of the dot-expression node but for which the actual call to the toString method was removed.

* Update changelog

* Fix code style violation

Co-authored-by: Paul Dingemans <pdingemans@bol.com>
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
…g indentation style (pinterest#425) (pinterest#1031)

Co-authored-by: Paul Dingemans <pdingemans@bol.com>
* Add CI & Mega-Linter link in README

* Add CI link to head menu
…efore-assignment`) (pinterest#1041)

* Don't remove the equals sign for a default argument (`no-line-break-before-assignment`)

* Remove unnecessary test

* Remove unused import

Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
t-kameyama and others added 23 commits March 7, 2021 21:41
Changelog: https://docs.gradle.org/6.8.1/release-notes.html

Has to slightly increase Gradle maximum allowed memory usage to prevent heap out of space sporadic errors.
Initialization error happens only when using from KtLint CLI with Kotlin versions 1.4.20+. Via `java jar ktlint-cli.jar` approach Kotlin compiler initializes without failures.

For now added workaround, but, in the future, CLI approach should revisited.
Enable new JVM IR backend.
* Fixing bug with experiment:annotation-spacing-rule with comments

* updating changelog

* deleting unused function

* fix imports

* fix build
Migrate method to get all mathing globs files to use internally
'PathMatcher' and 'FileVisitor' instead of using klob dependency.

Fix negated globs passed to CLI are no longer worked.
Kotlin dev is set to 1.5.0-M1.
Kotlin pre-releases are now available on Maven Central.
@romtsn
Copy link
Collaborator

romtsn commented Mar 7, 2021

hi @paul-dingemans, sorry for the long-awaited review, I've just changed 3 things:

I will take your frustration on me, as I planned to do the aforementioned changes way earlier, but then life happened. Your PRs are of course appreciated, just one wish would be to make your PRs smaller and target one specific issue/thing (I'm referring to your other PRs, this one looks good). thanks for the contribution!

@romtsn romtsn merged commit 4306d76 into pinterest:master Mar 7, 2021
romtsn pushed a commit to paul-dingemans/ktlint that referenced this pull request 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.
@paul-dingemans paul-dingemans deleted the 1007-ignore-tokens-between-back-ticks branch October 30, 2021 10:10
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.

None yet

8 participants