Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What I Talk About When I Talk About Ktlint

What I Talk About When I Talk About Ktlint

Yuichi Maekawa

March 20, 2018
Tweet

More Decks by Yuichi Maekawa

Other Decks in Programming

Transcript

  1. Problems in a large team • Spawn untold coding rule

    • Reviewer spend fluitless time for similer mistake • Yesterday’s nice doc could be today’s trash
  2. Difficulty of Kotlin • Many different ways of writing •

    So we make many team rules • These all rules can’t taught through word of mouth
  3. We have many solutions • Inspect by Android Studio •

    Static code analytics • Automate with Danger etc...
  4. Not good enough Write code Push CI Analytics + Danger

    Fix format Push Review Fix Push we S I L ne fi d o r d .
  5. Redundant commits... • fix danger comment • fix danger •

    fix code format • format code • format • :put_litter_in_its_place: ...
  6. Write code Push CI Analytics + Danger Fix format Push

    Review Fix Push More and more automation
  7. Write code build & format push CI Analytics + Danger

    Review Fix Push More and more automation
  8. Write code build & format push CI Analytics + Danger

    Review Fix Push More and more automation No m ed n ev . No m or c it. No m or c e r a d!
  9. Add ktformat task to build.gradle task ktFormat { description "R.I.P

    danger..." classpath = configrations.ktlint Main = "com.github.shyiko.ktlint.Main" args "-F", "src/**/*.kt" }
  10. Add ktformat task to build.gradle task ktFormat { description "R.I.P

    danger..." classpath = configrations.ktlint Main = "com.github.shyiko.ktlint.Main" args "-F", "src/**/*.kt" } For p i
  11. Add ktformat task to build.gradle task ktFormat { description "R.I.P

    danger..." classpath = configrations.ktlint Main = "com.github.shyiko.ktlint.Main" args "-F", "src/**/*.kt" } Yo c ha t et s
  12. Only format @ local debug build time e.g. applicationVariants.all {

    variant -> def flavor = variant.productFlavors[0].name def buildType = variant.buildType.name if (flavor == 'develop' && buildType == 'debug') { ktFormat.execute() } }
  13. What I talk about • Use ktlint for your team

    • Do not review about code fomat • And I want to remove “Format commit” • Use ktFormat for reviewer and you • Format at local debug build time • Focus your coding