lib/datashift/binder.rb
Method map_inbound_headers
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
Open
def map_inbound_headers(klass, columns)
# If klass not in Dictionary yet, add to dictionary all possible operators on klass
# which can be used to map headers and populate an object of type klass
model_methods_collection = ModelMethods::Manager.catalog_class(klass)
- Read upRead up
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 map_inbound_headers
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def map_inbound_headers(klass, columns)
# If klass not in Dictionary yet, add to dictionary all possible operators on klass
# which can be used to map headers and populate an object of type klass
model_methods_collection = ModelMethods::Manager.catalog_class(klass)
Block has too many lines. [41/25] Open
Open
[*columns].each_with_index do |col_data, col_index|
raw_col_data = col_data.to_s.strip
if raw_col_data.nil? || raw_col_data.empty?
logger.warn("Column list contains empty or null header at index #{col_index}")
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.
TODO found Open
Open
# TODO: - check out regexp to do this work better plus Inflections ??
- Exclude checks