Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Conflict between requiring space after “,” and no space before “)” #975

Closed
mathjeff opened this issue Nov 20, 2020 · 1 comment · Fixed by #982
Closed

Conflict between requiring space after “,” and no space before “)” #975

mathjeff opened this issue Nov 20, 2020 · 1 comment · Fixed by #982
Labels
Milestone

Comments

@mathjeff
Copy link

mathjeff commented Nov 20, 2020

Expected Behavior

If ktlint makes a suggestion regarding whitespace between "," and ")" which the developer then applies, ktlint should accept the suggestion that it made

If it is disallowed to have a trailing “,” before “)”, could the check say that instead?

Observed Behavior

We have some code that looks like this:

  // Ignore lint warnings in documentation snippets
  @file:Suppress("unused", "UNUSED_PARAMETER", "UNUSED_VARIABLE",)

When we run ./gradlew ktlint, it says:

  > Task :compose:integration-tests:docs-snippets:ktlint FAILED
  frameworks/support/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt:19:64: Missing spacing after ","

When we add a space to make the code look like this:

  // Ignore lint warnings in documentation snippets
  @file:Suppress("unused", "UNUSED_PARAMETER", "UNUSED_VARIABLE", )

We get this error:

  > Task :compose:integration-tests:docs-snippets:ktlint
  frameworks/support/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt:19:64: Unexpected spacing before ")"

Steps to Reproduce

The source file: https://android.googlesource.com/platform/frameworks/support/+/e096810f5ad8e55dd5daf6477beaeef233549d55/compose/integration-tests/docs-snippets/src/main/java/androidx/compose/integration/docs/interoperability/Interoperability.kt
The repository: https://android.googlesource.com/platform/frameworks/support/+/e096810f5ad8e55dd5daf6477beaeef233549d55/README.md

Your Environment

Workaround

It seems to work to simply delete the trailing ","

Thanks!

@mathjeff
Copy link
Author

Thanks!

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

Successfully merging a pull request may close this issue.

2 participants