Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Quick introduction to scalafix
Search
Rikito Taniguchi
January 19, 2019
Technology
260
1
Share
Quick introduction to scalafix
Scala fukuoka 2019 LT
Rikito Taniguchi
January 19, 2019
More Decks by Rikito Taniguchi
See All by Rikito Taniguchi
GC言語のWasm化とComponent Modelサポートの実践と課題 - Scalaの場合
tanishiking
0
150
Capture Checking / Separation Checking 入門
tanishiking
0
530
Implementing and Evaluating a High-Level Language with WasmGC and the Wasm Component Model: Scala’s Case
tanishiking
0
700
Scala meets WebAssembly
tanishiking
0
940
Why Wasm+WASI for Scala
tanishiking
0
140
Scala to WebAssembly: Exploring the How and Why
tanishiking
1
1.9k
Scala to WebAssembly #scala_waiwai
tanishiking
0
1.9k
Scala Days Madrid 2023 参加レポート
tanishiking
0
100
Tooling for Scala3
tanishiking
0
440
Other Decks in Technology
See All in Technology
20260428_Product Management Summit_tadokoroyoshiro
tadokoro_yoshiro
14
14k
巨大プラットフォームを進化させる「第3のROI」
recruitengineers
PRO
2
1.2k
AgentCore Managed Harness を使ってみよう
yakumo
2
220
ぼくがかんがえたさいきょうのあうとぷっと
yama3133
0
200
国内外の生成AIセキュリティの最新動向 & AIガードレール製品「chakoshi」のご紹介 / Latest Trends in Generative AI Security (Domestic & International) & Introduction to AI Guardrail Product "chakoshi"
nttcom
4
1.4k
レビューしきれない?それは「全て人力でのレビュー」だからではないでしょうか
amixedcolor
0
350
Anthropic「Long-running a gents」をGeminiで再現してみた
tkikuchi
0
170
クラウドネイティブな開発 ~ 認知負荷に立ち向かうためのコンテナ活用
literalice
0
150
AWS Transform CustomでIaCコードを自由自在に変換しよう
duelist2020jp
0
130
M5Stack CoreS3とZephyr(RTOS)で Edge AIっぽいことしてみた
iotengineer22
0
290
独断と偏見で試してみる、 シングル or マルチエージェント どっちがいいの?
shichijoyuhi
1
120
Rapid Start: Faster Internet Connections, with Ruby's Help
kazuho
2
770
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
280
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
200
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
170
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
220
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Raft: Consensus for Rubyists
vanstee
141
7.4k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
GraphQLとの向き合い方2022年版
quramy
50
15k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
320
Transcript
Quick introduction to scalafix Scala福岡 2019
About me - 谷口 力斗 / @tanishiking - 株式会社はてな -
Scala / TypeScript / Go / Perl - 高校生までは福岡に住んでました
Scalafix - https://scalacenter.github.io/scalafix/ - Refactoring and linting tool for Scala
- scala.meta - Builtin Rules / Suppressing Rules - Linter - 独自ルールを作ろう
Scala.meta
Scala.meta - https://scalameta.org/ - Scala compiler とは独立した Scala プログラム 解析のためのライブラリ
- Syntactic API - Semantic API
Scala.meta - Syntactic API - Scalaプログラムをパースしトークン列や構文木 を返すAPI println("function(argument)".parse[Stat].get.struct ure) //
Term.Apply(Term.Name("function"), List(Term.Name("argument")))
Scala.meta - Semantic API - 型情報やシンボルの情報を提供するAPI - compiler plugin を使って
typer phase の後に SemanticDB を生成 - SemanticDB - protobuf で定められたスキーマに従ってシリ アライズされたバイナリ
Builtin Rules / Supressing Rules
Builtin Rules - https://scalacenter.github.io/scalafix/docs/rul es/overview.html // .scalafix.conf rules = [
DisableSyntax, RemoveUnused ]
Suppressing Rules @SuppressWarnings(Array("all")) def foo = ??? List("", null) //
scalafix: ok // scalafix: off foo(null) // scalafix: on
Linter
Linter - v0.5 から linter としての機能が豊富に - 将来的に metals (scala.meta
ベースの Language Server 実装) から scalafix を使った refactoring や lint の提供も
Lint (vs wartremover) - (+) Lintに加えて自動修正もできる - (+) syntactic rulesの実行にコンパイルは不要
なので高速 - (+) 独自ルールの実装が容易(wart実装も難しくないけど) - (-) Builtin rule が少ない - (-) scala compiler と比べて SemanticDB から取 得できる情報は制限される
独自ルールを 作ろう
独自ルールを作ろう https://scalacenter.git hub.io/scalafix/docs/d evelopers/setup.html
独自ルールを作ろう - 作ってみた https://github.com/tanishiking/scalafix-check-scaladoc - publicなAPIにscaladocが書かれてなかったら 怒ってくれるルール - golintとかにあるやつ
まとめ - scalafix は refactoring ツールとしてだけでなく linter としても使える - scala.metaのAPIを使って簡単に独自ルールが
作れる