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
PHPMDのPHPMDによる静的解析結果
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
iwamot
PRO
May 27, 2022
Technology
1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHPMDのPHPMDによる静的解析結果
2022-05-27
PHPerのための「静的解析」を語り合うPHP TechCafe
https://rakus.connpass.com/event/245646/
iwamot
PRO
May 27, 2022
More Decks by iwamot
See All by iwamot
MCP Appsを作ってみよう
iwamot
PRO
4
840
自己紹介
iwamot
PRO
1
140
パワポ作るマンをMCP Apps化してみた
iwamot
PRO
0
1.1k
8万デプロイ
iwamot
PRO
2
460
AIエージェント・マイクロサービス時代。AWSでの手軽な構築法を考えて試してみた
iwamot
PRO
1
150
これがLambdaレス時代のChatOpsだ!実例で学ぶAmazon Q Developerカスタムアクション活用法
iwamot
PRO
10
3.1k
Developer Certificate of Origin、よさそう
iwamot
PRO
0
130
復号できなくなると怖いので、AWS KMSキーの削除を「面倒」にしてみた CODT 2025 クロージングイベント版
iwamot
PRO
1
230
復号できなくなると怖いので、AWS KMSキーの削除を「面倒」にしてみた
iwamot
PRO
3
230
Other Decks in Technology
See All in Technology
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.3k
サブエージェントと Claude Mods で作る独自 Advisor ツールの話
kenichiodo
2
150
初対面のメンバーがチームを組み、Claude Codeでゼロからサービスをリリース
mkdev10
1
130
Snapshot Testing in Practice: Predictable and Reliable SwiftUI Views
fespinoza
0
220
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
130
AI駆動開発の時代になったのでトヨタ生産方式から見直す
terurou
7
6k
脆弱性診断って、何をしているの? 〜弱点を見つけて、会社の改善につなげるまで〜
keeg
0
910
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
120
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
370
分析AIエージェントを育てる、動く環境を育てる
codatum
1
1.1k
触りたくないデータに、どう触るか AI時代のRBACアクセスガバナンス
ivry_presentationmaterials
0
210
Metadata - Section 1: HTML Basics
mohab1
0
110
Featured
See All Featured
brightonSEO & MeasureFest 2025 - Winning Strategies for Black Friday CRO & PPC - Christian Goodrich
cargoodrich
3
870
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
The untapped power of vector embeddings
frankvandijk
2
1.9k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
380
The Mindset for Success: Future Career Progression
greggifford
PRO
0
540
A designer walks into a library…
pauljervisheath
211
25k
The Invisible Side of Design
smashingmag
301
52k
Done Done
chrislema
187
17k
We Have a Design System, Now What?
morganepeng
55
8.4k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
Transcript
PHPMDの PHPMDによる静的解析結果 2022-05-27 PHPerのための「静的解析」を語り合うPHP TechCafe https://rakus.connpass.com/event/245646/ ENECHANGE株式会社 インフラエンジニア 岩本隆史 (@iwamot)
2019年、リファクタリングを任された 当時は旅行業の会社に勤めていた アクティビティ予約サービスをCakePHPで開発していた 20,000行超のファイルがあるなど、コードの品質が気になった リファクタリングしたいと申し出た
静的解析ツールを探し始めた リファクタリングの優先度を決めるのに使いたい
PHPMDを見つけた https://phpmd.org/ PHP Mess Detector(いわゆる「コードの不吉な匂い」を検出) SiderやCodacyでも使われていたので、試す価値があると思った
好奇心から、PHPMD自体を解析した PHPMD自体もPHPで書かれている 当時のコードをいま解析するなら下記のような感じ $ git clone https://github.com/phpmd/phpmd.git $ cd phpmd
$ git checkout 42bf8ad4 $ docker run -it --rm \ -v /path/to/phpmd/src:/src \ iwamot/phpmd-docker:2.12.0 /src html \ cleancode,codesize,controversial,design,naming,unusedcode \ --exclude /src/test > phpmd-result.html
不吉な匂いが35件も検出された
OSS貢献のチャンスだと思った 不吉な匂いの検出ツールなのに、不吉な匂いが多いのは切ない 修正プルリクエストを送ろう!
修正ターゲットを決めた 未使用変数 $list が戻り値に使われている 明らかなバグはこれだけだった
PRを送ったらマージされた https://github.com/phpmd/phpmd/pull/598
めでたしめでたし
しかし
リファクタリングは完遂できなかった 自社サービスのコード解析は済ませた リファクタリングも順調に進めていた そこへ新型コロナが来てしまった いろいろあって退職することに
PHPMDの不吉な匂いも増えている 当時の35件から39件に (fcb0f1f3)
ともあれ
静的解析ツールを解析してみると 発見があるかも