Showing 23 of 29 total issues
Class TypeFactory
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class TypeFactory
DSL_METHODS = [
:attribute,
:heading,
Method check_and_warn
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def check_and_warn(logger = nil)
logger ||= begin
require 'logger'
Logger.new(STDERR)
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 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 dress
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def dress(value, handler = DressHelper.new)
# Up should be idempotent with respect to the ADT
return value if ruby_type and value.is_a?(ruby_type)
# Dressed value and first exception
- 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 infer_type
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def infer_type(value)
case value
when Hash
attrs = value.map{|k,v|
Attribute.new(k.to_sym, infer_type(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 dress
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def dress(value, handler = DressHelper.new)
handler.failed!(self, value) unless looks_a_tuple?(value)
# Check for missing attributes
unless (missing = missing_attrs(value, true)).empty?
- 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 dress
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def dress(value, handler = DressHelper.new)
handler.failed!(self, value) unless looks_a_tuple?(value)
# Check for missing attributes
unless (missing = missing_attrs(value, true)).empty?
Method initialize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(infotype, dresser, undresser, name = nil, metadata = nil)
unless infotype.is_a?(Type)
raise ArgumentError, "Type expected, got `#{infotype}`"
end
unless dresser.respond_to?(:call)
- 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 suppremum
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def suppremum(other, simple_class, multi_class)
return self if self == other
return super(other) unless other.is_a?(simple_class) or other.is_a?(multi_class)
return super(other) unless heading.looks_similar?(other.heading)
result_heading = heading.suppremum(other.heading)
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(infotype, dresser, undresser, name = nil, metadata = nil)
Method normalize_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def normalize_attributes(attrs)
unless attrs.respond_to?(:each)
raise ArgumentError, "Enumerable[Attribute] expected"
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 to_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_name
name = map(&:to_name).join(', ')
if allow_extra?
name << ", " unless empty?
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
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"
Further reading
Method fetch_on_imports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fetch_on_imports(name, imports = @imports, &bl)
if imports.empty?
raise KeyError, %Q{key not found: "#{name}"} unless bl
bl.call(name)
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 suppremum
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def suppremum(other)
return super unless other.is_a?(CollectionType)
return self if other.is_a?(CollectionType) && elm_type == other.elm_type
builder = self.class == other.class ? self.class : SeqType
builder.new(elm_type.suppremum(other.elm_type))
- 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 initialize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name, metadata)
unless name.nil? or name.is_a?(String)
raise ArgumentError, "String expected for type name, got `#{name}`"
end
unless metadata.nil? or metadata.is_a?(Hash)
- 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"