thombruce/activerecord-chemistry

View on GitHub

Showing 4 of 11 total issues

Method represents has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def represents(name, scope = nil, options = {})
            if Hash === scope
              options = scope
              scope = nil
            end
Severity: Minor
Found in lib/activerecord/chemistry/representable/relation.rb - About 35 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 representable_must_be_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def representable_must_be_valid
          unless representing.valid?
            representing.errors.each do |attribute, message|
              errors.add(attribute, message) unless errors[attribute].include?(message)
            end
Severity: Minor
Found in lib/activerecord/chemistry/representable/instance_methods.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 actable_must_be_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def actable_must_be_valid
          unless acting_as.valid?
            acting_as.errors.each do |attribute, message|
              errors.add(attribute, message) unless errors[attribute].include?(message)
            end
Severity: Minor
Found in lib/activerecord/chemistry/actable/instance_methods.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 extendable_must_be_valid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def extendable_must_be_valid
          unless extendable.valid?
            extendable.errors.each do |attribute, message|
              errors.add(attribute, message) unless errors[attribute].include?(message)
            end
Severity: Minor
Found in lib/activerecord/chemistry/extendable/instance_methods.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