Showing 406 of 406 total issues

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

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

  def marshal_load array # :nodoc:
    initialize_visibility
    initialize_methods_etc
    @current_section   = nil
    @document_self     = true
Severity: Minor
Found in lib/rdoc/code_object/class_module.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 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 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 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 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 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 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 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 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 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 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

                          Severity
                          Category
                          Status
                          Source
                          Language