slowjack2k/activerecord_to_poro

View on GitHub

Showing 3 of 3 total issues

Method load_result_source= has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def load_result_source=(new_load_result)
      unless new_load_result.instance_methods.include?(:_metadata)
        new_load_result.send(:include, MetadataEnabled)
      end

Severity: Minor
Found in lib/activerecord_to_poro/object_mapper.rb - About 45 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 as_scope_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def as_scope_hash
      result = column.nil? ? {} : {column => value}
      result[:lock_version] = lock_version unless lock_version.nil?

      result
Severity: Minor
Found in lib/activerecord_to_poro/metadata.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 association_rule has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def association_rule(to: nil,
        from: to,
        reverse_to: from,
        reverse_from: to,
        converter: nil,
Severity: Minor
Found in lib/activerecord_to_poro/mapper_extension.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