Showing 24 of 28 total issues
File cmd.rb
has 405 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "securerandom"
=begin
rm family
* rm _rm file only_
Class Pa
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Pa
module Cmd
extend Util::Concern
DELEGATE_CLASS_METHODS = [ :home ]
Class Pa
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Pa
autoload :Util, "pa/util"
autoload :VERSION, "pa/version"
Error = Class.new Exception
File pa.rb
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "pd"
require "tmpdir"
=begin rdoc
Pa(Path) is similary to Pathname, but more powerful.
Method each2
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def each2(*args, &blk)
return Pa.to_enum(:each2, *args) unless blk
(dir,), o = Util.extract_options(args)
dir = dir ? get(dir) : "."
- 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 _touch
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _touch(paths, o)
o[:mode] ||= 0644
paths.map!{|v|get(v)}
extra_doc = o[:force] ? "-f " : nil
puts "touch #{extra_doc}#{paths.join(" ")}" if o[:show_cmd]
- 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 _mkdir
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _mkdir(paths, o)
puts "mkdir #{paths.join(" ")}" if o[:show_cmd]
o[:mode] ||= 0775
paths.map!{|v|get(v)}
- 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 _copy
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _copy(src, dest, o={})
raise Errno::EEXIST, "dest exists -- #{dest}" if File.exists?(dest) and (not o[:force])
case type=File.ftype(src)
- 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 _ln
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _ln(method, src_s, dest, o={})
srcs = Util.wrap_array(src_s)
dest = get(dest)
extra_doc = ""
extra_doc << (method==:symlink ? "-s " : "")
- 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 rm
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def rm(*paths)
paths, o = Util.extract_options(paths)
extra_doc = o[:force] ? "-f " : nil
puts _wrap_cmd("rm #{extra_doc}#{paths.join(' ')}", o[:show_cmd]) if o[:show_cmd]
- 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 empty_dir
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def empty_dir(*dirs)
dirs, o = Util.extract_options(dirs)
extra_doc = o[:force] ? "-f " : nil
puts _wrap_cmd("empty_dir #{extra_doc}#{dirs.join(" ")}", o[:show_cmd]) if o[:show_cmd]
- 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 mv
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def mv(src_s, dest, o={}, &blk)
srcs = Util.wrap_array(src_s).map{|v| get(v)}
dest = get(dest)
extra_doc = o[:force] ? "-f " : nil
- 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 _move
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _move(src, dest, o)
raise Errno::EEXIST, "dest exists -- #{dest}" if File.exists?(dest) and (not o[:force])
# move same file.
return if File.absolute_path(src) == File.absolute_path(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 rmdir
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def rmdir(*paths)
paths, o = Util.extract_options(paths)
extra_doc = o[:force] ? "-f " : nil
puts _wrap_cmd("rmdir #{extra_doc}#{paths.join(" ")}", o[:show_cmd]) if o[:show_cmd]
paths.each { |path|
- 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 rm_r
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def rm_r(*paths)
paths, o = Util.extract_options(paths)
puts _wrap_cmd("rm -r #{paths.join(' ')}", o[:show_cmd]) if o[:show_cmd]
paths.each { |path|
pa = Pa(path)
- 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 _copy
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _copy(src, dest, o={})
raise Errno::EEXIST, "dest exists -- #{dest}" if File.exists?(dest) and (not o[:force])
case type=File.ftype(src)
Method each2
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def each2(*args, &blk)
return Pa.to_enum(:each2, *args) unless blk
(dir,), o = Util.extract_options(args)
dir = dir ? get(dir) : "."
Method ls2_r
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ls2_r(*args, &blk)
dirs, o = Util.extract_options(args)
dirs << "." if dirs.empty?
blk ||= proc { true }
- 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 ls2
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ls2(*args, &blk)
dirs, o = Util.extract_options(args)
dirs << "." if dirs.empty?
blk ||= proc { true }
- 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 cp
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cp(src_s, dest, o={}, &blk)
srcs = Util.wrap_array(src_s).map{|v| Pa.get(v)}
dest = Pa.get(dest)
puts "cp #{srcs.join(" ")} #{dest}" if o[:show_cmd]
- 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"