Showing 24 of 37 total issues
Method patch
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
def patch(src, patchset, direction = nil)
# Normalize the patchset.
has_changes, patchset = Diff::LCS::Internals.analyze_patchset(patchset)
return src.respond_to?(:dup) ? src.dup : src unless has_changes
- 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 patch
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def patch(src, patchset, direction = nil)
# Normalize the patchset.
has_changes, patchset = Diff::LCS::Internals.analyze_patchset(patchset)
return src.respond_to?(:dup) ? src.dup : src unless has_changes
Method error_message
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def error_message(expectation, args_for_multiple_calls)
expected_args = format_args(expectation.expected_args)
actual_args = format_received_args(args_for_multiple_calls)
if RSpec::Support::RubyFeatures.distincts_kw_args_from_positional_hash? && expected_args == actual_args
- 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 append_opts_from_config_file
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def append_opts_from_config_file
self.libs ||= []
self.requires ||= []
config_location = 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 context_diff
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def context_diff(last = false)
s = encode("***************\n")
s += encode("*** #{context_range(:old, ",", last)} ****\n")
r = context_range(:new, ",", last)
Method run_await
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_await(example_group_instance, reporter)
# added awaits
@example_group_instance = example_group_instance
@reporter = reporter
RSpec.configuration.configure_example(self, hooks)
Method context_diff
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def context_diff(last = false)
s = encode("***************\n")
s += encode("*** #{context_range(:old, ",", last)} ****\n")
r = context_range(:new, ",", last)
- 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 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(&block)
@legacy_server_proxy = LegacyServerProxy.new
block.call(@legacy_server_proxy, self) if block_given? # for compatibility
raise 'Cannot supply both a pattern and files!' if self.files \
Method unified_diff
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unified_diff(last = false)
# Calculate item number range.
s = encode("@@ -#{unified_range(:old, last)} +#{unified_range(:new, last)} @@\n")
# Outlist starts containing the hunk of the old file. Removing an item
Method run_await
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run_await(example_group_instance, reporter)
# added awaits
@example_group_instance = example_group_instance
@reporter = reporter
RSpec.configuration.configure_example(self, hooks)
- 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 append_opts_from_config_file
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def append_opts_from_config_file
self.libs ||= []
self.requires ||= []
config_location = nil
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(&block)
@legacy_server_proxy = LegacyServerProxy.new
block.call(@legacy_server_proxy, self) if block_given? # for compatibility
raise 'Cannot supply both a pattern and files!' if self.files \
- 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 get_files_to_run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_files_to_run(paths)
files = paths_to_check(paths).flat_map do |path|
path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
is_directory?(path) ? gather_directories(path) : extract_location(path)
end.uniq
- 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 run_await
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_await(position, scope, example_or_group)
return if RSpec.configuration.dry_run?
if scope == :context
unless example_or_group.class.metadata[:skip]
- 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 print_example_failed
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def print_example_failed(pending_fixed, description, run_time, failure_id, exception, extra_content)
Method run_await
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.run_await(reporter=RSpec::Core::NullReporter)
# added awaits
return if RSpec.world.wants_to_quit
reporter.example_group_started(self)
- 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 get_opal_spec_requires
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_opal_spec_requires
if !@spec_files || @spec_files.empty?
files = get_matching_files_under(path: @default_path)
else
files = @spec_files.map do |file|
- 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 convert_spec_opts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.convert_spec_opts(opts)
opts ||= ENV['SPEC_OPTS'] || {}
unless opts.is_a? Hash
opts = Shellwords.split(opts) if opts.is_a? String
- 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 ensure_can_be_proxied!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_can_be_proxied!(object)
return unless object.is_a?(Symbol) || object.frozen?
return if object.nil?
msg = "Cannot proxy frozen objects"
- 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 unified_diff
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def unified_diff(last = false)
# Calculate item number range.
s = encode("@@ -#{unified_range(:old, last)} +#{unified_range(:new, last)} @@\n")
# Outlist starts containing the hunk of the old file. Removing an item
- 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"