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
「人物ごとのアルバム」の精度改善の軌跡/Improving accuracy of albums by person
mixi_engineers
PRO
1
110
完全自律型AIエージェントとAgentic Workflow〜ワークフロー構築という現実解
pharma_x_tech
0
350
三菱電機で社内コミュニティを立ち上げた話
kurebayashi
1
360
あなたの知らないクラフトビールの世界
miura55
0
140
Amazon Q Developerで.NET Frameworkプロジェクトをモダナイズしてみた
kenichirokimura
1
200
.NET AspireでAzure Functionsやクラウドリソースを統合する
tsubakimoto_s
0
190
タイミーのデータ活用を支えるdbt Cloud導入とこれから
ttccddtoki
1
240
20250116_自部署内でAmazon Nova体験会をやってみた話
riz3f7
1
100
CDKのコードレビューを楽にするパッケージcdk-mentorを作ってみた/cdk-mentor
tomoki10
0
210
ドメイン駆動設計の実践により事業の成長スピードと保守性を両立するショッピングクーポン
lycorptech_jp
PRO
13
2.4k
Evolving Architecture
rainerhahnekamp
3
260
KMP with Crashlytics
sansantech
PRO
0
240
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
160
15k
Practical Orchestrator
shlominoach
186
10k
Navigating Team Friction
lara
183
15k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Building Applications with DynamoDB
mza
93
6.2k
Typedesign – Prime Four
hannesfritz
40
2.5k
How STYLIGHT went responsive
nonsquared
96
5.3k
Thoughts on Productivity
jonyablonski
68
4.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
Side Projects
sachag
452
42k
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.