5. 例えば
Rubyのメトリクスツール”Reek”を使ってみる
$gem install reek
$reek myApp.rb
myApp.rb -- 9 warnings:
A has no descriptive comment (IrresponsibleModule)
A has no descriptive comment (IrresponsibleModule)
A#a has the variable name 'f' (UncommunicativeName)
B has no descriptive comment (IrresponsibleModule)
B#a calls a.b twice (Duplication)
B#a contains iterators nested 2 deep (NestedIterators)
・・・
6. 例えば
Railsにも使える
$reek myRailsApp/app/controller/
file_a.rb -- 10 warnings:
A has no descriptive comment (IrresponsibleModule)
・・・
file_b.rb -- 32 warnings:
B has no descriptive comment (IrresponsibleModule)
・・・
file_c.rb -- 3 warnings:
C has no descriptive comment (IrresponsibleModule)
・・・
8. あるプロダクトのClass別Warning数
• プロダクト全体で63のClass
Class A
14% • でも上位5つだけでWarningの半分以上!
その他 B
40% 13% • A∼Eを集中してリファクタリングすべき!
C • どこが複雑か把握できると対処しやすい
E D 13%
10% 10%