yujinakayama/transpec

View on GitHub

Showing 48 of 48 total issues

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

      def build_description(size)
        description = positive? ? 'has ' : 'does not have '

        case have_matcher.method_name
        when :have_at_least then description << 'at least '
Severity: Minor
Found in lib/transpec/syntax/oneliner_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 base_paths has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def base_paths(paths)
      if paths.empty?
        if Dir.exist?('spec')
          ['spec']
        else
Severity: Minor
Found in lib/transpec/spec_file_finder.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 allowize! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def allowize!
        return if method_name == :stub_chain && !rspec_version.receive_message_chain_available?

        unless allow_to_receive_available?
          fail ContextError.new("##{method_name}", '#allow', selector_range)
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 find_config_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def find_config_node(config_method_name)
          return nil unless block_node

          config_method_name = config_method_name.to_sym

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

    def proc_literal?(node)
      return false unless node.block_type?

      send_node = node.children.first
      receiver_node, method_name, = *send_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 to_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def to_node
          return nil unless parent_node

          if parent_node.block_type? && parent_node.children.first.equal?(node)
            parent_node.parent
Severity: Minor
Found in lib/transpec/syntax/mixin/expect_base.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