$30 off During Our Annual Pro Sale. View Details »

Danger for Android

Danger for Android

Introduction to Danger for Android

Daichi Furiya (Wasabeef)

October 25, 2017
Tweet

More Decks by Daichi Furiya (Wasabeef)

Other Decks in Programming

Transcript

  1. Danger × Android wasabeef Potatotips #44

  2. About me 降矢 大地 (Daichi Furiya) Google Developer Expert @wasabeef_jp

    wasabeef
  3. None
  4. コードレビューの自動化をCI上で行う Android Lint, Swift Lint, ESLint, 
 HLint, CheckStyle Format.......

    Danger
  5. General

  6. Kotlin lint (Ktlint)

  7. Android Lint

  8. Android Lint

  9. Plugins

  10. Plugins

  11. How to Set Up

  12. Gemfile / Dangerfile の用意 bundle install Bundle exec danger Danger

  13. Gemfile

  14. Gemfile gem "danger" gem "danger-android_lint" gem "danger-findbugs" gem "danger-checkstyle_format"

  15. Dangerfile

  16. Dangerfile for PR # WIP warn("Work in Progress") if github.pr_title.include?

    “WIP" # BIG PR warn("Big PR > 1000") if git.lines_of_code > 1000 # NO ASSIGN has_assignee = github.pr_json[assignee] != nil warn("No Assign", sticky: false) unless has_assignee
  17. Dangerfile for Android Lint # Android Lint android_lint.gradle_task = "app:lint"

    android_lint.report_file = “path/lint-results.xml” android_lint.filtering = true android_lint.lint(inline_mode: true)
  18. Dangerfile for ktlint # checkstyle for ktlint github.dismiss_out_of_range_messages checkstyle_format.base_path =

    Dir.pwd checkstyle_format.report “path/ktlint-report.xml”
  19. Gradle for configurations { ktlint } dependencies { ktlint 'com.github.shyiko:ktlint:0.10.0'

    } task ktlint(type: Exec) { commandLine 'java', '-cp', configurations.ktlint.join(System.getProperty('path.separator')), 'com.github.shyiko.ktlint.Main', '--reporter=checkstyle', 'src/**/*.kt' def outputDirectory = "$buildDir/reports" def outputFile = "${outputDirectory}/ktlint-report.xml" ignoreExitValue = true doFirst { new File(outputDirectory).mkdirs() standardOutput = new FileOutputStream(outputFile) } } https://ktlint.github.io/
  20. Execution

  21. Execution // Single bundle exec danger // Multiple bundle exec

    danger --dangerfile="app/Dangerfile" --danger_id=1 bundle exec danger --dangerfile="tv/Dangerfile" --danger_id=2
  22. Conclusion

  23. Thank you. twitter.com/wasabeef_jp wasabeef.jp github.com/wasabeef