Showing 387 of 405 total issues

Method get_heredoc_tk has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  private def get_heredoc_tk(heredoc_name, indent)
    string = ''
    start_tk = nil
    prev_tk = nil
    until heredoc_end?(heredoc_name, indent, tk = @tokens.shift) do
Severity: Minor
Found in lib/rdoc/parser/ripper_state_lex.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_method has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def lookup_method name
    found = load_methods_matching name

    if found.empty?
      if check_did_you_mean
Severity: Minor
Found in lib/rdoc/ri/driver.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 add_attribute has 35 lines of code (exceeds 25 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 1 hr to fix

    Method root_search has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def root_search req, res
        search_index = []
        info         = []
    
        installed_docs.map do |name, href, exists, type, path|
    Severity: Minor
    Found in lib/rdoc/servlet.rb - About 1 hr to fix

      Method parse_call_parameters has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def parse_call_parameters(tk)
          end_token = case tk[:kind]
                      when :on_lparen
                        :on_rparen
                      when :on_rparen
      Severity: Minor
      Found in lib/rdoc/parser/ruby.rb - About 1 hr to fix

        Method get_words_tk has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          private def get_words_tk(tk)
            string = ''
            start_token = tk[:text]
            start_quote = tk[:text].rstrip[-1]
            line_no = tk[:line_no]
        Severity: Minor
        Found in lib/rdoc/parser/ripper_state_lex.rb - About 1 hr to fix

          Method summary has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def summary
              calculate
          
              num_width = [@num_files, @num_items].max.to_s.length
              undoc_width = [
          Severity: Minor
          Found in lib/rdoc/stats.rb - About 1 hr to fix

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

              def marshal_load array
                initialize_visibility
            
                @dont_rename_initialize = nil
                @token_stream           = nil
            Severity: Minor
            Found in lib/rdoc/code_object/any_method.rb - About 1 hr to fix

              Method parse_method has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def parse_method(container, single, tk, comment)
                  singleton = nil
                  added_container = false
                  name = nil
                  column  = tk[:char_no]
              Severity: Minor
              Found in lib/rdoc/parser/ruby.rb - About 1 hr to fix

                Method update_visibility has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def update_visibility container, vis_type, vis, singleton # :nodoc:
                    new_methods = []
                
                    case vis_type
                    when 'module_function' then
                Severity: Minor
                Found in lib/rdoc/parser/ruby.rb - About 1 hr to fix

                  Method split_into_flow has 33 lines of code (exceeds 25 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 1 hr to fix

                    Method define has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def define
                        desc rdoc_task_description
                        task rdoc_task_name
                    
                        desc rerdoc_task_description
                    Severity: Minor
                    Found in lib/rdoc/task.rb - About 1 hr to fix

                      Method report_class_module has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def report_class_module cm
                          return if cm.fully_documented? and @coverage_level.zero?
                          return unless cm.display?
                      
                          report = RDoc::Markup::Document.new
                      Severity: Minor
                      Found in lib/rdoc/stats.rb - About 1 hr to fix

                        Method add_method has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def add_method(name, receiver_name:, receiver_fallback_type:, visibility:, singleton:, params:, calls_super:, block_params:, tokens:, start_line:, end_line:)
                            receiver = receiver_name ? find_or_create_module_path(receiver_name, receiver_fallback_type) : @container
                            meth = RDoc::AnyMethod.new(nil, name)
                            if (comment = consecutive_comment(start_line))
                              handle_consecutive_comment_directive(@container, comment)
                        Severity: Minor
                        Found in lib/rdoc/parser/prism_ruby.rb - About 1 hr to fix

                          Method parse_class_regular has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def parse_class_regular container, declaration_context, single, # :nodoc:
                                                    name_t, given_name, comment
                              superclass = '::Object'
                          
                              if given_name =~ /^::/ then
                          Severity: Minor
                          Found in lib/rdoc/parser/ruby.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 generate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def generate
                              return if @spec.default_gem?
                              return unless @generate_ri or @generate_rdoc
                          
                              setup
                          Severity: Minor
                          Found in lib/rdoc/rubygems_hook.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 store_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def store_for source_name
                              case source_name
                              when 'home' then
                                RDoc::Store.new RDoc::RI::Paths.home_dir, :home
                              when 'ruby' then
                          Severity: Minor
                          Found in lib/rdoc/servlet.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 print_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def print_file files_so_far, filename
                              progress_bar = sprintf("%3d%% [%2d/%2d]  ",
                                                     100 * files_so_far / @num_files,
                                                     files_so_far,
                                                     @num_files)
                          Severity: Minor
                          Found in lib/rdoc/stats/normal.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 report_class_module has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def report_class_module cm
                              return if cm.fully_documented? and @coverage_level.zero?
                              return unless cm.display?
                          
                              report = RDoc::Markup::Document.new
                          Severity: Minor
                          Found in lib/rdoc/stats.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 load_variable_map has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def load_variable_map map_name
                              return {} unless files = @store.cache[map_name]
                              return {} unless name_map = files[@file_name]
                          
                              class_map = {}
                          Severity: Minor
                          Found in lib/rdoc/parser/c.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

                          Severity
                          Category
                          Status
                          Source
                          Language