Showing 372 of 392 total issues

Method get_symbol_tk has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  private def get_symbol_tk(tk)
    is_symbol = true
    symbol_tk = Token.new(tk.line_no, tk.char_no, :on_symbol)
    if ":'" == tk[:text] or ':"' == tk[:text] or tk[:text].start_with?('%s')
      tk1 = get_string_tk(tk)
Severity: Minor
Found in lib/rdoc/parser/ripper_state_lex.rb - About 1 hr to fix

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

      def parse_identifier container, single, tk, comment # :nodoc:
        case tk[:text]
        when 'private', 'protected', 'public', 'private_class_method',
             'public_class_method', 'module_function' then
          parse_visibility container, single, tk
    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 markup_code has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def markup_code
        return '' unless @token_stream
    
        src = RDoc::TokenStream.to_html @token_stream
    
    
    Severity: Minor
    Found in lib/rdoc/generator/markup.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 can_parse_by_name has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.can_parse_by_name file_name
        _, parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }
    
        # The default parser must not parse binary files
        ext_name = File.extname file_name
    Severity: Minor
    Found in lib/rdoc/parser.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 on_op has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_op(tok, data)
          case tok
          when '&', '|', '!', '!=', '!~'
            case @lex_state
            when EXPR_FNAME, EXPR_DOT
    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 parse_symbol_arg_paren has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

      def parse_symbol_arg_paren no # :nodoc:
        args = []
    
        loop do
          skip_tkspace_comment
    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 parse_file has 43 lines of code (exceeds 25 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 1 hr to fix

      Method from_module has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.from_module class_type, mod
          klass = class_type.new mod.name
      
          mod.comment_location.each do |comment, location|
            klass.add_comment comment, location
      Severity: Minor
      Found in lib/rdoc/class_module.rb - About 1 hr to fix

        Method init_ivars has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def init_ivars # :nodoc:
            @dry_run = false
            @exclude = %w[
              ~\z \.orig\z \.rej\z \.bak\z
              \.gemspec\z
        Severity: Minor
        Found in lib/rdoc/options.rb - About 1 hr to fix

          Method document has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def document options
              self.store = RDoc::Store.new
          
              if RDoc::Options === options then
                @options = options
          Severity: Minor
          Found in lib/rdoc/rdoc.rb - About 1 hr to fix

            Method handle_class_module has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def handle_class_module(var_name, type, class_name, parent, in_module)
                parent_name = @known_classes[parent] || parent
            
                if in_module then
                  enclosure = @classes[in_module] || @store.find_c_enclosure(in_module)
            Severity: Minor
            Found in lib/rdoc/parser/c.rb - About 1 hr to fix

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

                Method resolve_method has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def resolve_method name
                    ref = nil
                
                    if /#{CLASS_REGEXP_STR}([.#]|::)#{METHOD_REGEXP_STR}/o =~ name then
                      type = $2
                Severity: Minor
                Found in lib/rdoc/cross_reference.rb - About 1 hr to fix

                  Method time_delta_string has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def time_delta_string seconds
                      return 'less than a minute'          if seconds < 60
                      return "#{seconds / 60} minute#{seconds / 60 == 1 ? '' : 's'}" if
                                                              seconds < 3000     # 50 minutes
                      return 'about one hour'              if seconds < 5400     # 90 minutes
                  Severity: Minor
                  Found in lib/rdoc/generator/darkfish.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 find_method_or_attribute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def find_method_or_attribute name # :nodoc:
                      return nil unless parent.respond_to? :ancestors
                  
                      searched = parent.ancestors
                      kernel = @store.modules_hash['Kernel']
                  Severity: Minor
                  Found in lib/rdoc/method_attr.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 get_words_tk has a Cognitive Complexity of 13 (exceeds 5 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

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

                    def handle_constants(type, var_name, const_name, definition)
                      class_name = @known_classes[var_name]
                  
                      return unless class_name
                  
                  
                  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

                  Method display_name has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def display_name name
                      if name =~ /\w:(\w|$)/ then
                        display_page name
                        return true
                      end
                  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 list_methods_matching has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def list_methods_matching name
                      found = []
                  
                      find_methods name do |store, klass, ancestor, types, method|
                        if types == :instance or types == :both then
                  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 module has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def module
                      return @module if @module
                  
                      # search the current context
                      return @name unless parent
                  Severity: Minor
                  Found in lib/rdoc/mixin.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