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
170
静的解析の話
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
Terraform Stacks入門 #HashiTalks
msato
0
350
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
AWS Lambda のトラブルシュートをしていて思うこと
kazzpapa3
2
170
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
Shopifyアプリ開発における Shopifyの機能活用
sonatard
4
250
隣接領域をBeyondするFinatextのエンジニア組織設計 / beyond-engineering-areas
stajima
1
270
B2B SaaSから見た最近のC#/.NETの進化
sansantech
PRO
0
810
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
600
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
AIチャットボット開発への生成AI活用
ryomrt
0
170
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
Featured
See All Featured
Designing for Performance
lara
604
68k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
How STYLIGHT went responsive
nonsquared
95
5.2k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Git: the NoSQL Database
bkeepers
PRO
427
64k
The Pragmatic Product Professional
lauravandoore
31
6.3k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
16
2.1k
A Tale of Four Properties
chriscoyier
156
23k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
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.