You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user system total real
include? Number 2.640000 0.000000 2.640000 ( 2.639529)
cover? Number 2.590000 0.000000 2.590000 ( 2.585174)
include? Time 4.260000 0.000000 4.260000 ( 4.262342)
cover? number 3.770000 0.000000 3.770000 ( 3.770333)
The text was updated successfully, but these errors were encountered:
問題
Performance/RangeInclude
は、Range#include?
の代わりにRange#cover?
を使用してね、という警告をだすCopです。このCopにはいくつか問題があります。cover?
の方が速くはあるっぽいinclude?
とcover?
では異なった結果が得られる。そのため、この警告を元にユーザーは間違った修正を行ってしまう可能性があります。
解決方法
range の値の中身によって、警告のメッセージを変えるべきでしょう。
Note
これだけ聞くとこのCopは無意味なのでは、と思うかも知れませんが、例えばTimeのrangeの場合などはそこそこパフォーマンスに差が出てくるので意味があると言えるでしょう。
The text was updated successfully, but these errors were encountered: