autotelik/datashift

View on GitHub
lib/datashift/binder.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method map_inbound_headers has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
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)
Severity: Minor
Found in lib/datashift/binder.rb - About 4 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 map_inbound_headers has 47 lines of code (exceeds 25 allowed). Consider refactoring.
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)
Severity: Minor
Found in lib/datashift/binder.rb - About 1 hr to fix

    Block has too many lines. [41/25]
    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}")
    Severity: Minor
    Found in lib/datashift/binder.rb by rubocop

    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

        # TODO: - check out regexp to do this work better plus Inflections ??
    Severity: Minor
    Found in lib/datashift/binder.rb by fixme

    There are no issues that match your filters.

    Category
    Status