PuzzleFlow/activerecord-postgres-composite-types

View on GitHub

Showing 7 of 7 total issues

Method parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

          def parse
            return @result if @result
            values = []
            skip(OPEN_PAREN)
            if skip(CLOSE_PAREN)
Severity: Minor
Found in lib/activerecord-postgres-composite-types/composite_type_parser.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 composite_type_to_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def self.composite_type_to_string(object, adapter)
        quoted_values = object.class.columns.collect do |column|
          value = object.send(column.name)
          if String === value
            if value == "NULL"
Severity: Minor
Found in lib/activerecord-postgres-composite-types/active_record_3_2.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 composite_type_to_string has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def self.composite_type_to_string(object, adapter)
        quoted_values = object.class.columns.collect do |column|
          value = object.send(column.name)
          if String === value
            if value == "NULL"
Severity: Minor
Found in lib/activerecord-postgres-composite-types/active_record_4_1.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 type_cast_for_database has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

                    def type_cast_for_database(object)
                        return object if object.is_a?(String) # already quoted by AREL visitor
                        return nil if object == nil
                        quoted_values = object.class.columns.collect do |column|
                            value = object.send(column.name)
Severity: Minor
Found in lib/activerecord-postgres-composite-types/oid/composite_type_4_2.rb - About 55 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 type_cast_attribute_for_write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def type_cast_attribute_for_write(column, value)
        if column && !value.nil? && (klass = column.composite_type_class)
          # Cast Hash and Array to composite type klass
          if value.is_a?(klass)
            value
Severity: Minor
Found in lib/activerecord-postgres-composite-types/active_record_3_2.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 type_cast_composite_type_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.type_cast_composite_type_field(klass, i, value)
        klass.initialize_column_definition

        column = klass.columns[i]
        raise "Invalid column index: #{i}" unless column
Severity: Minor
Found in lib/activerecord-postgres-composite-types/active_record.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 type_cast_field_from_user has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def type_cast_field_from_user(column, value)
            klass = column.composite_type_class
            if klass
                case value
                    when Hash, Array
Severity: Minor
Found in lib/postgres_composite_type.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