Showing 388 of 394 total issues

Class has too many lines. [196/150]
Open

    class AttributeDSL
      include ModelDSL

      attr_reader :attributes, :options, :copy_keys, :symbolize_keys, :reject_keys, :steps

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [192/150]
Open

  class Relation
    # Default no-op output schema which is called in `Relation#each`
    NOOP_OUTPUT_SCHEMA = -> tuple { tuple }.freeze

    extend Initializer
Severity: Minor
Found in core/lib/rom/relation.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [192/150]
Open

  class Schema
    include Memoizable

    extend Notifications::Listener

Severity: Minor
Found in core/lib/rom/schema.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Class has too many lines. [188/150]
Open

    class Transproc < Processor
      include ::Transproc::Composer

      module Functions
        extend ::Transproc::Registry
Severity: Minor
Found in core/lib/rom/processor/transproc.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Module has too many lines. [135/100]
Open

    module ClassInterface
      extend Notifications::Listener

      subscribe('configuration.relations.object.registered') do |event|
        relation = event[:relation]

This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for run! is too high. [35.75/20]
Open

      def run!
        commands = @command_classes.map do |klass|
          relation = @relations[klass.relation]
          gateway = @gateways[relation.gateway]

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for call is too high. [34.84/20]
Open

    def call(*args, &block)
      tuples =
        if hooks?
          prepared =
            if curried?
Severity: Minor
Found in core/lib/rom/command.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for call is too high. [33.62/20]
Open

        def call(*args)
          first = args.first
          last = args.last
          size = args.size

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for register_command is too high. [32.31/20]
Open

    def register_command(rel_name, type, rel_meta, parent_relation = nil)
      relation = relations[rel_name]

      type.create_class(rel_name, type) do |klass|
        klass.result(rel_meta.fetch(:combine_type, result))
Severity: Minor
Found in core/lib/rom/command_compiler.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for visit_relation is too high. [32.95/20]
Open

    def visit_relation(node, parent_relation = nil)
      name, header, meta = node
      other = header.map { |attr| visit(attr, name) }.compact

      if type
Severity: Minor
Found in core/lib/rom/command_compiler.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Class Transproc has 26 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Transproc < Processor
      include ::Transproc::Composer

      module Functions
        extend ::Transproc::Registry
Severity: Minor
Found in core/lib/rom/processor/transproc.rb - About 3 hrs to fix

    Assignment Branch Condition size for build_relation is too high. [31.59/20]
    Open

          def build_relation(klass, registry)
            # TODO: raise a meaningful error here and add spec covering the case
            #       where klass' gateway points to non-existant repo
            gateway = @gateways.fetch(klass.gateway)
    
    

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for view is too high. [30.82/20]
    Open

          def view(*args, &block)
            if args.size == 1 && block.arity > 0
              raise ArgumentError, "schema attribute names must be provided as the second argument"
            end
    
    

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [31/22]
    Open

        def visit_relation(node, parent_relation = nil)
          name, header, meta = node
          other = header.map { |attr| visit(attr, name) }.compact
    
          if type
    Severity: Minor
    Found in core/lib/rom/command_compiler.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for call is too high. [28.81/20]
    Open

          def call(*args)
            response = left.call(*args)
    
            if response.nil? || (many? && response.size == 0)
              return one? ? nil : EMPTY_ARRAY
    Severity: Minor
    Found in core/lib/rom/commands/composite.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def call(*args, &block)
          tuples =
            if hooks?
              prepared =
                if curried?
    Severity: Minor
    Found in core/lib/rom/command.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 has too many lines. [28/22]
    Open

          def view(*args, &block)
            if args.size == 1 && block.arity > 0
              raise ArgumentError, "schema attribute names must be provided as the second argument"
            end
    
    

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for node is too high. [26.02/20]
    Open

          def node(name, &block)
            if name.is_a?(Symbol) && !nodes.map { |n| n.name.key }.include?(name)
              raise ArgumentError, "#{name.inspect} is not a valid aggregate node name"
            end
    
    
    Severity: Minor
    Found in core/lib/rom/relation/combined.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [28/22]
    Open

        def call(*args, &block)
          tuples =
            if hooks?
              prepared =
                if curried?
    Severity: Minor
    Found in core/lib/rom/command.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Perceived complexity for call is too high. [13/7]
    Open

        def call(*args, &block)
          tuples =
            if hooks?
              prepared =
                if curried?
    Severity: Minor
    Found in core/lib/rom/command.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points
    Severity
    Category
    Status
    Source
    Language