Showing 15 of 15 total issues

File structs.rb has 374 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'base64'
require 'delegate'
require 'time'

module VCR
Severity: Minor
Found in lib/vcr/structs.rb - About 5 hrs to fix

    Class Cassette has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Cassette
        include Logger::Mixin
    
        # The supported record modes.
        #
    Severity: Minor
    Found in lib/vcr/cassette.rb - About 4 hrs to fix

      Class Configuration has 29 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Configuration
          include Hooks
          include VariableArgsBlockCaller
          include Logger::Mixin
      
      
      Severity: Minor
      Found in lib/vcr/configuration.rb - About 3 hrs to fix

        Method tags has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def tags(*tag_names)
              original_options = tag_names.last.is_a?(::Hash) ? tag_names.pop : {}
              tag_names.each do |tag_name|
                tag_name = "@#{tag_name}" unless tag_name =~ /\A@/
        
        
        Severity: Minor
        Found in lib/vcr/test_frameworks/cucumber.rb - About 2 hrs 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 tags has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def tags(*tag_names)
              original_options = tag_names.last.is_a?(::Hash) ? tag_names.pop : {}
              tag_names.each do |tag_name|
                tag_name = "@#{tag_name}" unless tag_name =~ /\A@/
        
        
        Severity: Minor
        Found in lib/vcr/test_frameworks/cucumber.rb - About 1 hr to fix

          Method configure! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

                def configure!
                  ::RSpec.configure do |config|
          
                    when_tagged_with_vcr = { :vcr => lambda { |v| !!v } }
          
          
          Severity: Minor
          Found in lib/vcr/test_frameworks/rspec.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 try_encode_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                    def try_encode_string(string, encoding_name)
                      return string if encoding_name.nil?
          
                      encoding = Encoding.find(encoding_name)
                      return string if string.encoding == encoding
          Severity: Minor
          Found in lib/vcr/structs.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 should_re_record? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def should_re_record?(record_mode)
                return false unless @re_record_interval
                return false unless originally_recorded_at
                return false if record_mode == :none
          
          
          Severity: Minor
          Found in lib/vcr/cassette.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 start_new_fiber_for has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def start_new_fiber_for(request, fibers, fiber_errors, hook_declaration, proc)
          Severity: Minor
          Found in lib/vcr/configuration.rb - About 35 mins to fix

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

                  def initialize(interactions, request_matchers, allow_playback_repeats = false, parent_list = NullList, log_prefix = '')
            Severity: Minor
            Found in lib/vcr/cassette/http_interaction_list.rb - About 35 mins to fix

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

                    def vcr_cassette_name_for(metadata)
                      description = 
                        if metadata[:description].empty?
                          # we have an "it { is_expected.to be something }" block
                          metadata[:scoped_id]
              Severity: Minor
              Found in lib/vcr/test_frameworks/rspec.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def render
                      return @raw_template if @raw_template.nil? || !use_erb?
                      binding = binding_for_variables if erb_variables
                      template.result(binding)
                    rescue NameError => e
              Severity: Minor
              Found in lib/vcr/cassette/erb_renderer.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 filter_object! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def filter_object!(object, text, replacement_text)
                      if object.respond_to?(:gsub)
                        object.gsub!(text, replacement_text) if object.include?(text)
                      elsif Hash === object
                        filter_hash!(object, text, replacement_text)
              Severity: Minor
              Found in lib/vcr/structs.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 create_fiber_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create_fiber_for(fiber_errors, hook_declaration, proc)
                    current_thread = Thread.current
                    Fiber.new do |*args, &block|
                      begin
                        # JRuby Fiber runs in a separate thread, so we need to make this Fiber
              Severity: Minor
              Found in lib/vcr/configuration.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 remove_unnecessary_standard_port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def remove_unnecessary_standard_port(interaction)
                      uri = VCR.configuration.uri_parser.parse(interaction.request.uri)
                      if uri.scheme == 'http'  && uri.port == 80 ||
                         uri.scheme == 'https' && uri.port == 443
                        uri.port = nil
              Severity: Minor
              Found in lib/vcr/cassette/migrator.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