Showing 387 of 405 total issues

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

  def build_paragraph margin
    p :paragraph_start => margin if @debug

    paragraph = RDoc::Markup::Paragraph.new

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 handle_directive has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def handle_directive prefix, directive, param, code_object = nil,
                       encoding = nil, line = nil
    blankline = "#{prefix.strip}\n"
    directive = directive.downcase

Severity: Major
Found in lib/rdoc/markup/pre_process.rb - About 2 hrs to fix

    Class CodeObject has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

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

      Method get_included_module_with_optional_parens has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def get_included_module_with_optional_parens
          skip_tkspace_without_nl
          get_tkread
          tk = get_tk
          end_token = get_end_token tk
      Severity: Major
      Found in lib/rdoc/parser/ruby.rb - About 2 hrs to fix

        Method add_attribute has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          def add_attribute attribute
            return attribute unless @document_self
        
            # mainly to check for redefinition of an attribute as a method
            # TODO find a policy for 'attr_reader :foo' + 'def foo=()'
        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 process_args has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.process_args argv
            options = default_options
        
            opts = OptionParser.new do |opt|
              opt.program_name = File.basename $0
        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 tokenize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          def tokenize input
            setup_scanner input
        
            until @s.eos? do
              pos = @s.pos
        Severity: Minor
        Found in lib/rdoc/markup/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 build_verbatim has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def build_verbatim margin
            p :verbatim_begin => margin if @debug
            verbatim = RDoc::Markup::Verbatim.new
        
            min_indent = nil
        Severity: Major
        Found in lib/rdoc/markup/parser.rb - About 2 hrs to fix

          Class Options has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class RDoc::Options
          
            ##
            # The deprecated options.
          
          
          Severity: Minor
          Found in lib/rdoc/options.rb - About 2 hrs to fix

            Method marshal_load has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def marshal_load array # :nodoc:
                initialize_visibility
                initialize_methods_etc
                @current_section   = nil
                @document_self     = true
            Severity: Major
            Found in lib/rdoc/code_object/class_module.rb - About 2 hrs to fix

              Method find_symbol_module has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                def find_symbol_module(symbol)
                  result = nil
              
                  # look for a class or module 'symbol'
                  case symbol
              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 collect_first_comment has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                def collect_first_comment
                  skip_tkspace
                  comment = ''.dup
                  comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding
                  first_line = true
              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 find_body has a Cognitive Complexity of 19 (exceeds 5 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: 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 prepare_comments has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                def prepare_comments(comments)
                  current = []
                  consecutive_comments = [current]
                  @modifier_comments = {}
                  comments.each do |comment|
              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 split_into_flow has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                def split_into_flow
                  res = []
                  current_attr = 0
              
                  str_len = @str.length
              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

              File ripper_state_lex.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'ripper'
              
              ##
              # Wrapper for Ripper lex states
              
              
              Severity: Minor
              Found in lib/rdoc/parser/ripper_state_lex.rb - About 2 hrs to fix

                Method build_list has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def build_list margin
                    p :list_start => margin if @debug
                
                    list = RDoc::Markup::List.new
                    label = nil
                Severity: Major
                Found in lib/rdoc/markup/parser.rb - About 2 hrs to fix

                  Method handle_meta_method_comment has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def handle_meta_method_comment(comment, node)
                      is_call_node = node.is_a?(Prism::CallNode)
                      singleton_method = false
                      visibility = @visibility
                      attributes = rw = line_no = method_name = nil
                  Severity: Major
                  Found in lib/rdoc/parser/prism_ruby.rb - About 2 hrs to fix

                    File servlet.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require_relative '../rdoc'
                    require 'erb'
                    require 'time'
                    require 'json'
                    
                    
                    Severity: Minor
                    Found in lib/rdoc/servlet.rb - About 2 hrs to fix

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

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