yujinakayama/transpec

View on GitHub
lib/transpec/converter.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

    There are no issues that match your filters.

    Category
    Status