yujinakayama/transpec

View on GitHub

Showing 48 of 48 total issues

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 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 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 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 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 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 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 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 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 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 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 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

      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 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 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 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 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 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

      Severity
      Category
      Status
      Source
      Language