Search code examples
ruby-on-railscanexecute

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


Hi i am working on a RoR project with cane gem. I have a method inside an interactor. I am getting Methods exceeded maximum allowed ABC complexity (1): For this method. I want to exclude this method to check complexity. So I tried:

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

But still it throws the same error. Please help me how can I ignore ABC complexity only for this method. Thanks in advance.


Solution

  • Looking at the docs, I believe you'll need to go with:

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

    (notice the # sign where you had a .)