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
静的解析の話
Search
gaopin
November 20, 2017
Technology
0
180
静的解析の話
Swift愛好会 Vol.24
gaopin
November 20, 2017
Tweet
Share
More Decks by gaopin
See All by gaopin
draft for devsummi
gaopin1534
0
140
XCTestを目的別で分けるすすめ
gaopin1534
0
3.3k
The swifter way of A/B testing implementation
gaopin1534
2
1.4k
RxSwiftってどうなってるの?
gaopin1534
1
310
Drag'n'Drop'n'iPhone
gaopin1534
0
130
OBJ-C戦線異常なし@DevLOVE 199
gaopin1534
1
130
Other Decks in Technology
See All in Technology
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
7
1.6k
2025年に挑戦したいこと
molmolken
0
170
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.8k
技術に触れたり、顔を出そう
maruto
1
160
あなたの人生も変わるかも?AWS認定2つで始まったウソみたいな話
iwamot
3
860
Bring Your Own Container: When Containers Turn the Key to EDR Bypass/byoc-avtokyo2024
tkmru
0
860
20250116_JAWS_Osaka
takuyay0ne
2
200
Reactフレームワークプロダクトを モバイルアプリにして、もっと便利に。 ユーザに価値を届けよう。/React Framework with Capacitor
rdlabo
0
130
カップ麺の待ち時間(3分)でわかるPartyRockアップデート
ryutakondo
0
140
タイミーのデータ活用を支えるdbt Cloud導入とこれから
ttccddtoki
1
270
20250116_自部署内でAmazon Nova体験会をやってみた話
riz3f7
1
100
GoogleのAIエージェント論 Authors: Julia Wiesinger, Patrick Marlow and Vladimir Vuskovic
customercloud
PRO
0
160
Featured
See All Featured
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
870
Speed Design
sergeychernyshev
25
740
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Optimising Largest Contentful Paint
csswizardry
33
3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
Testing 201, or: Great Expectations
jmmastey
41
7.2k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
3
360
How to Ace a Technical Interview
jacobian
276
23k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
KATA
mclloyd
29
14k
Transcript
੩తղੳͷ͓ @gaopin1534
ࣗݾհ • ߴদฏ(gaopin1534) • ਓࡐܥاۀۈ • iOSྺ1ڧ • ͱPHPͱ͔Rubyͱ͔ͱྑ͠ •
githubͱ͔twitter→@gaopin1534
੩తղੳʁ
੩తղੳͬͯͳ͋ʹʁ • ίʔυΛ࣮ߦͤͣʹߦ͏ݕূ • Lintͱ͔ • ఆྔతʹίʔυͷ࣭ΛଌΔ͜ͱ͕Ͱ͖Δ
Why ੩తղੳʁ
ࣄͷى͜Γࠓ಄
ԶࢯผϓϩμΫτʹδϣΠϯ
ർฐͨ͠ίʔυϕʔε by fltmech98
ੵΈ্͕ΔObj-Cͷࢁ by Kristina D.C. Hoeppner
ԶSwift͕ॻ͖͍ͨ
͜ͷίʔυ͍͔ΜͰ͢ 4XJGUͰॻ͖͑·͠ΐ ࣌4XJGUͩΑ4XJGU #044 ͔͚ۚͯ·ͰΔඞཁ͋Γ·ͯ͠ʁ Մಡੑ͕ͻͲ͍ όά͕༙͖·͢Α͜Ε #044 ແअؾͳײͰۚಈ͔ΜͷͩΑ
https://goo.gl/HSLSZn
ͳΒఆྔతͳΤϏσϯεΛ Ϊϟβʔ͢Εྑ͍ΜͰ͠ΐʁ
※swiftͷެࣜplugin༗ྉ(OSS൛༗ΔΒ͍͚͠Ͳͬͨ͜ͱແ͍)
॥తෳࡶ Cyclomatic Complexity
M=E-N+2P M = ॥తෳࡶ E = άϥϑͷΤοδ N = άϥϑͷϊʔυ
P = ࿈݁͞Εͨίϯϙʔωϯτͷ
॥తෳࡶ • ifจforจ͕ແ͍ίʔυͰ1 • ϑϩʔάϥϑ্औΓ͏Δܦ࿏ͷԼݶ • શͳذཏΛୡ͢ΔͨΊʹඞཁͳς ετέʔεͷͷ্ݶ • ߴ͍΄Ͳڽूੑ͕͍ͱߟ͑ΒΕΔ
͜Μͳͱ͖ʁ ϝιουฏۉ͍͍ײ͡ͳͷʹΫϥεฏۉ͕ߴ͍ → Ϋϥεͷׂ͕దͰͳ͍ ϝιουฏۉͷ࣌Ͱ͢Ͱʹѱ͍ → ϝιουͷ໊͚ɺΛݟ͖͢Ͱʁ ϝιουฏۉ͍͍ײ͡ͳͷʹϑΝΠϧฏۉ͕ߴ͍ → ϑΝΠϧ͚ͳͲΛݟ͔͢ɺ͋Δఔڐ༰
॥తෳࡶ ෳࡶ͞ͷঢ়ଶ όάࠞೖ ҎԼ ඇৗʹྑ͍ߏ Ҏ্ ߏతͳϦεΫ͋Γ Ҏ্
ςετෆՄೳ Ҏ্ ͍͔ͳΔมߋޡ मਖ਼ΛੜΉ http://szk-takanori.hatenablog.com/entry/20111219/p1
ίʔυͷष͍ Code Smell
ίʔυͷष͍ • ͍ΘΏΔʮष͏ʯՕॴͷ • Ұൠతʹʮष͏ʯͱݴΘΕΔύλʔϯ͕ݱΕ ͍ͯΔՕॴΛूܭͯ͘͠ΕΔ • ࢀߟఔʹ͢Δͷ͕ྑ͍͔ͳʔͱ
ॏෳ Duplications
ॏෳ • ίʔυͰॏෳ͍ͯ͠Δߦͷׂ߹ • વɺมߋ࣌ʹҙਤͤ͵Өڹ͕ݱΕΔ֬ʹ ؔͯ͘͠Δ • 0%ʹ͢Δ͜ͱෆՄೳͳͷͰɺҰఆҎԼΛ ࢦ͢ͱྑ͍
ͦͷଞ • Reliablity Rating • ϧʔϧΛͪΌΜͱܾΊͳ͚Εɺࢦ͍ͨ࢟͠ʹܴ͑ͳ͍ɻಋೖίετ͕ߴ ͍ҹ • LOC •
ίʔυྔɻίʔυྔͱόά૬͕ؔ͋ΔͷͰɺଟগؾʹ͢Δͷ٢ɻͨͩɺ ϓϩμΫτͷεέʔϧͱίʔυͷεέʔϧΛൺֱɺѲ͢Δ΄͏͕େࣄ͔ͳͱ • ίϝϯτൺ • ίϝϯτӡ༻ͷϧʔϧ͕͋ΔͳΒ͏ʁతʹ͋·Γ͍Βͳ͍ͱࢥͬͯ·͢ɻ
ͨͩ͠
ղੳ͋͘·Ͱ҆
૬ରతͳӡ༻
ఆੑͱͷֻ͚߹Θͤ
੩తղੳͯ͠ ͰԥΕ͓K
Fin.