openjaf/cenit

View on GitHub
app/models/setup/cross_collection_pull_parameter.rb

Summary

Maintainability
C
1 day
Test Coverage

Method process_on has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

    def process_on(hash_data, options = {})
      options ||= {}
      errors.clear
      properties_locations.each do |property_location|
        property_location.errors.clear
Severity: Minor
Found in app/models/setup/cross_collection_pull_parameter.rb - About 6 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 schema has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def schema
      # TODO: Factorize code with algorithms and applications parameters
      sch =
        if type.blank?
          {}
Severity: Minor
Found in app/models/setup/cross_collection_pull_parameter.rb - About 1 hr 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 process_on has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def process_on(hash_data, options = {})
      options ||= {}
      errors.clear
      properties_locations.each do |property_location|
        property_location.errors.clear
Severity: Minor
Found in app/models/setup/cross_collection_pull_parameter.rb - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

                    if (value = options[:value]).nil?
                      obj.delete(property_name) unless options[:keep_values]
                    else
                      obj[property_name] = value
                    end
    Severity: Major
    Found in app/models/setup/cross_collection_pull_parameter.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status