Tag: rubocop

“分配分支条件太大”以及如何解决这个问题是什么意思?

在我的Rails应用程序中,我使用Rubocop来检查问题。 今天它给了我这样一个错误: Assignment Branch Condition size for show is too high 。 这是我的代码: def show @category = Category.friendly.find(params[:id]) @categories = Category.all @search = @category.products.approved.order(updated_at: :desc).ransack(params[:q]) @products = @search.result.page(params[:page]).per(50) rate end 这是什么意思,我该如何解决?

Rubocop Linelength:如何忽略带注释的行?

使用Rails 4应用程序时,我想要Rubocop在检查一行是否很长时忽略包含注释的行(只是一个注释或一些带行尾注释的代码)。 有没有办法做到这一点?