yujinakayama/transpec

View on GitHub

Showing 48 of 48 total issues

Method descriptions has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def descriptions # rubocop:disable MethodLength
        @descriptions ||= {
          '-f' => [
            'Force processing even if the current Git repository is not',
            'clean.'
Severity: Major
Found in lib/transpec/cli/option_parser.rb - About 3 hrs to fix

    Class Converter has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Converter < BaseRewriter # rubocop:disable ClassLength
        include Syntax::Dispatcher
    
        attr_reader :spec_suite, :project, :config, :report
    
    
    Severity: Minor
    Found in lib/transpec/converter.rb - About 3 hrs to fix

      Method setup_parser has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def setup_parser # rubocop:disable MethodLength
              @parser = create_parser
      
              define_option('-f', '--force') do
                config.forced = true
      Severity: Minor
      Found in lib/transpec/cli/option_parser.rb - About 1 hr to fix

        Method example has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

              def example
                return @example if instance_variable_defined?(:@example)
        
                @example = nil
        
        
        Severity: Minor
        Found in lib/transpec/syntax/oneliner_should.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 const_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def const_name(node)
              return nil if node.nil? || !node.const_type?
        
              const_names = []
              const_node = node
        Severity: Minor
        Found in lib/transpec/util.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 each_forward_chained_node has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def each_forward_chained_node(origin_node, mode = nil)
              return to_enum(__method__, origin_node, mode) unless block_given?
        
              yield origin_node if mode == :include_origin
        
        
        Severity: Minor
        Found in lib/transpec/util.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 each_backward_chained_node has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def each_backward_chained_node(origin_node, mode = nil)
              return to_enum(__method__, origin_node, mode) unless block_given?
        
              yield origin_node if mode == :include_origin
        
        
        Severity: Minor
        Found in lib/transpec/util.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 add_explicit_type_metadata! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_explicit_type_metadata!
                return unless rspec_rails?
                return unless method_name == :describe
                return if explicit_type_metadata?
        
        
        Severity: Minor
        Found in lib/transpec/syntax/example_group.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 special_block_type has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def special_block_type(block_node) # rubocop:disable MethodLength, CyclomaticComplexity
              send_node = block_node.children.first
              receiver_node, method_name, = *send_node
        
              if const_name(receiver_node) == 'RSpec'
        Severity: Minor
        Found in lib/transpec/static_context_inspector.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 block_node_taken_by_with_method_with_no_normal_args has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def block_node_taken_by_with_method_with_no_normal_args
                each_backward_chained_node(node, :child_as_second_arg) do |chained_node, child_node|
                  next unless chained_node.block_type?
                  return nil unless child_node.children[1] == :with
                  return nil if child_node.children[2]
        Severity: Minor
        Found in lib/transpec/syntax/should_receive.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 process_should_receive has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_should_receive(should_receive)
              if should_receive.useless_expectation?
                if config.convert?(:deprecated)
                  if config.convert?(:stub)
                    should_receive.allowize_useless_expectation!(config.negative_form_of_to)
        Severity: Minor
        Found in lib/transpec/converter.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 runtime_subject_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def runtime_subject_data(key = nil)
                unless instance_variable_defined?(:@runtime_subject_data)
                  node = explicit_subject? ? expectation.subject_node : expectation.node
                  @runtime_subject_data = runtime_data[node]
                end
        Severity: Minor
        Found in lib/transpec/syntax/have.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 process_rspec_configure has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_rspec_configure(rspec_configure)
              if config.convert?(:deprecated)
                rspec_configure.convert_deprecated_options!
              end
        
        
        Severity: Minor
        Found in lib/transpec/converter.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 convert! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def convert!
                if block_node
                  insert_after(block_node.loc.begin, " |#{block_arg_name}|") unless block_has_argument?
                  replace(selector_range, block_arg_name.to_s) unless method_name == block_arg_name
                  block_node.metadata[:added_example_block_arg] = true
        Severity: Minor
        Found in lib/transpec/syntax/current_example.rb - About 45 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_any_instance_block has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def process_any_instance_block(messaging_host)
              return unless messaging_host
              return unless rspec_version.rspec_2_99?
              return unless config.convert?(:deprecated)
              return unless config.add_receiver_arg_to_any_instance_implementation_block?
        Severity: Minor
        Found in lib/transpec/converter.rb - About 45 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 chainable_source has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def chainable_source(node)
              fail "Invalid argument #{node}" unless node.send_type?
        
              map = node.loc
              source = map.expression.source
        Severity: Minor
        Found in lib/transpec/util.rb - About 45 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 any_instance_target_node has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def any_instance_target_node
                  return nil unless subject_node.send_type?
                  return nil unless subject_node.children.count == 2
                  receiver_node, method_name = *subject_node
                  return nil unless receiver_node
        Severity: Minor
        Found in lib/transpec/syntax/mixin/monkey_patch_any_instance.rb - About 45 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 ruby_files_in_directory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def ruby_files_in_directory(directory_path)
              ruby_file_paths = []
        
              Find.find(directory_path) do |path|
                next unless File.file?(path)
        Severity: Minor
        Found in lib/transpec/spec_file_finder.rb - About 45 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_subject_source has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def replacement_subject_source(base_subject)
                  source = case base_subject
                           when String    then base_subject
                           when AST::Node then base_subject_source(base_subject)
                           else fail "Invalid base subject #{base_subject}"
        Severity: Minor
        Found in lib/transpec/syntax/have/source_builder.rb - About 45 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                def initialize(node, expectation, runtime_data = nil, project = nil, source_rewriter = nil, report = nil)
        Severity: Minor
        Found in lib/transpec/syntax/mixin/owned_matcher.rb - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language