fredwu/datamappify

View on GitHub

Showing 4 of 6 total issues

Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

            def initialize(source_class, entity, attributes, options = {}, &block)
Severity: Minor
Found in lib/datamappify/data/criteria/relational/concerns/find_by_key.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

              def initialize(source_class, entity, attributes, options = {}, &block)
    Severity: Minor
    Found in lib/datamappify/data/criteria/relational/save_by_key.rb - About 35 mins to fix

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

                def perform_write
                  referenced_entities.each do |entity|
                    if entity.destroy?
                      if entity.persisted?
                        @repository.destroy!(entity)
      Severity: Minor
      Found in lib/datamappify/repository/query_method/method/reference_handler.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 records_scope has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

                def records_scope(scope = nil)
                  secondaries.inject(scope || source_class) do |scope, secondary|
                    join_condition = if secondary.options[:via]
                      { :id => secondary.options[:via] }
                    else
      Severity: Minor
      Found in lib/datamappify/data/criteria/sequel/criteria_method.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