yujinakayama/transpec

View on GitHub

Showing 48 of 48 total issues

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

      def dispatch_node(node, runtime_data = nil, project = nil, source_rewriter = nil, report = nil)
Severity: Minor
Found in lib/transpec/syntax.rb - About 35 mins to fix

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

        def initialize(node, runtime_data = nil, project = nil, source_rewriter = nil, report = nil)
    Severity: Minor
    Found in lib/transpec/syntax.rb - About 35 mins to fix

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

          def copy(source, destination)
            if File.symlink?(source)
              File.symlink(File.readlink(source), destination)
            elsif File.directory?(source)
              FileUtils.mkdir_p(destination)
      Severity: Minor
      Found in lib/transpec/directory_cloner.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 conversion_target? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def conversion_target?
                return false unless dynamic_analysis_target?
      
                in_example_group_context = if runtime_data.run?(node)
                                             # If we have runtime data, check with it.
      Severity: Minor
      Found in lib/transpec/syntax/mixin/context_sensitive.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 convert_pending_metadata_to_skip! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def convert_pending_metadata_to_skip!
              metadata_key_nodes.each do |node|
                next unless pending_symbol?(node)
                replace(symbol_range_without_colon(node), 'skip')
                if node.parent.pair_type?
      Severity: Minor
      Found in lib/transpec/syntax/example.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 old_syntax has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def old_syntax
                syntax = method_stub.any_instance? ? 'Klass.any_instance' : 'obj'
                syntax << ".#{method_stub.method_name}"
      
                if method_stub.method_name == :stub_chain
      Severity: Minor
      Found in lib/transpec/syntax/method_stub.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 new_syntax has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def new_syntax
                syntax = method_stub.any_instance? ? 'allow_any_instance_of(Klass)' : 'allow(obj)'
                syntax << '.to '
      
                case conversion_type
      Severity: Minor
      Found in lib/transpec/syntax/method_stub.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 process_method_stub has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_method_stub(method_stub)
            if config.convert?(:stub)
              if !method_stub.hash_arg? ||
                 rspec_version.receive_messages_available? ||
                 config.convert?(:stub_with_hash)
      Severity: Minor
      Found in lib/transpec/converter.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 conversion_target? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def conversion_target?
              return false unless dynamic_analysis_target?
              return true unless runtime_data.run?(send_analysis_target_node)
              return false unless defined_in_rspec_source?
              # #should inside of #its is dynamically defined in MemoizedHelper,
      Severity: Minor
      Found in lib/transpec/syntax/oneliner_should.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 process_rspec_configure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_rspec_configure(rspec_configure)
            return unless runtime_data
            run_order = runtime_data[rspec_configure.node, :run_order]
            return unless run_order
      
      
      Severity: Minor
      Found in lib/transpec/spec_suite.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 insert_example_description! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def insert_example_description!
              unless have_matcher.conversion_target?
                fail 'This one-liner #should does not have #have matcher!'
              end
      
      
      Severity: Minor
      Found in lib/transpec/syntax/oneliner_should.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 build_expectation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              def build_expectation(subject, type)
                case type
                when :should
                  syntax = "#{subject}.should"
                  syntax << '_not' unless positive?
      Severity: Minor
      Found in lib/transpec/syntax/have/record_builder.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 block_node_followed_by_fluent_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def block_node_followed_by_fluent_method
              each_backward_chained_node(node, :child_as_second_arg) do |chained_node, child_node|
                next unless chained_node.send_type?
                return child_node if child_node.block_type?
              end
      Severity: Minor
      Found in lib/transpec/syntax/should_receive.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 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 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 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

      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 at_least_zero_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def at_least_zero_node
                Util.each_backward_chained_node(node) do |chained_node|
                  _, method_name, arg_node = *chained_node
                  next unless method_name == :at_least
                  return chained_node if arg_node == s(:int, 0)
      Severity: Minor
      Found in lib/transpec/syntax/mixin/no_message_allowance.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

      Severity
      Category
      Status
      Source
      Language