Method process_dataframe
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
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
Method deep_merge
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
def deep_merge(source, dest)
return source if dest.nil?
return dest if source.nil?
return dest | source if both_are?(Array, source, dest)
Method init_hash_rec
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def init_hash_rec(jsonpaths, hash, jsonpath_key, row, idx)
Method init_hash_rec
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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
Method init_opts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def init_opts(headers: nil, skiprows: 0, compression: :infer,
clone: nil, index: nil, order: nil, name: nil, **options)
@headers = headers
@skiprows = skiprows
@compression = compression
Method choose_keys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def choose_keys(*keys)
return keys.to_a unless keys.empty?
cursor = nil
Method hash_with_headers
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def hash_with_headers
::CSV
.parse(@file_data, @options)
.tap { |c| yield c if block_given? }
.by_col