ddd-ruby/contracts.ruby

View on GitHub
lib/contracts/method_handler.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Class MethodHandler has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class MethodHandler
    METHOD_REFERENCE_FACTORY = {
      :class_methods    => SingletonMethodReference,
      :instance_methods => MethodReference
    }.freeze
Severity: Minor
Found in lib/contracts/method_handler.rb - About 2 hrs to fix

    Assignment Branch Condition size for handle is too high. [15.13/15]
    Open

        def handle
          return unless engine?
          return if decorators.empty?
    
          validate_decorators!
    Severity: Minor
    Found in lib/contracts/method_handler.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method execute_on_target has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def execute_on_target(obj, name, method_type, current_engine, *args, &blk)
    Severity: Minor
    Found in lib/contracts/method_handler.rb - About 45 mins to fix

      FIXME found
      Open

          # FIXME : this looks like untested code (commenting it out doesn't make specs red)
      Severity: Minor
      Found in lib/contracts/method_handler.rb by fixme

      Empty line detected around arguments.
      Open

      
      Each definition needs to have a different contract for the parameters.
      Severity: Minor
      Found in lib/contracts/method_handler.rb by rubocop

      This cops checks if empty lines exist around the arguments of a method invocation.

      Example:

      # bad
      do_something(
        foo
      
      )
      
      process(bar,
      
              baz: qux,
              thud: fred)
      
      some_method(
      
        [1,2,3],
        x: y
      )
      
      # good
      do_something(
        foo
      )
      
      process(bar,
              baz: qux,
              thud: fred)
      
      some_method(
        [1,2,3],
        x: y
      )

      Empty line detected around arguments.
      Open

      
      #{(matched + [decorator]).map(&:to_s).join("\n")}
      Severity: Minor
      Found in lib/contracts/method_handler.rb by rubocop

      This cops checks if empty lines exist around the arguments of a method invocation.

      Example:

      # bad
      do_something(
        foo
      
      )
      
      process(bar,
      
              baz: qux,
              thud: fred)
      
      some_method(
      
        [1,2,3],
        x: y
      )
      
      # good
      do_something(
        foo
      )
      
      process(bar,
              baz: qux,
              thud: fred)
      
      some_method(
        [1,2,3],
        x: y
      )

      Empty line detected around arguments.
      Open

      
      Contract String => String
      Severity: Minor
      Found in lib/contracts/method_handler.rb by rubocop

      This cops checks if empty lines exist around the arguments of a method invocation.

      Example:

      # bad
      do_something(
        foo
      
      )
      
      process(bar,
      
              baz: qux,
              thud: fred)
      
      some_method(
      
        [1,2,3],
        x: y
      )
      
      # good
      do_something(
        foo
      )
      
      process(bar,
              baz: qux,
              thud: fred)
      
      some_method(
        [1,2,3],
        x: y
      )

      Empty line detected around arguments.
      Open

      
      Did you accidentally put more than one contract on a single function, like so?
      Severity: Minor
      Found in lib/contracts/method_handler.rb by rubocop

      This cops checks if empty lines exist around the arguments of a method invocation.

      Example:

      # bad
      do_something(
        foo
      
      )
      
      process(bar,
      
              baz: qux,
              thud: fred)
      
      some_method(
      
        [1,2,3],
        x: y
      )
      
      # good
      do_something(
        foo
      )
      
      process(bar,
              baz: qux,
              thud: fred)
      
      some_method(
        [1,2,3],
        x: y
      )

      Empty line detected around arguments.
      Open

      
      If you did NOT, then you have probably discovered a bug in this library.
      Severity: Minor
      Found in lib/contracts/method_handler.rb by rubocop

      This cops checks if empty lines exist around the arguments of a method invocation.

      Example:

      # bad
      do_something(
        foo
      
      )
      
      process(bar,
      
              baz: qux,
              thud: fred)
      
      some_method(
      
        [1,2,3],
        x: y
      )
      
      # good
      do_something(
        foo
      )
      
      process(bar,
              baz: qux,
              thud: fred)
      
      some_method(
        [1,2,3],
        x: y
      )

      There are no issues that match your filters.

      Category
      Status