Showing 15 of 15 total issues
File structs.rb
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'base64'
require 'delegate'
require 'time'
module VCR
Class Cassette
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Cassette
include Logger::Mixin
# The supported record modes.
#
Class Configuration
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration
include Hooks
include VariableArgsBlockCaller
include Logger::Mixin
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@/
- Read upRead up
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@/
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 } }
- Read upRead up
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
- Read upRead up
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 9 (exceeds 5 allowed). Consider refactoring. Open
def try_encode_string(string, encoding)
return string if encoding.nil? || string.encoding.name == encoding
# ASCII-8BIT just means binary, so encoding to it is nonsensical
# and yet "\u00f6".encode("ASCII-8BIT") raises an error.
- Read upRead up
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)
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 = '')
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]
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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"