File list.rb
has 323 lines of code (exceeds 250 allowed). Consider refactoring.
require_relative 'internal/curried_method'
require_relative 'internal/dispatchable'
require_relative 'internal/transducers'
module Ramda
Method curried_method_body
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
def curried_method_body(name, arity, &block)
Ramda::Internal::FunctionWithArity.call(arity) do |*args|
begin
if args.index(Ramda.__)
replace_placeholder(args, &block).curry
Method __make_curry_proc__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
def __make_curry_proc__(proc, passed, arity)
is_lambda = proc.lambda?
passed.freeze
__send__((is_lambda ? :lambda : :proc)) do |*argv, &passed_proc|
Similar blocks of code found in 2 locations. Consider refactoring.
Benchmark.ips do |x|
x.report('Object#is_a?') { obj.is_a?(xs.sample) }
x.report('Ramda.is') { Ramda.is(xs.sample, obj) }
x.report('C Ramda.is') { Ramda.is(xs.sample).call(obj) }
x.report('CA Ramda.is') { Ramda.is.call(xs.sample).call(obj) }
Similar blocks of code found in 2 locations. Consider refactoring.
Benchmark.ips do |x|
x.report('String#match') { str[xs.sample] }
x.report('Ramda.match') { Ramda.match(xs.sample, str) }
x.report('C Ramda.match') { Ramda.match(xs.sample).call(str) }
x.report('CA Ramda.match') { Ramda.match.call(xs.sample).call(str) }
Similar blocks of code found in 3 locations. Consider refactoring.
Benchmark.ips do |x|
x.report('Array#any') { xs.any?(&fn) }
x.report('Ramda.any') { Ramda.any(fn, xs) }
x.report('C Ramda.any') { Ramda.any(fn).call(xs) }
x.report('CA Ramda.any') { Ramda.any.call(fn).call(xs) }
Similar blocks of code found in 3 locations. Consider refactoring.
Benchmark.ips do |x|
x.report('Array#all') { xs.all?(&fn) }
x.report('Ramda.all') { Ramda.all(fn, xs) }
x.report('C Ramda.all') { Ramda.all(fn).call(xs) }
x.report('CA Ramda.all') { Ramda.all.call(fn).call(xs) }
Similar blocks of code found in 3 locations. Consider refactoring.
Benchmark.ips do |x|
x.report('Array#map') { xs.map(&fn) }
x.report('Ramda.map') { Ramda.map(fn, xs) }
x.report('C Ramda.map') { Ramda.map(fn).call(xs) }
x.report('CA Ramda.map') { Ramda.map.call(fn).call(xs) }
Method dispatchable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def dispatchable(method_names, described_types, xf = nil, &fn)
method_names = Array(method_names)
FunctionWithArity.call(fn.arity) do |*args, xs|
case xs
Method dispatchable1
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def dispatchable1(method_names, described_types, xf = nil, &fn)
method_names = Array(method_names)
FunctionWithArity.call(fn.arity) do |xs|
case xs
Identical blocks of code found in 2 locations. Consider refactoring.
xs.reduce(acc) do |loc_acc, x|
res = f.call(loc_acc, x)
break res.value if res.is_a?(::Ramda::Internal::Transducers::Transducer) && res.reduced
res
Identical blocks of code found in 2 locations. Consider refactoring.
xs.reduce(acc) do |loc_acc, x|
res = f.call(loc_acc, x)
break res.value if res.is_a?(::Ramda::Internal::Transducers::Transducer) && res.reduced
res