Class TypeFactory
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class TypeFactory
DSL_METHODS = [
:attribute,
:heading,
Method type
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def type(type, name = nil, metadata = nil, &bl)
return subtype(type(type, name, metadata), bl) if bl
case type
when Type
alias_type(type, name, metadata)
- 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 type
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def type(type, name = nil, metadata = nil, &bl)
return subtype(type(type, name, metadata), bl) if bl
case type
when Type
alias_type(type, name, metadata)
Method alias_type
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def alias_type(type, name, metadata)
raise "Type expected `#{type}`" unless type.is_a?(Type)
if (name && type.named?) or (metadata && type.metadata?)
AliasType.new(type, name, metadata)
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 contract
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def contract(infotype, dresser, undresser, name = nil, metadata = nil)
Method subtype
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def subtype(super_type, constraints = nil, name = nil, metadata = nil, &bl)
Method name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def name(name)
unless name.nil? or (name.is_a?(String) and name.strip.size > 1)
fail!("Wrong type name `#{name}`")
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"