Showing 33 of 33 total issues
File setup.rb
has 1241 lines of code (exceeds 250 allowed). Consider refactoring. Open
unless Enumerable.method_defined?(:map) # Ruby 1.4.6
module Enumerable
alias map collect
end
end
Class TreeNode
has 47 methods (exceeds 20 allowed). Consider refactoring. Open
class TreeNode
include Enumerable
include Comparable
include Tree::Utils::TreeMetricsHandler
include Tree::Utils::TreePathHandler
Class Installer
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Installer
FILETYPES = %w( bin lib ext data conf man )
include FileOperations
Method standard_entries
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def standard_entries(rbconfig)
c = rbconfig
rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
File tree.rb
has 329 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'tree/tree_deps'
# This module provides a *TreeNode* class whose instances are the primary
# objects for representing nodes in the tree.
#
Class ToplevelInstaller
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ToplevelInstaller
Version = '3.4.1'
Copyright = 'Copyright (c) 2000-2005 Minero Aoki'
Class ConfigTable
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ConfigTable
include Enumerable
def initialize(rbconfig)
Method print_tree
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def print_tree(level = self.node_depth, max_depth = nil,
block = lambda { |node, prefix|
puts "#{prefix} #{node.name}" })
prefix = ''
- Read upRead up
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 update_shebang_line
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def update_shebang_line(path)
return if no_harm?
return if config('shebang') == 'never'
old = Shebang.load(path)
if old
- Read upRead up
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 standard_entries
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def standard_entries(rbconfig)
c = rbconfig
rubypath = File.join(c['bindir'], c['ruby_install_name'] + c['EXEEXT'])
- Read upRead up
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 install
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
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 remove_tree0
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def remove_tree0(path)
Dir.foreach(path) do |ent|
next if ent == '.'
next if ent == '..'
entpath = "#{path}/#{ent}"
- Read upRead up
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 included
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
# @!group Metrics and Measures
# @!attribute [r] size
Method print_usage
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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)"
Method siblings
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def siblings
if block_given?
parent.children.each { |sibling| yield sibling if sibling != self }
self
else
- Read upRead up
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 parsearg_config
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parsearg_config
evalopt = []
set = []
@config.config_opt = []
while i = ARGV.shift
- Read upRead up
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 postordered_each
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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,
- Read upRead up
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 inordered_each
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def inordered_each(&block)
return self.to_enum unless block_given?
node_stack = []
- Read upRead up
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 add
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add(child, at_index = -1)
# Only handles the immediate child scenario
raise ArgumentError,
'Attempting to add a nil node' unless child
raise ArgumentError,
- Read upRead up
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 merge_trees
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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
- Read upRead up
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"