Showing 16 of 20 total issues
File structs.rb
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'base64'
require 'delegate'
require 'time'
module VCR
Class Cassette
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Cassette
include Logger
# The supported record modes.
#
Class Configuration
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration
include Hooks
include VariableArgsBlockCaller
include Logger
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 migrate_cassette
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def migrate_cassette(cassette)
unless http_interactions = load_yaml(cassette)
@out.puts " - Ignored #{relative_casssette_name(cassette)} since it could not be parsed as YAML (does it have some ERB?)"
return
end
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 configure!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def configure!
::RSpec.configure do |config|
vcr_cassette_name_for = lambda do |metadata|
description = metadata[:description]
- 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 request_with_vcr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_with_vcr(request, *args, &block)
if VCR.turned_on?
handler = request.instance_eval do
remove_instance_variable(:@__vcr_request_handler) if defined?(@__vcr_request_handler)
end || VCR::LibraryHooks::FakeWeb::RequestHandler.new(self, request, *args, &block)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def should_re_record?
return false unless @re_record_interval
previously_recorded_at = earliest_interaction_recorded_at
return false unless previously_recorded_at
- 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 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(request_type, stubbed_response, vcr_request, *args, &response_block)
Method read_body
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_body(dest = nil, &block)
return super if @__read_body_previously_called
return @body if dest.nil? && block.nil?
raise ArgumentError.new("both arg and block given for HTTP method") if dest && block
- 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 perform_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def perform_request(started, record_interaction = false)
# Net::HTTP calls #request recursively in certain circumstances.
# We only want to record the request when the request is started, as
# that is the final time through #request.
unless started
- 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 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"