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
160
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 to WebAssembly: Exploring the How and Why
tanishiking
0
800
Scala to WebAssembly #scala_waiwai
tanishiking
0
1k
Scala Days Madrid 2023 参加レポート
tanishiking
0
49
Tooling for Scala3
tanishiking
0
360
API-Based Code Search
tanishiking
0
39
Things happening before start coding with Metals ~behind the curtain of daily coding~
tanishiking
0
550
How we replaced a 10-year-old Perl product using Scala
tanishiking
14
33k
Format things with scalafmt
tanishiking
1
1.8k
トランザクション技術入門
tanishiking
0
130
Other Decks in Technology
See All in Technology
やってやろうじゃないかメカアジャイル! / Let's do it, mechanical agile!
psj59129
1
670
実務における脅威モデリングを考えよう
nikinusu
0
650
Swift Testingのconfirmationを コードリーディング/Dive into Swift Testing confirmation
laprasdrum
2
260
Fediverse Discovery Providers overview
andypiper
0
170
「家族アルバム みてね」における運用管理・ オブザーバビリティの全貌 / Overview of Operation Management and Observability in FamilyAlbum
isaoshimizu
4
160
【株式会社ELYZA】|GENIAC成果報告会 自社開発モデルプレゼンテーション
elyza
1
290
Developer Experienceを向上させる基盤づくりの取り組み事例集
coconala_engineer
0
150
技術的負債解消の取り組みと専門チームのお話
bengo4com
0
340
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
46k
Cloud Run と GitHub Template Repository による軽量なアプリケーションプラットフォーム/ #nikkei_tech_talk
nikkei_engineer_recruiting
0
110
DroidKaigi 2024 たすけて!ViewModel
mhidaka
5
950
たった1人からはじめる【Agile Community of Practice】~ソース原理とFearless Changeを添えて~
ktc_corporate_it
1
490
Featured
See All Featured
Scaling GitHub
holman
458
140k
BBQ
matthewcrist
83
9.2k
What's new in Ruby 2.0
geeforr
340
31k
[RailsConf 2023] Rails as a piece of cake
palkan
48
4.6k
How STYLIGHT went responsive
nonsquared
93
5.1k
Designing the Hi-DPI Web
ddemaree
278
34k
The Cult of Friendly URLs
andyhume
76
6k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
VelocityConf: Rendering Performance Case Studies
addyosmani
322
23k
Designing Experiences People Love
moore
138
23k
A Philosophy of Restraint
colly
202
16k
Product Roadmaps are Hard
iamctodd
PRO
48
10k
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を使って簡単に独自ルールが
作れる