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

Max line length rule is enforced but auto-formatting isn't supported? #96

Closed
aaronweihe opened this issue Oct 25, 2017 · 5 comments
Closed

Comments

@aaronweihe
Copy link
Contributor

It's cool ktlint can honor max_line_length in the .editorconfig file, but the auto-formatting doesn't seem to be supported?

For example, if I have this Person.kt file:

class Person(id: Int, firstName: String, lastName: String, middleName: String?, age: Int, email: String?, phoneNumber: String?, twitterHandle: String?)

Then when I do ktlint -F Person.kt, it would just complain Exceeded max line length (120) without formatting it.

@shyiko
Copy link
Collaborator

shyiko commented Oct 26, 2017

Hi @aaronhe42. You're right, right now ktlint -F won't split the line when max_line_length is exceeded. This is somewhat related to #76 (comment).

@JLLeitschuh
Copy link
Contributor

Is max_line_lengthdocumented as supported somewhere in the documentation??

@shyiko
Copy link
Collaborator

shyiko commented Nov 21, 2017

@ntsim
Copy link
Contributor

ntsim commented Apr 29, 2018

@shyiko do you have have plans to support this formatting? I gave the code a little look and it seems like most of the work is already done for this in the parameter-list-wrapping rule. If there isn't some other reason for holding back, I could push up a PR for this?

@shyiko
Copy link
Collaborator

shyiko commented Apr 30, 2018

Hi @ntsim. No reasons other than not enough time :) If you send a PR I'd gladly merge it in.

ntsim added a commit to ntsim/ktlint that referenced this issue Apr 30, 2018
…eded

This change applies additional formatting rules when `max_line_length`
is exceeded by a function or class declaration due to a long parameter
list. It will also apply the formatting for nested declarations.

Related issues: pinterest#96
ntsim added a commit to ntsim/ktlint that referenced this issue Apr 30, 2018
This change applies `parameter-list-wrapping` and its associated
formatting when `max_line_length` is exceeded by a function or class
declaration due to its parameter list being too long. It will also apply
for nested function declarations.

Related issues: pinterest#96
ntsim added a commit to ntsim/ktlint that referenced this issue Apr 30, 2018
Resolves pinterest#96

This commit applies `parameter-list-wrapping` and its associated
linting/formatting when `max_line_length` is exceeded by a function or
class declaration due to its parameter list being too long. It will also
apply for nested function declarations.
ntsim added a commit to ntsim/ktlint that referenced this issue Apr 30, 2018
Resolves pinterest#96

This commit applies `parameter-list-wrapping` and its associated
linting/formatting when `max_line_length` is exceeded by a function or
class declaration due to its parameter list being too long. It will also
apply for nested function declarations.
ntsim added a commit to ntsim/ktlint that referenced this issue Apr 30, 2018
Resolves pinterest#96

This commit applies `parameter-list-wrapping` and its associated
linting/formatting when `max_line_length` is exceeded by a function or
class declaration due to its parameter list being too long. It will also
apply for nested function declarations.
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

4 participants