autotelik/datashift

View on GitHub
lib/datashift/populators/has_many.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Method call has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

      def self.call(load_object, value, method_binding)

        # there are times when we need to save early, for example before assigning to
        # has_and_belongs_to associations which require the load_object has an id for the join table

Severity: Minor
Found in lib/datashift/populators/has_many.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 call has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.call(load_object, value, method_binding)

        # there are times when we need to save early, for example before assigning to
        # has_and_belongs_to associations which require the load_object has an id for the join table

Severity: Minor
Found in lib/datashift/populators/has_many.rb - About 1 hr to fix

    Assignment Branch Condition size for call is too high. [61.85/60]
    Open

          def self.call(load_object, value, method_binding)
    
            # there are times when we need to save early, for example before assigning to
            # has_and_belongs_to associations which require the load_object has an id for the join table
    
    

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Block has too many lines. [29/25]
    Open

            columns.each do |col_str|
              # split into usable parts ; size:large or colour:red,green,blue
              field, find_by_values = Querying.where_field_and_values(method_binding, col_str )
    
              raise "Cannot perform DB find by #{field}. Expected format key:value" unless field && find_by_values

    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: some way to define if this is a fatal error or not ?
    Severity: Minor
    Found in lib/datashift/populators/has_many.rb by fixme

    There are no issues that match your filters.

    Category
    Status