oppia / oppia-android

A free, online & offline learning platform to make quality education accessible for all.
https://www.oppia.org
Apache License 2.0
323 stars 523 forks source link

Integrate with ktfmt #2799

Open BenHenning opened 3 years ago

BenHenning commented 3 years ago

https://github.com/facebookincubator/ktfmt is an opinionated pretty-print auto-formatter for Kotlin. It's currently got some known issues (especially with regards to generating code that violates ktlint checks), but once these are in a better place we should include instructions for integrating ktfmt during onboarding. In fact, we may actually want to introduce a second Kotlin lint check which specifically verifies that all Kotlin code exactly matches what ktfmt would output. The main benefits of using an opinionated formatter:

  1. It eliminates the need to make a decision when trying to address a ktlint issue (since it resolves ambiguous cases where multiple solutions technically match the style guide & satisfy ktlint, but look quite different)
  2. It ensures absolute consistency for spacing & formatting elements, completely eliminating the need to bring this up during code reviews & making reading existing code much easier

To work on this issue:

  1. Review the official docs.
  2. Make note of any know issues and discuss with the project maintainers to determine which ones are blockers for us.
  3. Add the dependency to both Bazel and Gradle.
  4. Add necessary configurations.
  5. Select a set of files and do a Ktlint vs ktfm check and analyse the differences.
BenHenning commented 3 years ago

/cc @anandwana001

anandwana001 commented 3 years ago

@BenHenning Can we make this issue available as a mini project for non-gsoc contributors?

Sparsh1212 commented 3 years ago

If this is available, then I would love to work on this. Also, please guide me on how to get started.