lib/rdoc/ri/paths.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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 gemdirs has 28 lines of code (exceeds 25 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

    Method each has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def self.each system = true, site = true, home = true, gems = :latest, *extra_dirs # :yields: directory, type
    Severity: Minor
    Found in lib/rdoc/ri/paths.rb - About 35 mins to fix

      Method raw_path has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def self.raw_path(system, site, home, gems, *extra_dirs)
      Severity: Minor
      Found in lib/rdoc/ri/paths.rb - About 35 mins to fix

        Method path has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def self.path(system = true, site = true, home = true, gems = :latest, *extra_dirs)
        Severity: Minor
        Found in lib/rdoc/ri/paths.rb - About 35 mins to fix

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

            def self.each system = true, site = true, home = true, gems = :latest, *extra_dirs # :yields: directory, type
              return enum_for __method__, system, site, home, gems, *extra_dirs unless
                block_given?
          
              extra_dirs.each do |dir|
          Severity: Minor
          Found in lib/rdoc/ri/paths.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

          There are no issues that match your filters.

          Category
          Status