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

    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 __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

    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

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 45.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 42.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    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 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

    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

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 25.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 25.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Severity
    Category
    Status
    Source
    Language