dobtco/filterer

View on GitHub

Showing 3 of 5 total issues

Class Base has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Base
    attr_accessor :results,
                  :meta,
                  :sort,
                  :params,
Severity: Minor
Found in lib/filterer/base.rb - About 3 hrs to fix

    Method sort_option has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def sort_option(key, string_or_proc = nil, opts = {})
            if string_or_proc.is_a?(Hash)
              opts, string_or_proc = string_or_proc.clone, nil
            end
    
    
    Severity: Minor
    Found in lib/filterer/base.rb - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method filterer_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def filterer_class(override)
            if override
              override.constantize
            else
              const_get("#{name}Filterer")
    Severity: Minor
    Found in lib/filterer/active_record.rb - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Severity
    Category
    Status
    Source
    Language