athityakumar/daru-io

View on GitHub

Showing 7 of 7 total issues

Method process_dataframe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

        def process_dataframe
          [].tap do |result|
            result << @dataframe.vectors.to_a unless @headers == false
            @dataframe.map_rows do |row|
              next result << row.to_a unless @convert_comma
Severity: Minor
Found in lib/daru/io/exporters/csv.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 deep_merge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def deep_merge(source, dest)
          return source if dest.nil?
          return dest if source.nil?

          return dest | source if both_are?(Array, source, dest)
Severity: Minor
Found in lib/daru/io/exporters/json.rb - About 55 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 init_hash_rec has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def init_hash_rec(jsonpaths, hash, jsonpath_key, row, idx)
Severity: Minor
Found in lib/daru/io/exporters/json.rb - About 35 mins to fix

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

            def hash_with_headers
              ::CSV
                .parse(@file_data, @options)
                .tap { |c| yield c if block_given? }
                .by_col
    Severity: Minor
    Found in lib/daru/io/importers/csv.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 init_opts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def init_opts(headers: nil, skiprows: 0, compression: :infer,
              clone: nil, index: nil, order: nil, name: nil, **options)
              @headers      = headers
              @skiprows     = skiprows
              @compression  = compression
    Severity: Minor
    Found in lib/daru/io/importers/csv.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 init_hash_rec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def init_hash_rec(jsonpaths, hash, jsonpath_key, row, idx)
              key = handle_dynamic_keys(jsonpaths[0], idx, row)
              if jsonpaths.count == 1
                hash[key] = jsonpath_key == :index ? idx : row[jsonpath_key]
              else
    Severity: Minor
    Found in lib/daru/io/exporters/json.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 choose_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def choose_keys(*keys)
              return keys.to_a unless keys.empty?
    
              cursor = nil
              # Loop to iterate through paginated results of Redis#scan.
    Severity: Minor
    Found in lib/daru/io/importers/redis.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

    Severity
    Category
    Status
    Source
    Language