rom-rb/rom-repository

View on GitHub

Showing 17 of 23 total issues

Method combine has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

        def combine(*args)
          options = args[0].is_a?(Hash) ? args[0] : args

          combine_opts = Hash.new { |h, k| h[k] = {} }

Severity: Minor
Found in lib/rom/repository/relation_proxy/combine.rb - About 2 hrs 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 visit_relation has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

      def visit_relation(node, parent_relation = nil)
        name, meta, header = node
        other = visit(header, name)

        if type
Severity: Minor
Found in lib/rom/repository/command_compiler.rb - About 2 hrs 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

Class RelationProxy has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class RelationProxy
      extend Initializer
      extend Dry::Core::Deprecations[:rom]

      include Relation::Materializable
Severity: Minor
Found in lib/rom/repository/relation_proxy.rb - About 2 hrs to fix

    Method changeset has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def changeset(*args)
          opts = { command_compiler: command_compiler }
    
          if args.size == 2
            name, data = args
    Severity: Minor
    Found in lib/rom/repository.rb - About 2 hrs 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 combine has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def combine(*args)
              options = args[0].is_a?(Hash) ? args[0] : args
    
              combine_opts = Hash.new { |h, k| h[k] = {} }
    
    
    Severity: Minor
    Found in lib/rom/repository/relation_proxy/combine.rb - About 1 hr to fix

      Method visit_relation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def visit_relation(node, parent_relation = nil)
              name, meta, header = node
              other = visit(header, name)
      
              if type
      Severity: Minor
      Found in lib/rom/repository/command_compiler.rb - About 1 hr to fix

        Method node has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def node(name, &block)
                if name.is_a?(Symbol) && !nodes.map { |n| n.name.relation }.include?(name)
                  raise ArgumentError, "#{name.inspect} is not a valid aggregate node name"
                end
        
        
        Severity: Minor
        Found in lib/rom/repository/relation_proxy.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 changeset has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def changeset(*args)
              opts = { command_compiler: command_compiler }
        
              if args.size == 2
                name, data = args
        Severity: Minor
        Found in lib/rom/repository.rb - About 1 hr to fix

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

                def visit_relation(node)
                  relation_name, meta, header = node
                  name = meta[:combine_name] || relation_name
          
                  model = meta.fetch(:model) do
          Severity: Minor
          Found in lib/rom/repository/header_builder.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 compose has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def compose(other, use_for_diff: other.is_a?(Pipe) ? other.use_for_diff : false)
                  new_proc = processor ? processor >> other : other
          
                  if use_for_diff
                    diff_proc = diff_processor ? diff_processor >> other : other
          Severity: Minor
          Found in lib/rom/repository/changeset/pipe.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 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def initialize(id, adapter, container, registry, plugins, options)
          Severity: Minor
          Found in lib/rom/repository/command_compiler.rb - About 45 mins to fix

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

                  def commands(*names, mapper: nil, use: nil, **opts)
                    if names.any? || opts.any?
                      @commands = names + opts.to_a
            
                      @commands.each do |spec|
            Severity: Minor
            Found in lib/rom/repository/class_interface.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 define_restricted_command_method has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def define_restricted_command_method(type, views, **opts)
                    views.each do |view_name|
                      meth_name = views.size > 1 ? :"#{type}_#{view_name}" : type
            
                      define_method(meth_name) do |*args|
            Severity: Minor
            Found in lib/rom/repository/class_interface.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 setup_associates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def setup_associates(klass, relation, meta, parent_relation)
                    assoc_name =
                      if relation.associations.key?(parent_relation)
                        parent_relation
                      else
            Severity: Minor
            Found in lib/rom/repository/command_compiler.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 compile_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def compile_command(*args, mapper: nil, use: nil, **opts)
                  type, name = args + opts.to_a.flatten(1)
            
                  relation = name.is_a?(Symbol) ? relations[name] : name
            
            
            Severity: Minor
            Found in lib/rom/repository.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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def method_missing(meth, *args, &block)
                    if relation.respond_to?(meth)
                      result = relation.__send__(meth, *args, &block)
            
                      if result.kind_of?(Relation::Materializable) && !result.is_a?(Relation::Loaded)
            Severity: Minor
            Found in lib/rom/repository/relation_proxy.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 extend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def extend(*steps, use_for_diff: false, **opts, &block)
                    options = { use_for_diff: use_for_diff, **opts }
            
                    if block
                      if steps.size > 0
            Severity: Minor
            Found in lib/rom/repository/changeset/stateful.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