yujinakayama/transpec

View on GitHub

Showing 48 of 48 total issues

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

      def build_allow_to_receive(message_node, value_node = nil, keep_form_around_arg = true)
        expression =  allow_source
        expression << range_in_between_receiver_and_selector.source
        expression << 'to receive'
        expression << (keep_form_around_arg ? range_in_between_selector_and_arg.source : '(')
Severity: Minor
Found in lib/transpec/syntax/method_stub.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 configure_boolean_matcher has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def configure_boolean_matcher(type)
        unless VALID_BOOLEAN_MATCHER_TYPES.include?(type)
          types = VALID_BOOLEAN_MATCHER_TYPES.map(&:inspect).join(', ')
          fail ArgumentError, "Boolean matcher type must be any of #{types}"
        end
Severity: Minor
Found in lib/transpec/cli/option_parser.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 block_node_taken_by_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def block_node_taken_by_method(node)
      parent_node = node.parent
      return nil unless parent_node
      return nil unless parent_node.block_type?
      return nil unless parent_node.children.first.equal?(node)
Severity: Minor
Found in lib/transpec/util.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 process_oneliner_should has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def process_oneliner_should(oneliner_should)
      negative_form = config.negative_form_of_to
      should_convert_have_items = config.convert?(:have_items) &&
                                  oneliner_should.have_matcher.conversion_target?

Severity: Minor
Found in lib/transpec/converter.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 scope_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def scope_type(node)
      return nil unless SCOPE_TYPES.include?(node.type)

      case node.type
      when :block
Severity: Minor
Found in lib/transpec/static_context_inspector.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 new_owner_of_collection has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def new_owner_of_collection(subject)
          subject << '.'

          if have.collection_accessor_is_private?
            subject << "send(#{have.collection_accessor.inspect}"
Severity: Minor
Found in lib/transpec/syntax/have/record_builder.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 expectize! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def expectize!(negative_form = 'not_to')
        fail ContextError.new("##{method_name}", '#expect', selector_range) unless expect_available?

        if proc_subject?
          replace(range_of_subject_method_taking_block, 'expect')
Severity: Minor
Found in lib/transpec/syntax/should.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 replacement_source_and_conversion_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def replacement_source_and_conversion_type(rspec_version)
        if method_name == :stub_chain
          [build_allow_to(:receive_message_chain), :allow_to_receive_message_chain]
        else
          if hash_arg?
Severity: Minor
Found in lib/transpec/syntax/method_stub.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