Showing 41 of 41 total issues

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

        def dispatch_method(subject,
                            subject_class,
                            method_name,
                            arguments,
                            keyword_arguments,
Severity: Minor
Found in lib/rr/injections/double_injection.rb - About 45 mins to fix

    Method bind has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def bind
            unless class_instance_method_defined(subject_class, original_method_alias_name)
              unless class_instance_method_defined(subject_class, :method_missing)
                @placeholder_method_defined = true
                subject_class.class_eval do
    Severity: Minor
    Found in lib/rr/injections/method_missing_injection.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(subject, subject_class, method_name, args, kwargs, block)
    Severity: Minor
    Found in lib/rr/method_dispatches/method_missing_dispatch.rb - About 45 mins to fix

      Method bind has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def bind
              unless class_instance_method_defined(subject_class, original_method_alias_name, false)
                unless class_instance_method_defined(subject_class, :singleton_method_added, false)
                  @placeholder_method_defined = true
                  subject_class.class_eval do
      Severity: Minor
      Found in lib/rr/injections/singleton_method_added_injection.rb - About 45 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 record_call has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def record_call(subject, method_name, arguments, keyword_arguments, block)
      Severity: Minor
      Found in lib/rr/space.rb - About 35 mins to fix

        Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def add(subject, method_name, arguments, keyword_arguments, block)
        Severity: Minor
        Found in lib/rr/recorded_calls.rb - About 35 mins to fix

          Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def initialize(double_injection, subject, args, kwargs, block)
          Severity: Minor
          Found in lib/rr/method_dispatches/method_dispatch.rb - About 35 mins to fix

            Method call has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def call(definition, method_name, args, kwargs, handler)
            Severity: Minor
            Found in lib/rr/double_definitions/strategies/strategy.rb - About 35 mins to fix

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

                    def call_original_method
                      if subject_has_original_method?
                        if KeywordArguments.fully_supported?
                          subject.__send__(original_method_alias_name, *args, **kwargs, &block)
                        else
              Severity: Minor
              Found in lib/rr/method_dispatches/method_dispatch.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def load
                      return if @loaded
                      hook
                      if RR.debug?
                        puts "Loaded adapter: #{name}"
              Severity: Minor
              Found in lib/rr/integrations/decorator.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def initialize(double_definition_create, &block) #:nodoc:
                      @double_definition_create = double_definition_create
                      BlankSlate.call(respond_to?(:class) ? self.class : __blank_slated_class)
              
                      if block_given?
              Severity: Minor
              Found in lib/rr/double_definitions/double_definition_create_blank_slate.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

              Avoid too many return statements within this method.
              Open

                            return false
              Severity: Major
              Found in lib/rr/expectations/argument_equality_expectation.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return matches.matching_doubles.first # This will raise a TimesCalledError
                Severity: Major
                Found in lib/rr/method_dispatches/base_method_dispatch.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return false unless value == other_value
                  Severity: Major
                  Found in lib/rr/core_ext/hash.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                  return false
                    Severity: Major
                    Found in lib/rr/expectations/argument_equality_expectation.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                            return false unless found
                      Severity: Major
                      Found in lib/rr/core_ext/hash.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return nil
                        Severity: Major
                        Found in lib/rr/method_dispatches/base_method_dispatch.rb - About 30 mins to fix

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

                              def verify_ordered_double(double)
                                unless double.terminal?
                                  raise RR::Errors.build_error(:DoubleOrderError,
                                    "Ordered Doubles cannot have a NonTerminal TimesCalledExpectation")
                                end
                          Severity: Minor
                          Found in lib/rr/space.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 call_implementation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def call_implementation
                                  if implementation_is_original_method?
                                    space.record_call(subject, method_name, args, kwargs, block)
                                    double.method_call(args, kwargs)
                                    call_original_method
                          Severity: Minor
                          Found in lib/rr/method_dispatches/method_missing_dispatch.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def call(klass)
                                  klass.instance_eval do
                                    instance_methods.each do |unformatted_method_name|
                                      method_name = unformatted_method_name.to_s
                                      unless method_name =~ /^_/ || Space.blank_slate_whitelist.any? {|whitelisted_method_name| method_name == whitelisted_method_name}
                          Severity: Minor
                          Found in lib/rr/blank_slate.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