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
Custom Lint Rules で独自のリントルールを作成する
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
浅沼もっちゃん / Motoharu Asanuma
June 15, 2024
Programming
0
240
Custom Lint Rules で独自のリントルールを作成する
浅沼もっちゃん / Motoharu Asanuma
June 15, 2024
Tweet
Share
Other Decks in Programming
See All in Programming
AI & Enginnering
codelynx
0
120
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1.7k
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
230
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
140
Raku Raku Notion 20260128
hareyakayuruyaka
0
370
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
AI巻き込み型コードレビューのススメ
nealle
2
1.5k
ぼくの開発環境2026
yuzneri
0
250
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
210
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
1
130
CSC307 Lecture 09
javiergs
PRO
1
840
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
480
Featured
See All Featured
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
120
The Cult of Friendly URLs
andyhume
79
6.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
300
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
590
Automating Front-end Workflow
addyosmani
1371
200k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
120
How to make the Groovebox
asonas
2
1.9k
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 まとめ