Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Custom Lint Rules で独自のリントルールを作成する
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
浅沼もっちゃん / Motoharu Asanuma
June 15, 2024
Programming
300
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Custom Lint Rules で独自のリントルールを作成する
浅沼もっちゃん / Motoharu Asanuma
June 15, 2024
Other Decks in Programming
See All in Programming
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
460
GemmaをJevのように使ってみる / Use Gemma like Jev
kishida
5
790
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.7k
sbt 2.0: takeoff
eed3si9n
0
160
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
140
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
290
TechTown - Creating Composable Callables in Contemporary C++
rollbear
0
130
Domain-Driven Transformation
hschwentner
2
2.3k
Web Framework Benchmark Battle 2026, Any%
a_matsuda
2
2k
Agents on Rails - Rails at Scale 2026
irinanazarova
0
560
現場と育てるRailsモデリング 〜Spreadsheetから始めたモデル設計〜
siroemk
2
590
golang-bob.pdf
iwatsukayura
0
130
Featured
See All Featured
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
550
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
570
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
270
Designing for Timeless Needs
cassininazir
1
530
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.3k
Automating Front-end Workflow
addyosmani
1369
210k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
Transcript
Custom Lint Rulesで 独自のリントルールを作成する ※このページは削除して構いません Click 浅沼もっちゃん@momomomo111
・自己紹介 ・Custom Lint Rulesについて ・実装方法 ・まとめ
浅沼もっちゃん / momomomo111 株式会社AbemaTV / Android Based TVのアプリを作ってます。 自己紹介
そもそもLintとは、 Androidプロジェクト のソースファイルを チェックする静的解析 ツール Custom Lint Rulesについて ↑の例だと定義されて いるけどどこからも呼
び出されていないこと について警告 https://android.googlesource.com/platform/frameworks/support/+/HEAD/ docs/lint_guide.md#getting-started
Q. 警告が出て、なにが嬉しいのか? A. 警告が出ないようにコーディングすることで プロジェクトの保守性を高めるため (想定外のことや推奨を開発者に知らせてくれるええやつ) Custom Lint Rulesについて
自分で、「ええやつ」作ってみたくない?
今回つくるええやつ フィーチャーフラグの 期限の形式が ”yyyy-mm-dd”の 形式になってなかったら エラーにしたい 実装方法 https://github.com/abema/flagfit
実装方法 下準備 ・リント用のモジュールの作成 ・Issue作成、IssueRegistryの実装 ・テストを書く ・Detector()の実装
実装方法 リント用のモジュールの作成 プロジェクトのルートから モジュールを作成
依存関係追加 Lintモジュールの build.gradleへ追記 実装方法
Issue作成 警告で出したい文言や プライオリティなどを定義 実装方法
IssueRegistryの実装 先ほど登録したIssueを登録 実装方法
IssueRegistryの実装 com.android.tools.lint.cli ent.api.IssueRegistryに IssueRegistryのフルパス を追加 実装方法
IssueRegistryの実装 Lintモジュールの build.gradleへの 追記も忘れずに 実装方法
Q. なぜテストから書くか? A. 正しくリントが動くかの動作の保証がシンプル ・Lintのライブラリ内で完結 ・差分が明確で、軽量 実装方法
テストを書く testモジュールを切る 実装方法
テストを書く ・LintDetectorTestを継承 して実装 ・DetectorとIssueを設定 実装方法
テストを書く ・独自クラスもここで定義 しなければならない ・expectは一旦適当wipで OK 実装方法
テストを書く ・量が多くなったら TestFileで他のobjectに 書き出してテスト関数は シンプルにできる 実装方法
Detector()の実装 ・ここで構文解析。一致す る条件の場合にメッセージ と一緒にレポート ・終わったらテストを実行 して調整 実装方法
使用するプロジェクト のbuild.gradle ファイルから呼び出し 使用方法
動作確認 ちゃんと期待通りの結果が 出ていることを確認 使用方法
・Custom Lint Rulesを実装することで柔軟にLint を設定できる ・テストから書いて土台を作る方が検証しやすい ・今日話した実装内容は下記リポジトリにあります →https://github.com/abema/flagfit まとめ