lib/rdoc/rdoc.rb

Summary

Maintainability
F
3 days
Test Coverage

Method normalized_file_list has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
Open

  def normalized_file_list(relative_files, force_doc = false,
                           exclude_pattern = nil)
    file_list = {}

    relative_files.each do |rel_file_name|
Severity: Minor
Found in lib/rdoc/rdoc.rb - About 5 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 setup_output_dir has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def setup_output_dir(dir, force)
    flag_file = output_flag_file dir

    last = {}

Severity: Minor
Found in lib/rdoc/rdoc.rb - About 3 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 rdoc.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative '../rdoc'

require 'find'
require 'fileutils'
require 'pathname'
Severity: Minor
Found in lib/rdoc/rdoc.rb - About 3 hrs to fix

    Class RDoc has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class RDoc::RDoc
    
      @current = nil
    
      ##
    Severity: Minor
    Found in lib/rdoc/rdoc.rb - About 2 hrs to fix

      Method parse_file has a Cognitive Complexity of 16 (exceeds 5 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 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 document has a Cognitive Complexity of 15 (exceeds 5 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

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

            def normalized_file_list(relative_files, force_doc = false,
                                     exclude_pattern = nil)
              file_list = {}
          
              relative_files.each do |rel_file_name|
          Severity: Minor
          Found in lib/rdoc/rdoc.rb - About 1 hr to fix

            Method setup_output_dir has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def setup_output_dir(dir, force)
                flag_file = output_flag_file dir
            
                last = {}
            
            
            Severity: Minor
            Found in lib/rdoc/rdoc.rb - About 1 hr to fix

              Method gather_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                def gather_files files
                  files = [@options.root.to_s] if files.empty?
              
                  file_list = normalized_file_list files, true, @options.exclude
              
              
              Severity: Minor
              Found in lib/rdoc/rdoc.rb - About 35 mins 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def generate
                  if @options.dry_run then
                    # do nothing
                    @generator.generate
                  else
              Severity: Minor
              Found in lib/rdoc/rdoc.rb - About 25 mins 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

              There are no issues that match your filters.

              Category
              Status