rcarver/orel

View on GitHub

Showing 18 of 18 total issues

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

    def read
      if @options.batch_size.nil?
        return @reader.read @options.description
      end

Severity: Minor
Found in lib/orel/query_reader.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 []= has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def []=(key, value)
      raise Orel::ReadonlyError if @readonly

      if key.is_a?(Orel::Relation)
        klass = key
Severity: Minor
Found in lib/orel/attributes.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 find_by_key has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def find_by_key(key_name, *args)
      key = @heading.get_key(key_name) or raise ArgumentError, "Key #{key_name.inspect} does not exist"

      if args.first.is_a?(Hash)
        raise ArgumentError, "Extraneous args to #find_by_key: #{args.inspect}" if args.size > 1
Severity: Minor
Found in lib/orel/finder.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 read has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def read
      if @options.batch_size.nil?
        return @reader.read @options.description
      end

Severity: Minor
Found in lib/orel/query_reader.rb - About 1 hr to fix

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

        def get(name)
          unless @associations[name]
            # If a lock is set on this object, disallow any new relationships
            # to be instanciated.
            raise Orel::LockedForQueryError if @locked_for_query
    Severity: Minor
    Found in lib/orel/simple_associations.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 extract_objects_with_joins has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def extract_objects_with_joins(projected_joins, rows)
            objects = []
            objects_hash = {}
            rows.each(:as => :hash) { |row|
    
    
    Severity: Minor
    Found in lib/orel/query/reader.rb - About 1 hr to fix

      Method _apply! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def _apply!
              # Get the source of the block as a string and split it into a series of identifiers.
              source = @block.to_source(:strip_enclosure => true)
              source.gsub!(@syntax[0], '')
              identifiers = source.split(@syntax[1])
      Severity: Minor
      Found in lib/orel/relation/key_dsl.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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def initialize(join_id, klass, heading, table, join_class, join_heading, join_table)
      Severity: Major
      Found in lib/orel/query.rb - About 50 mins to fix

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

              def create_foreign_key_relationship!
                # Default on_delete to restrict.
                unless @on_delete
                  @on_delete = Orel::Relation::Cascade::RESTRICT
                end
        Severity: Minor
        Found in lib/orel/relation/reference.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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(klass, heading, connection, query, select_manager, description)
        Severity: Minor
        Found in lib/orel/query/reader.rb - About 45 mins to fix

          Method initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def initialize(parent_class, parent_heading_name, parent_key_name, child_class, child_heading_name, child_key_name)
          Severity: Minor
          Found in lib/orel/relation/reference.rb - About 45 mins to fix

            Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def initialize(parent_table, parent_attributes, child_table, child_attributes, cascade)
            Severity: Minor
            Found in lib/orel/schema_generator.rb - About 35 mins to fix

              Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def initialize(klass, set, namer, child_name=nil, &block)
              Severity: Minor
              Found in lib/orel/relation/heading_dsl.rb - About 35 mins to fix

                Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def initialize(options, reader, heading, manager, table)
                Severity: Minor
                Found in lib/orel/query_reader.rb - About 35 mins to fix

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

                        def extract_objects_with_joins(projected_joins, rows)
                          objects = []
                          objects_hash = {}
                          rows.each(:as => :hash) { |row|
                  
                  
                  Severity: Minor
                  Found in lib/orel/query/reader.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 valid? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def valid?
                        @errors = new_errors
                        @heading.attributes.each { |attribute|
                          unless @object.persisted?
                            next if attribute.domain.is_a?(Orel::Domains::Serial)
                  Severity: Minor
                  Found in lib/orel/validator.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 [] has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def [](key)
                          case key
                          when Class
                            klass = key
                            heading = key.get_heading
                  Severity: Minor
                  Found in lib/orel/query.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 find_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def find_options(klass)
                        options = {}
                        # klass.parents is provided by ActiveSupport.
                        hierarchy = ([klass] + klass.parents).reverse
                        hierarchy.each { |k|
                  Severity: Minor
                  Found in lib/orel/options.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