Showing 388 of 406 total issues

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

  def get_squashed_tk
    if @buf.empty?
      tk = @tokens.shift
    else
      tk = @buf.shift
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 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/code_object/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

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

  def find_or_create_module_path(module_name, create_mode)
    root_name, *path, name = module_name.split('::')
    add_module = ->(mod, name, mode) {
      case mode
      when :class
Severity: Minor
Found in lib/rdoc/parser/prism_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 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 marshal_dump has 39 lines of code (exceeds 25 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 1 hr to fix

    Function performSearch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function performSearch(data, regexps, queries, highlighters, state) {
        var searchIndex = data.searchIndex;
        var longSearchIndex = data.longSearchIndex;
        var info = data.info;
        var result = [];
    Severity: Minor
    Found in lib/rdoc/generator/template/json_index/js/searcher.js - About 1 hr to fix

      Method generate has 36 lines of code (exceeds 25 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

        Method do_methods has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def do_methods
            @content.scan(%r%rb_define_
                           (
                              singleton_method |
                              method           |
        Severity: Minor
        Found in lib/rdoc/parser/c.rb - About 1 hr to fix

          Method do_constants has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def do_constants
              @content.scan(%r%\Wrb_define_
                             ( variable          |
                               readonly_variable |
                               const             |
          Severity: Minor
          Found in lib/rdoc/parser/c.rb - About 1 hr to fix

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

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

                def self.check_modeline file_name
                  line = File.open file_name do |io|
                    io.gets
                  end
              
              
              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 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 gemdirs has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.gemdirs filter = :latest
                  ri_paths = {}
              
                  all = Gem::Specification.map do |spec|
                    [File.join(spec.doc_dir, 'ri'), spec.name, spec.version]
              Severity: Minor
              Found in lib/rdoc/ri/paths.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 define has a Cognitive Complexity of 12 (exceeds 5 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

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

                def block_params=(value)
                  # 'yield.to_s' or 'assert yield, msg'
                  return @block_params = '' if value =~ /^[\.,]/
              
                  # remove trailing 'if/unless ...'
              Severity: Minor
              Found in lib/rdoc/code_object/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

              Severity
              Category
              Status
              Source
              Language