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

ktlint vs AS autoformat-rearrange #86

Closed
WhiteHatArpit opened this issue Sep 30, 2017 · 3 comments
Closed

ktlint vs AS autoformat-rearrange #86

WhiteHatArpit opened this issue Sep 30, 2017 · 3 comments

Comments

@WhiteHatArpit
Copy link

There happens to be many things which the Android Studio's Reformat do but Ktlint seems helpless. What are the plans for this? Is there some way we can make them same? I would be happy to help too if you are short of bandwidth. Just point in the right direction!

@shyiko
Copy link
Collaborator

shyiko commented Sep 30, 2017

Hi @WhiteHatArpit.
Can you provide a little bit more detail on what (which rules) you think should be included in ktlint?

I have couple of rules (#23, #14 and a few more) in the works and quite a few in my personal backlog. If you are willing to help (most appreciated) you could start with relatively-easy to implement:

  • Reduntant setter parameter type

This inspection reports explicitly given parameter types in property setters. Setter parameter type always matches property type, so it's not needed to be explicit.

To get started, I'd recommend to look at ktlint-ruleset-template (NoVarRuleTest.kt) first and then ktlint-ruleset-standard.

@WhiteHatArpit
Copy link
Author

WhiteHatArpit commented Sep 30, 2017

To start with, first there are some styles about where should a bracket come while defining a class

class abc {
}
class abc
{
}

Then there are some unsaid rules related to ' ' space. If I put in these spaces at random spots in my code, I see different output using Ktlint and AS.
I suppose there are more complex rules but anti-bikeshedding thats what it is about.

Also, I would like to add some rules exclusive to my project but I am not sure how to go about them at the moment.

Sure I would take a look at those files and try to understand how it all works.

@shyiko
Copy link
Collaborator

shyiko commented Oct 8, 2017

@WhiteHatArpit Thank you. #88 created to address { positioning. With regards to your personal rules - see https://github.com/shyiko/ktlint#can-i-have-my-own-rules-on-top-of-ktlint.

@shyiko shyiko closed this as completed Oct 8, 2017
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

2 participants