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

Space after property accessor #56

Merged
merged 3 commits into from
Jun 7, 2017

Conversation

arturbosch
Copy link
Contributor

And no space if property accessor has no block body. See https://kotlinlang.org/docs/reference/properties.html

var setterVisibility: String = "abc"
    private set

node.nextLeaf()?.delete()
}
}
} else if (noLFBeforeSet.contains(node.elementType)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arturbosch I think we have a regression here. Previously this block would be executed regardless of the preceding if clause (there was no else) (i.e. there could be 2 LintError's emitted for the same node: Unexpected newline before "else" & Missing spacing after "else".) but no anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes your right, my fault - the else keyword is in both sets.

@shyiko
Copy link
Collaborator

shyiko commented Jun 7, 2017

Thank you the PR, Artur! This PR makes sure there is no extra space between set/get and the following "(", right? PR description implies extra space after "private set" but I don't think it's inserted.

@arturbosch
Copy link
Contributor Author

Argh yes, did not check my spelling.

There should be no space after a property accessor. But if the property accessor has no block statement, then it means, the users indention was to change the visibility of the getter/setter which needs no check for spacing. KtLint expected a space which was a false positiv. :)

@shyiko shyiko merged commit 650b762 into pinterest:master Jun 7, 2017
@shyiko
Copy link
Collaborator

shyiko commented Jun 7, 2017

Thank you 🙇‍♂️

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.

2 participants