Showing 372 of 392 total issues

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 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 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 for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.for top_level, file_name, content, options, stats
            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 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_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 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 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

          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/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 merge has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def merge class_module
              @parent      = class_module.parent
              @parent_name = class_module.parent_name
          
              other_document = parse class_module.comment_location
          Severity: Minor
          Found in lib/rdoc/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 read_directive has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def read_directive allowed
              tokens = []
          
              while tk = get_tk do
                tokens << tk
          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 interactive has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def interactive
              puts "\nEnter the method name you want to look up."
          
              begin
                require 'readline'
          Severity: Minor
          Found in lib/rdoc/ri/driver.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 signature has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.signature comment
              return unless comment.tomdoc?
          
              document = comment.parse
          
          
          Severity: Minor
          Found in lib/rdoc/tom_doc.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 convert_attrs_word_pair_map has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

            def convert_attrs_word_pair_map(str, attrs, exclusive)
              # then non-matching
              unless @word_pair_map.empty? then
                @word_pair_map.each do |regexp, attr|
                  next unless exclusive == exclusive?(attr)
          Severity: Minor
          Found in lib/rdoc/markup/attribute_manager.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 merge has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def merge class_module
              @parent      = class_module.parent
              @parent_name = class_module.parent_name
          
              other_document = parse class_module.comment_location
          Severity: Major
          Found in lib/rdoc/class_module.rb - About 2 hrs to fix

            Method find_body has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def find_body class_name, meth_name, meth_obj, file_content, quiet = false
                if file_content
                  @body_table ||= {}
                  @body_table[file_content] ||= gen_body_table file_content
                  type, *args = @body_table[file_content][meth_name]
            Severity: Major
            Found in lib/rdoc/parser/c.rb - About 2 hrs to fix
              Severity
              Category
              Status
              Source
              Language