如何排除带有 cane gem 的方法以避免 abc 复杂性

How to exlude a method with cane gem to avoid abc complexity

您好,我正在与 cane gem 合作进行 RoR 项目。我在交互器中有一个方法。我得到 Methods exceeded maximum allowed ABC complexity (1): 对于这种方法。我想排除这种方法来检查复杂性。所以我尝试了:

Cane::RakeTask.new(:code_quality) do |cane|
  cane.abc_max = 15
  cane.no_style = true
  cane.no_doc = true
  cane.abc_exclude = %w(App::Interactors::StoreParserInteractor.find_date_time)
end

但它仍然抛出相同的错误。请帮助我如何仅针对此方法忽略 ABC 复杂性。提前致谢。

查看 docs,我相信您需要:

cane.abc_exclude = %w(App::Interactors::StoreParserInteractor#find_date_time)

(注意你有 .# 标志)