DannyBen/datamix

View on GitHub

Showing 3 of 3 total issues

Method join has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def join(other, on:)
      raise CSVError, "No such column '#{on}' in source" unless headers.include? on
      raise CSVError, "No such column '#{on}' in other" unless other.headers.include? on
      raise CSVError, "source[#{on}] is not unique" unless by_col[on].uniq?
      raise CSVError, "other[#{on}] is not unique" unless other.by_col[on].uniq?
Severity: Minor
Found in lib/datamix/refinements/csv_table.rb - About 3 hrs 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 resample has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def resample(chunk_range, seed: nil)
      generator = seed ? Random.new(seed) : Random.new

      # Save min value, we will adjust the result to it later
      min_value = min
Severity: Minor
Found in lib/datamix/refinements/array.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 math_operation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def math_operation(other)
      copy = dup
      if other.respond_to? :each
        each_with_index do |val, index|
          copy[index] = other[index] ? yield(val, other[index]) : nil
Severity: Minor
Found in lib/datamix/refinements/array.rb - About 45 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

Severity
Category
Status
Source
Language