Class MethodAttr
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class RDoc::MethodAttr < RDoc::CodeObject
include Comparable
##
Method find_method_or_attribute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def find_method_or_attribute name # :nodoc:
return nil unless parent.respond_to? :ancestors
searched = parent.ancestors
kernel = @store.modules_hash['Kernel']
- 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 block_params=
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def block_params=(value)
# 'yield.to_s' or 'assert yield, msg'
return @block_params = '' if value =~ /^[\.,]/
# remove trailing 'if/unless ...'
- 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 block_params=
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def block_params=(value)
# 'yield.to_s' or 'assert yield, msg'
return @block_params = '' if value =~ /^[\.,]/
# remove trailing 'if/unless ...'
Method pretty_print
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def pretty_print q # :nodoc:
alias_for =
if @is_alias_for.respond_to? :name then
"alias for #{@is_alias_for.name}"
elsif Array === @is_alias_for then
- 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 <=>
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def <=>(other)
return unless other.respond_to?(:singleton) &&
other.respond_to?(:name)
[ @singleton ? 0 : 1, name] <=>
- 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
Avoid too many return
statements within this method. Open
return @block_params = 'str' if value =~ /^\$[&0-9]$/