YorickPeterse/ruby-lint

View on GitHub

Showing 78 of 2,162 total issues

Method after_send has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def after_send(node)
      receiver, name, _ = *node

      receiver    = unpack_block(receiver)
      name        = name.to_s
Severity: Minor
Found in lib/ruby-lint/virtual_machine.rb - About 1 hr to fix

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

        def after_send(node)
          receiver, name, _ = *node
    
          receiver    = unpack_block(receiver)
          name        = name.to_s
    Severity: Minor
    Found in lib/ruby-lint/virtual_machine.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 lookup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def lookup(type, name, lookup_parent = true, exclude = [])
            type, name = prepare_lookup(type, name)
            found      = nil
    
            if defines?(type, name)
    Severity: Minor
    Found in lib/ruby-lint/definition/ruby_object.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 inspect_constants has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def inspect_constants(source = constant, ignore = [])
          names          = []
          source_name    = source.name
          have_children  = []
          include_source = source != Object
    Severity: Minor
    Found in lib/ruby-lint/inspector.rb - About 1 hr to fix

      Method generate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def generate
            constants = inspector.inspect_constants(
              inspector.constant,
              options[:ignore].dup
            )
      Severity: Minor
      Found in lib/ruby-lint/definition_generator.rb - About 1 hr to fix

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

              def has_definition?(type, name, exclude = [])
                type, name = prepare_lookup(type, name)
        
                if definitions.key?(type) and definitions[type].key?(name)
                  return true
        Severity: Minor
        Found in lib/ruby-lint/definition/ruby_object.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse(comments)
                tags = []
        
                comments.each do |comment|
                  comment = comment.gsub(COMMENT_REGEXP, '').strip
        Severity: Minor
        Found in lib/ruby-lint/docstring/parser.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 iterate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def iterate(node)
              return unless node.is_a?(AST::Node)
        
              before    = :"on_#{node.type}"
              after     = :"after_#{node.type}"
        Severity: Minor
        Found in lib/ruby-lint/iterator.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(options = {})
              @debug = false
        
              options.each do |key, value|
                setter = "#{key}="
        Severity: Minor
        Found in lib/ruby-lint/configuration.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 generate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def generate
              constants = inspector.inspect_constants(
                inspector.constant,
                options[:ignore].dup
              )
        Severity: Minor
        Found in lib/ruby-lint/definition_generator.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(options = {})
                @inherit_self = true
        
                options.each do |key, value|
                  instance_variable_set("@#{key}", value)
        Severity: Minor
        Found in lib/ruby-lint/definition/ruby_object.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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def resolve(scope)
              current = scope
        
              constant_segments.each_with_index do |(type, name), index|
                type  = REMAP_TYPES.fetch(type, type)
        Severity: Minor
        Found in lib/ruby-lint/constant_path.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 load has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def load(constant)
                return if include?(constant)
        
                filename = file_for_constant(constant)
        
        
        Severity: Minor
        Found in lib/ruby-lint/definition/registry.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 on_send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def on_send(node)
                receiver, name, _  = *node
        
                receiver = unpack_block(receiver)
                name     = name.to_s
        Severity: Minor
        Found in lib/ruby-lint/analysis/undefined_methods.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 execute_callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def execute_callback(name, *args)
              return unless respond_to?(name)
        
              unless arity_cache.key?(name)
                arity_cache[name] = method(name).arity
        Severity: Minor
        Found in lib/ruby-lint/iterator.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 assign_variable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def assign_variable(type, name, value, node)
              scope    = assignment_scope(type)
              variable = scope.lookup(type, name)
        
              # If there's already a variable we'll just update it.
        Severity: Minor
        Found in lib/ruby-lint/virtual_machine.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 push_variable_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def push_variable_value(node)
              return if value_stack.empty? || @ignored_nodes.include?(node)
        
              definition = definition_for_node(node)
        
        
        Severity: Minor
        Found in lib/ruby-lint/virtual_machine.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 determine_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def determine_parent(parent, type, name, exclude = [])
                if parent.type == type and parent.name == name
                  parent_definition = parent
                else
                  exclude = exclude + [self] unless exclude.include?(self)
        Severity: Minor
        Found in lib/ruby-lint/definition/ruby_object.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