Method pathmap
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def pathmap(spec=nil, &block)
return self if spec.nil?
result = "".dup
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
case frag
Method ext
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ext(newext="")
return self.dup if [".", ".."].include? self
if newext != ""
newext = "." + newext unless newext =~ /^\./
end
- 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 pathmap_explode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pathmap_explode
head, tail = File.split(self)
return [self] if head == self
return [tail] if head == "." || tail == "/"
return [head, tail] if head == "/"
- 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 pathmap
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pathmap(spec=nil, &block)
return self if spec.nil?
result = "".dup
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
case frag
- 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 pathmap_replace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pathmap_replace(patterns, &block)
result = self
patterns.split(";").each do |pair|
pattern, replacement = pair.split(",")
pattern = Regexp.new(pattern)
- 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"