jfinkhaeuser/collapsium

View on GitHub
lib/collapsium/support/methods.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method wrappers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def wrappers(base, method_name, visited = nil)
          # First, check the instance, then its class for a wrapper. If either of
          # them succeeds, exit with a result.
          [base, base.class].each do |item|
            item_wrappers = item.instance_variable_get(WRAPPER_HASH)
Severity: Minor
Found in lib/collapsium/support/methods.rb - About 1 hr 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 resolve_helpers has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def resolve_helpers(base, method_name, raise_on_missing)
        # The base class must define an instance method of method_name, otherwise
        # this will NameError. That's also a good check that sensible things are
        # being done.
        base_method = nil
Severity: Minor
Found in lib/collapsium/support/methods.rb - About 1 hr 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 wrappers has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def wrappers(base, method_name, visited = nil)
          # First, check the instance, then its class for a wrapper. If either of
          # them succeeds, exit with a result.
          [base, base.class].each do |item|
            item_wrappers = item.instance_variable_get(WRAPPER_HASH)
Severity: Minor
Found in lib/collapsium/support/methods.rb - About 1 hr to fix

    Method wrap_method has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def wrap_method(base, method_name, options = {}, &wrapper_block)
            # Option defaults (need to check for nil if we default to true)
            if options[:raise_on_missing].nil?
              options[:raise_on_missing] = true
            end
    Severity: Minor
    Found in lib/collapsium/support/methods.rb - About 1 hr to fix

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

            def wrap_method(base, method_name, options = {}, &wrapper_block)
              # Option defaults (need to check for nil if we default to true)
              if options[:raise_on_missing].nil?
                options[:raise_on_missing] = true
              end
      Severity: Minor
      Found in lib/collapsium/support/methods.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

      There are no issues that match your filters.

      Category
      Status