jsonb-uy/rotulus

View on GitHub

Showing 6 of 6 total issues

Class Column has 27 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Column
    attr_reader :model, :name, :direction, :nulls

    # Creates a Column object representing a table column in the "ORDER BY" expression.
    #
Severity: Minor
Found in lib/rotulus/column.rb - About 3 hrs to fix

    Class Page has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Page
        attr_reader :ar_relation, :order, :limit, :cursor
    
        delegate :columns, :state, to: :order, prefix: true
    
    
    Severity: Minor
    Found in lib/rotulus/page.rb - About 2 hrs to fix

      Method normalize_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def normalize_values(values)
            values.transform_values! do |v|
              v = v.utc if v.respond_to?(:utc)
              if v.respond_to?(:iso8601)
                v = v.method(:iso8601).arity.zero? ? v.iso8601 : v.iso8601(6)
      Severity: Minor
      Found in lib/rotulus/record.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 normalize_value has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def normalize_value(value)
            return '<NULL>' if value.nil?
            return "'#{value}'" if value.blank? && value.is_a?(String)
      
            value = if Rotulus.db.name == 'sqlite'
      Severity: Minor
      Found in lib/rotulus/page_tableizer.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 column_model has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def column_model(model_override, name)
            prefix = name.match(/^.*?(?=\.)/).to_s
            unprefixed_name = name.split('.').last
      
            unless model_override.nil?
      Severity: Minor
      Found in lib/rotulus/order.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 for_page_and_token! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def for_page_and_token!(page, token)
              data = decode(token)
              reference_record = Record.new(page, data['f'])
              direction = data['d']
              created_at = Time.at(data['c']).utc
      Severity: Minor
      Found in lib/rotulus/cursor.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

      Severity
      Category
      Status
      Source
      Language