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
220
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
Scala meets WebAssembly
tanishiking
0
650
Why Wasm+WASI for Scala
tanishiking
0
120
Scala to WebAssembly: Exploring the How and Why
tanishiking
1
1.7k
Scala to WebAssembly #scala_waiwai
tanishiking
0
1.7k
Scala Days Madrid 2023 参加レポート
tanishiking
0
85
Tooling for Scala3
tanishiking
0
410
API-Based Code Search
tanishiking
0
62
Things happening before start coding with Metals ~behind the curtain of daily coding~
tanishiking
0
610
How we replaced a 10-year-old Perl product using Scala
tanishiking
14
34k
Other Decks in Technology
See All in Technology
自作LLM Native GORM Pluginで実現する AI Agentバックテスト基盤構築
po3rin
2
250
Goに育てられ開発者向けセキュリティ事業を立ち上げた僕が今向き合う、AI × セキュリティの最前線 / Go Conference 2025
flatt_security
0
350
データエンジニアがこの先生きのこるには...?
10xinc
0
440
Flaky Testへの現実解をGoのプロポーザルから考える | Go Conference 2025
upamune
1
420
動画データのポテンシャルを引き出す! Databricks と AI活用への奮闘記(現在進行形)
databricksjapan
0
140
Access-what? why and how, A11Y for All - Nordic.js 2025
gdomiciano
1
110
ACA でMAGI システムを社内で展開しようとした話
mappie_kochi
1
260
SoccerNet GSRの紹介と技術応用:選手視点映像を提供するサッカー作戦盤ツール
mixi_engineers
PRO
1
170
BirdCLEF+2025 Noir 5位解法紹介
myso
0
190
Modern_Data_Stack最新動向クイズ_買収_AI_激動の2025年_.pdf
sagara
0
200
Green Tea Garbage Collector の今
zchee
PRO
2
390
PLaMo2シリーズのvLLM実装 / PFN LLM セミナー
pfn
PRO
2
980
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
32
2.2k
Balancing Empowerment & Direction
lara
4
680
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
2.6k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
890
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Product Roadmaps are Hard
iamctodd
PRO
54
11k
A Tale of Four Properties
chriscoyier
160
23k
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を使って簡単に独自ルールが
作れる