rubinius/rubinius

View on GitHub
mspec/lib/mspec/mocks/mock.rb

Summary

Maintainability
C
1 day
Test Coverage

Method verify_call has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def self.verify_call(obj, sym, *args, &block)
    compare = *args
    behaves_like_ruby_1_9 = *[]
    if (behaves_like_ruby_1_9)
      compare = compare.first if compare.length <= 1
Severity: Minor
Found in mspec/lib/mspec/mocks/mock.rb - About 4 hrs 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 verify_call has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.verify_call(obj, sym, *args, &block)
    compare = *args
    behaves_like_ruby_1_9 = *[]
    if (behaves_like_ruby_1_9)
      compare = compare.first if compare.length <= 1
Severity: Major
Found in mspec/lib/mspec/mocks/mock.rb - About 2 hrs to fix

    Method verify_count has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.verify_count
        mocks.each do |key, proxies|
          obj = objects[key]
          proxies.each do |proxy|
            qualifier, count = proxy.count
    Severity: Minor
    Found in mspec/lib/mspec/mocks/mock.rb - About 35 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 install_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.install_method(obj, sym, type=nil)
        meta = obj.singleton_class
    
        key = replaced_key obj, sym
        sym = sym.to_sym
    Severity: Minor
    Found in mspec/lib/mspec/mocks/mock.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

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

      def self.cleanup
        objects.each do |key, obj|
          if obj.kind_of? MockIntObject
            clear_replaced key
            next
    Severity: Minor
    Found in mspec/lib/mspec/mocks/mock.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

    There are no issues that match your filters.

    Category
    Status