lazebny/ramda-ruby

View on GitHub

Showing 12 of 12 total issues

File list.rb has 323 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative 'internal/curried_method'
require_relative 'internal/dispatchable'
require_relative 'internal/transducers'
 
module Ramda
Severity: Minor
Found in lib/ramda/list.rb - About 3 hrs to fix

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

    def curried_method_body(name, arity, &block)
    Ramda::Internal::FunctionWithArity.call(arity) do |*args|
    begin
    if args.index(Ramda.__)
    replace_placeholder(args, &block).curry
    Severity: Minor
    Found in lib/ramda/internal/curried_method.rb - About 1 hr to fix

    Method __make_curry_proc__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def __make_curry_proc__(proc, passed, arity)
    is_lambda = proc.lambda?
    passed.freeze
     
    __send__((is_lambda ? :lambda : :proc)) do |*argv, &passed_proc|
    Severity: Minor
    Found in lib/ramda/internal/java/__make_curry_proc__.rb - About 1 hr to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    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) }
    Severity: Minor
    Found in bench/type/is.rb and 1 other location - About 55 mins to fix
    bench/string/match.rb on lines 7..12

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    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) }
    Severity: Minor
    Found in bench/string/match.rb and 1 other location - About 55 mins to fix
    bench/type/is.rb on lines 7..12

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    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) }
    Severity: Major
    Found in bench/list/any.rb and 2 other locations - About 50 mins to fix
    bench/list/all.rb on lines 8..13
    bench/list/map.rb on lines 8..13

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    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) }
    Severity: Major
    Found in bench/list/all.rb and 2 other locations - About 50 mins to fix
    bench/list/any.rb on lines 8..13
    bench/list/map.rb on lines 8..13

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

    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) }
    Severity: Major
    Found in bench/list/map.rb and 2 other locations - About 50 mins to fix
    bench/list/all.rb on lines 8..13
    bench/list/any.rb on lines 8..13

    Method dispatchable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def dispatchable(method_names, described_types, xf = nil, &fn)
    method_names = Array(method_names)
     
    FunctionWithArity.call(fn.arity) do |*args, xs|
    case xs
    Severity: Minor
    Found in lib/ramda/internal/dispatchable.rb - About 25 mins to fix

    Method dispatchable1 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def dispatchable1(method_names, described_types, xf = nil, &fn)
    method_names = Array(method_names)
     
    FunctionWithArity.call(fn.arity) do |xs|
    case xs
    Severity: Minor
    Found in lib/ramda/internal/dispatchable.rb - About 25 mins to fix

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    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
    Severity: Minor
    Found in lib/ramda/list.rb and 1 other location - About 15 mins to fix
    lib/ramda/list.rb on lines 763..766

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    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
    Severity: Minor
    Found in lib/ramda/list.rb and 1 other location - About 15 mins to fix
    lib/ramda/list.rb on lines 541..544
    Severity
    Category
    Status
    Source
    Language