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

Quick introduction to scalafix

Quick introduction to scalafix

Scala fukuoka 2019 LT

Rikito Taniguchi

January 19, 2019

Transcript

17 slides
  1. About me - 谷口 力斗 / @tanishiking - 株式会社はてな -

    Scala / TypeScript / Go / Perl - 高校生までは福岡に住んでました
  2. Scalafix - https://scalacenter.github.io/scalafix/ - Refactoring and linting tool for Scala

    - scala.meta - Builtin Rules / Suppressing Rules - Linter - 独自ルールを作ろう
  3. Scala.meta - Semantic API - 型情報やシンボルの情報を提供するAPI - compiler plugin を使って

    typer phase の後に SemanticDB を生成 - SemanticDB - protobuf で定められたスキーマに従ってシリ アライズされたバイナリ
  4. Suppressing Rules @SuppressWarnings(Array("all")) def foo = ??? List("", null) //

    scalafix: ok // scalafix: off foo(null) // scalafix: on
  5. Linter - v0.5 から linter としての機能が豊富に - 将来的に metals (scala.meta

    ベースの Language Server 実装) から scalafix を使った refactoring や lint の提供も
  6. Lint (vs wartremover) - (+) Lintに加えて自動修正もできる - (+) syntactic rulesの実行にコンパイルは不要

    なので高速 - (+) 独自ルールの実装が容易(wart実装も難しくないけど) - (-) Builtin rule が少ない - (-) scala compiler と比べて SemanticDB から取 得できる情報は制限される

More Decks by Rikito Taniguchi

Other Decks in Technology