Showing 388 of 406 total issues

Class RDocVisitor has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  class RDocVisitor < Prism::Visitor # :nodoc:
    def initialize(scanner, top_level, store)
      @scanner = scanner
      @top_level = top_level
      @store = store
Severity: Minor
Found in lib/rdoc/parser/prism_ruby.rb - About 2 hrs to fix

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

      def marshal_dump # :nodoc:
        attrs = attributes.sort.map do |attr|
          next unless attr.display?
          [ attr.name, attr.rw,
            attr.visibility, attr.singleton, attr.file_name,
    Severity: Minor
    Found in lib/rdoc/code_object/class_module.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 scan has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def scan
        reset
    
        catch :eof do
          begin
    Severity: Minor
    Found in lib/rdoc/parser/ruby.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 parse_meta_method_params has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def parse_meta_method_params container, single, meth, tk, comment # :nodoc:
        token_listener meth do
          meth.params = ''
    
          look_for_directives_in meth, comment
    Severity: Minor
    Found in lib/rdoc/parser/ruby.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 tokenize has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def tokenize input
        setup_scanner input
    
        until @s.eos? do
          pos = @s.pos
    Severity: Major
    Found in lib/rdoc/markup/parser.rb - About 2 hrs to fix

      File stats.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class RDoc::Stats
      
        include RDoc::Text
      
        ##
      Severity: Minor
      Found in lib/rdoc/stats.rb - About 2 hrs to fix

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

        class RDoc::Markup::ToRdoc < RDoc::Markup::Formatter
        
          ##
          # Current indent amount for output in characters
        
        
        Severity: Minor
        Found in lib/rdoc/markup/to_rdoc.rb - About 2 hrs to fix

          Method rb_scan_args has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def rb_scan_args method_body
              method_body =~ /rb_scan_args\((.*?)\)/m
              return '(*args)' unless $1
          
              $1.split(/,/)[2] =~ /"(.*?)"/ # format argument
          Severity: Major
          Found in lib/rdoc/parser/c.rb - About 2 hrs to fix

            Method wrap has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def wrap(txt, line_len = 76)
                res = []
                sp = 0
                ep = txt.length
            
            
            Severity: Minor
            Found in lib/rdoc/text.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 add_module_or_class has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def add_module_or_class(module_name, start_line, end_line, is_class: false, superclass_name: nil)
                comment = consecutive_comment(start_line)
                handle_consecutive_comment_directive(@container, comment)
                return unless @container.document_children
            
            
            Severity: Minor
            Found in lib/rdoc/parser/prism_ruby.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 rb_scan_args has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def rb_scan_args method_body
                method_body =~ /rb_scan_args\((.*?)\)/m
                return '(*args)' unless $1
            
                $1.split(/,/)[2] =~ /"(.*?)"/ # format argument
            Severity: Minor
            Found in lib/rdoc/parser/c.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 parse_method_name_singleton has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def parse_method_name_singleton container, name_t # :nodoc:
                skip_tkspace
                name_t2 = get_tk
            
                if (:on_kw == name_t[:kind] && 'self' == name_t[:text]) || (:on_op == name_t[:kind] && '%' == name_t[:text]) then
            Severity: Minor
            Found in lib/rdoc/parser/ruby.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 parse_entries has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def parse_entries
                @time_cache ||= {}
            
                if /\A((?:.*\n){,3})commit\s/ =~ @content
                  class << self; prepend Git; end
            Severity: Minor
            Found in lib/rdoc/parser/changelog.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 for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.for top_level, content, options, stats
                file_name = top_level.absolute_name
                return if binary? file_name
            
                parser = use_markup content
            Severity: Minor
            Found in lib/rdoc/parser.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 resolve has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def resolve name, text
                return @seen[name] if @seen.include? name
            
                ref = case name
                      when /^\\(#{CLASS_REGEXP_STR})$/o then
            Severity: Minor
            Found in lib/rdoc/cross_reference.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 visibility_method_arguments has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def visibility_method_arguments(call_node, singleton:)
                  arguments_node = call_node.arguments
                  return unless arguments_node
                  symbols = symbol_arguments(call_node)
                  if symbols
            Severity: Minor
            Found in lib/rdoc/parser/prism_ruby.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 link has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              def link name, text, code = true
                if !(name.end_with?('+@', '-@')) and name =~ /(.*[^#:])?@/
                  name = $1
                  label = $'
                end
            Severity: Minor
            Found in lib/rdoc/markup/to_html_crossref.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 RDoc has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class RDoc::RDoc
            
              @current = nil
            
              ##
            Severity: Minor
            Found in lib/rdoc/rdoc.rb - About 2 hrs to fix

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

                def add_method method
                  return method unless @document_self
              
                  # HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)
                  key = method.pretty_name
              Severity: Minor
              Found in lib/rdoc/code_object/context.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 parse_file has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                def parse_file filename
                  encoding = @options.encoding
                  filename = filename.encode encoding
              
                  @stats.add_file filename
              Severity: Minor
              Found in lib/rdoc/rdoc.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

              Severity
              Category
              Status
              Source
              Language