-
Notifications
You must be signed in to change notification settings - Fork 506
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
Prevent multiple statements on the same line #1078
Comments
I am not aware of any language constructs in Kotlin that use |
Hi, @paul-dingemans Should we disallow the semicolon itself? Even code like the below is possible in Kotlin. Which are not reported by
|
Semi colons can not be removed unconditionally. Ktlint already has a NoSemicolonsRule which removes redundant semi colons. That rule contains references to two interesting exceptions in which the semi colon is actually relevant:
I think it would be best that the statement wrapping rule is just wrapping (e.g. inserting a new line after the semi colon) and not removing the semi colon. And the NoSemicolonRule will then take care of removal of semi colons like it currently does. For this it has to be enforce that the NoSemicolon runs after the statement wrapping rule. This can be done by adding a |
Duplicates
I could not find a matching issue, but I find it hard to believe that it doesn't exist yet. Apologies if this is indeed a duplicate.
Expected Rule behavior
Do not allow multiple statements on the same line. ktlint does not complain with the following:
Here,
a
andb
should be declared separately.Additional information
The text was updated successfully, but these errors were encountered: