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

Spaces on both sides of the double slash (//) that begins an end-of-line comment #198

Closed
egor-n opened this issue Apr 25, 2018 · 2 comments

Comments

@egor-n
Copy link

egor-n commented Apr 25, 2018

The JetBrains Kotlin Coding Conventions suggest placing a space after //:

image

The Android Kotlin Style guide suggests placing a space before and after the double slash (//) if it begins an end-of-line comment:

image


Ktlint should flag lack of spaces around //.

Correct:

// comment
var debugging = false // comment
var debugging = false // comment//word

Incorrect:

//comment
var debugging = false// comment
var debugging = false //comment
var debugging = false//comment
@vanniktech
Copy link
Contributor

It should not only flag it but also autocorrect it.

JelloRanger added a commit to JelloRanger/ktlint that referenced this issue May 1, 2018
- Should add spaces before end of line comments if they are not at the beginning of a line, and add spaces after the double slash (//) if not present
shyiko added a commit that referenced this issue May 1, 2018
…ing-rule

Add CommentSpacingRule for end of line comment padding (#198)
@shyiko
Copy link
Collaborator

shyiko commented May 1, 2018

Added in 4385ea5 (thanks once again, @JelloRanger!)

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

No branches or pull requests

3 participants