jbender/motion-spec

View on GitHub

Showing 11 of 368 total issues

Method execute_block has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def execute_block
      yield
    rescue Object => e
      @exception_occurred = true

Severity: Minor
Found in lib/motion-spec/specification.rb - About 2 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

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

  class Context
    include ContextHelper::Matchers
    include ContextHelper::Should
    include ContextHelper::Expectation
    include ContextHelper::MemoizedHelpers
Severity: Minor
Found in lib/motion-spec/context.rb - About 2 hrs to fix

    Method proxy_existing_method has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def proxy_existing_method(method, options = {}, &_block)
        method_alias = "__old_#{method}".to_sym
    
        meta_eval { module_eval { alias_method method_alias, method } }
    
    
    Severity: Minor
    Found in lib/motion-spec/mock/proxy.rb - About 1 hr to fix

      Method proxy_existing_method has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def proxy_existing_method(method, options = {}, &_block)
          method_alias = "__old_#{method}".to_sym
      
          meta_eval { module_eval { alias_method method_alias, method } }
      
      
      Severity: Minor
      Found in lib/motion-spec/mock/proxy.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 satisfy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def satisfy(*args, &_block)
            if args.size == 1 && String === args.first
              description = args.shift
            else
              description = ''
      Severity: Minor
      Found in lib/motion-spec/should.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 message_for_raise_error has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.message_for_raise_error(negated, show_class, error_class, show_message, error_message, rescued_exception)
      Severity: Minor
      Found in lib/motion-spec/fail_message_renderer.rb - About 45 mins to fix

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

            def initialize(context, description, block, before_filters, after_filters)
        Severity: Minor
        Found in lib/motion-spec/specification.rb - About 35 mins to fix

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

              def self.message_for_have_items(negated, subject, expected_number_of_items, actual_number_of_items, key_type_name)
          Severity: Minor
          Found in lib/motion-spec/fail_message_renderer.rb - About 35 mins to fix

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

              def mock!(method, options = {}, &block)
                MotionSpec::Mocks.add([self, method])
            
                behavior =
                  if block_given?
            Severity: Minor
            Found in lib/motion-spec/mock/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 run_postponed_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def run_postponed_block(block)
                  # If an exception occurred, we definitely don't need execute any more blocks
                  execute_block(&block) unless @exception_occurred
                  @postponed_blocks_count -= 1
                  unless postponed?
            Severity: Minor
            Found in lib/motion-spec/specification.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.run(arg = nil)
                unless respond_to?(:handle_specification_begin)
                  extend(Outputs[ENV['output']] || DEFAULT_OUTPUT_MODULE)
                end
            
            
            Severity: Minor
            Found in lib/motion-spec/core.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