【发布时间】:2017-04-01 21:59:45
【问题描述】:
我对 RuboCop 抱怨的内容感到困惑。
“抽奖的分配分支条件大小太高。[29/15]”
以下方法:
class Ball
attr_reader :color
attr_reader :center
attr_reader :radius
attr_reader :dir
attr_reader :x, :y
attr_reader :w, :h
attr_accessor :worldWidth
attr_accessor :worldHeight
...
# Draw the ball into this device context
def draw(dc)
dc.setForeground(color)
dc.fillArc(x, y, w, h, 0, 64 * 90)
dc.fillArc(x, y, w, h, 64 * 90, 64 * 180)
dc.fillArc(x, y, w, h, 64 * 180, 64 * 270)
dc.fillArc(x, y, w, h, 64 * 270, 64 * 360)
end
...
因为这里没有赋值、分支和条件语句!
我错过了什么?无论如何,这个功能有什么不好?不得不改变它似乎很愚蠢,我不清楚它会带来什么“好处”。请澄清!
【问题讨论】: