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
1
230
Quick introduction to scalafix
Scala fukuoka 2019 LT
Rikito Taniguchi
January 19, 2019
Tweet
Share
More Decks by Rikito Taniguchi
See All by Rikito Taniguchi
Capture Checking / Separation Checking 入門
tanishiking
0
88
Implementing and Evaluating a High-Level Language with WasmGC and the Wasm Component Model: Scala’s Case
tanishiking
0
270
Scala meets WebAssembly
tanishiking
0
760
Why Wasm+WASI for Scala
tanishiking
0
120
Scala to WebAssembly: Exploring the How and Why
tanishiking
1
1.8k
Scala to WebAssembly #scala_waiwai
tanishiking
0
1.7k
Scala Days Madrid 2023 参加レポート
tanishiking
0
90
Tooling for Scala3
tanishiking
0
420
API-Based Code Search
tanishiking
0
71
Other Decks in Technology
See All in Technology
AI エージェントを評価するための温故知新と Spec Driven Evaluation
icoxfog417
PRO
2
940
AS59105におけるFreeBSD EtherIPの運用と課題
x86taka
0
300
GitHub を組織的に使いこなすために ソニーが実践した全社展開のプラクティス
sony
11
5.9k
IPv6-mostly field report from RubyKaigi 2026
sorah
0
210
その意思決定、まだ続けるんですか? ~痛みを超えて未来を作る、AI時代の撤退とピボットの技術~
applism118
42
24k
"'TSのAPI型安全”の対価は誰が払う?不公平なスキーマ駆動に終止符を打つハイブリッド戦略
hal_spidernight
0
190
持続可能なアクセシビリティ開発
azukiazusa1
6
360
Pandocでmd→pptx便利すぎワロタwww
meow_noisy
2
990
.NET 10のEntity Framework Coreの新機能
htkym
0
130
PostgreSQL で列データ”ファイル”を利用する ~Arrow/Parquet を統合したデータベースの作成~
kaigai
0
180
都市スケールAR制作で気をつけること
segur
0
210
社内外から"使ってもらえる"データ基盤を支えるアーキテクチャの秘訣/登壇資料(飯塚 大地・高橋 一貴)
hacobu
PRO
0
8.3k
Featured
See All Featured
The Language of Interfaces
destraynor
162
25k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.2k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.5k
[RailsConf 2023] Rails as a piece of cake
palkan
57
6.1k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
31
2.7k
The Pragmatic Product Professional
lauravandoore
36
7k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Become a Pro
speakerdeck
PRO
30
5.6k
Mobile First: as difficult as doing things right
swwweet
225
10k
The Cult of Friendly URLs
andyhume
79
6.7k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
57
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を使って簡単に独自ルールが
作れる