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

"keyword-spacing" error in JavaDoc comment #671

Closed
jlamson opened this issue Dec 17, 2019 · 3 comments · Fixed by #675
Closed

"keyword-spacing" error in JavaDoc comment #671

jlamson opened this issue Dec 17, 2019 · 3 comments · Fixed by #675
Labels

Comments

@jlamson
Copy link

jlamson commented Dec 17, 2019

Version of the project you're using:

0.36.0

Code (or even better whole projects) which reproduce the issue.

1|  package pckg.name.testcommon
2|  
3|  import org.mockito.Mockito
4|  import org.mockito.stubbing.OngoingStubbing
5|  
6|  /**
7|   * Convenience wrapper around [Mockito.when] to avoid special `when` notation.
8|   */
9|  fun <T> whenever(call: T): OngoingStubbing<T> = Mockito.`when`(call)

Any logs produced.

The above returns the following error:

{pathTo}/MockitoExt.kt:7:44: Missing spacing after "when"

Steps which reproduce the issue.

  1. Add the above snippet in a project with ktlint set up
  2. Run ktlint
  3. Observe failure for the line despite the fact that the word in this instance is not used as a keyword.

Stack traces for crashes.

n/a

Changelog

12/18/19: Updated Code snippet to include package, imports, and line numbers to make clear which line contained the error.

@Tapchicoma Tapchicoma added the bug label Dec 18, 2019
@Tapchicoma
Copy link
Collaborator

Tapchicoma commented Dec 18, 2019

I think issue not in kdoc, but in this part:

Mockito.`when`(call)

as ktlint assumes it is when language keyword. Most probably other wrapped language keywords may be affected.

@jlamson
Copy link
Author

jlamson commented Dec 18, 2019

Hey there. Just double checked, and it's definitely in the comment. Below is the file (excluding some more extensions below the pasted code) that returned the error. Line 7 is the kdoc line, and character 44 is the ] after Mockito.when

1|  package pckg.name.testcommon
2|  
3|  import org.mockito.Mockito
4|  import org.mockito.stubbing.OngoingStubbing
5|  
6|  /**
7|   * Convenience wrapper around [Mockito.when] to avoid special `when` notation.
8|   */
9|  fun <T> whenever(call: T): OngoingStubbing<T> = Mockito.`when`(call)

@jlamson
Copy link
Author

jlamson commented Dec 18, 2019

Updated the description to be more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants