evolve75/RubyTree

View on GitHub

Very high overall complexity: 369

# tree.rb - This file is part of the RubyTree package.
#
# = tree.rb - Generic implementation of an N-ary tree data structure.
#
# Provides a generic tree data structure with ability to
Found in Tree::TreeNode - About 2 days to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very high overall complexity: 334

#
# setup.rb
#
# Copyright (c) 2000-2005 Minero Aoki
#
Found in Installer - About 2 days to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very complex method in #standard_entries

  def standard_entries(rbconfig)
    c = rbconfig

    rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])

Found in ConfigTable - About 2 days to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

High overall complexity: 224

#
# setup.rb
#
# Copyright (c) 2000-2005 Minero Aoki
#
Found in ConfigTable - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Complex class definition

#
# setup.rb
#
# Copyright (c) 2000-2005 Minero Aoki
#
Found in Installer - About 5 hrs to fix

    Complex method in #print_usage

      def print_usage(out)
        out.puts 'Typical Installation Procedure:'
        out.puts "  $ ruby #{File.basename $0} config"
        out.puts "  $ ruby #{File.basename $0} setup"
        out.puts "  # ruby #{File.basename $0} install (may require root privilege)"
    Found in ToplevelInstaller - About 4 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #update_shebang_line

      def update_shebang_line(path)
        return if no_harm?
        return if config('shebang') == 'never'
        old = Shebang.load(path)
        if old
    Found in Installer - About 3 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #print_tree

        def print_tree(level = node_depth, max_depth = nil,
                       block = lambda { |node, prefix|
                         puts "#{prefix} #{node.name}" })
          prefix = ''
    
    
    Found in Tree::TreeNode - About 3 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #install

      def install(from, dest, mode, prefix = nil)
        $stderr.puts "install #{from} #{dest}" if verbose?
        return if no_harm?
    
        realdest = prefix ? prefix + File.expand_path(dest) : dest
    Found in FileOperations - About 2 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #postordered_each

        def postordered_each(&block)
          return self.to_enum(:postordered_each) unless block_given?
    
          # Using a marked node in order to skip adding the children of nodes that
          # have already been visited. This allows the stack depth to be controlled,
    Found in Tree::TreeNode - About 2 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #add

        def add(child, at_index = -1)
          # Only handles the immediate child scenario
          raise ArgumentError,
                "Attempting to add a nil node" unless child
          raise ArgumentError,
    Found in Tree::TreeNode - About 2 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #new_shebang

      def new_shebang(old)
        if /\Aruby/ =~ File.basename(old.cmd)
          Shebang.new(config('rubypath'), old.args)
        elsif File.basename(old.cmd) == 'env' and old.args.first == 'ruby'
          Shebang.new(config('rubypath'), old.args[1..-1])
    Found in Installer - About 2 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex class definition

    # tree.rb - This file is part of the RubyTree package.
    #
    # = tree.rb - Generic implementation of an N-ary tree data structure.
    #
    # Provides a generic tree data structure with ability to
    Found in Tree::TreeNode - About 2 hrs to fix

      Complex method in #merge_trees

        def merge_trees(tree1, tree2)
          names1 = tree1.has_children? ? tree1.children.map { |child| child.name } : []
          names2 = tree2.has_children? ? tree2.children.map { |child| child.name } : []
      
          names_to_merge = names2 - names1
      Found in Tree::Utils::TreeMergeHandler - About 1 hr to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More