Skip to content

Switch from ktlint -> ktfmt #116

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

Open
eyalgu opened this issue Feb 19, 2020 · 10 comments · May be fixed by #700
Open

Switch from ktlint -> ktfmt #116

eyalgu opened this issue Feb 19, 2020 · 10 comments · May be fixed by #700
Assignees
Labels
discussion we are discussing what to do, usually based on some feature request or comment

Comments

@eyalgu
Copy link
Contributor

eyalgu commented Feb 19, 2020

It seems like ktlint keeps triping me up because it doesn't support running as part of the workflow (I make a small change, forget to fix some spacing then get a failure). I'd like to try out https://github.com/facebookincubator/ktfmt.
I know the maintainers and would love to give it a try

@eyalgu eyalgu added the discussion we are discussing what to do, usually based on some feature request or comment label Feb 19, 2020
@eyalgu eyalgu self-assigned this Feb 19, 2020
@ychescale9
Copy link
Contributor

Hmm looks like there's no published artifact yet and it requires maven 🙃?

@eyalgu
Copy link
Contributor Author

eyalgu commented Feb 20, 2020 via email

@tasomaniac
Copy link
Contributor

ktfmt is not a full replacement, right? ktlint is a formatter but also a linter.

@cgrushko
Copy link

@ychescale9 @eyalgu we started publishing artifacts to Maven Central: https://search.maven.org/artifact/com.facebook/ktfmt/0.12/jar

@tasomaniac correct; ktfmt is a code formatter. It's analogous to google-java-format in the Java world.

@cgrushko
Copy link

cgrushko commented May 4, 2020

diffplug/spotless#569 is bringing ktfmt to Spotless. I see Store already uses Spotless, so it should be easy to try out ktfmt.

@biratdatta
Copy link

Yeah it is a good issue, require a discussion for it.

@itsandreramon
Copy link

i can provide a PR for that if wanted

@matt-ramotar
Copy link
Collaborator

@itsandreramon We haven’t experienced major friction with ktlint lately, so this hasn’t been a priority. However, I'm open to a PR that explores switching to ktfmt. The PR would need to:

  • Minimize blame breakage (not sure how big of a concern this is in practice)
  • Integrate with Spotless
  • Integrate with Detekt to maintain existing lint rules
  • Update our build/CI workflow
  • Update the CONTRIBUTING guide accordingly

Happy to discuss if you'd like to take it on

@itsandreramon
Copy link

itsandreramon commented Feb 25, 2025

@matt-ramotar do you want to have the googleStyle() of ktfmt or should we keep current indentation? Google's style is 2 space indentation.

@matt-ramotar
Copy link
Collaborator

@itsandreramon I think I'm fine with using google-java-format

@itsandreramon itsandreramon linked a pull request Feb 26, 2025 that will close this issue
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion we are discussing what to do, usually based on some feature request or comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants