What I Talk About When I Talk About Ktlint

What I Talk About When I Talk About Ktlint

A967476c5855d593710a9a580f6b2aed?s=128

Yuichi Maekawa

March 20, 2018
Tweet

Transcript

  1. 2.

    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. 3.

    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. 4.

    We have many solutions • Inspect by Android Studio •

    Static code analytics • Automate with Danger etc...
  4. 9.

    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. 10.

    Redundant commits... • fix danger comment • fix danger •

    fix code format • format code • format • :put_litter_in_its_place: ...
  6. 11.

    Write code Push CI Analytics + Danger Fix format Push

    Review Fix Push More and more automation
  7. 12.

    Write code build & format push CI Analytics + Danger

    Review Fix Push More and more automation
  8. 13.

    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. 14.

    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. 15.

    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. 16.

    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. 17.

    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. 19.

    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