Method define_accessor_meth
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def define_accessor_meth meth
self.class.class_eval do
define_method :"#{ meth }" do | *args |
attrs = args
opts = extract_options!( args )
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize options=nil
setters = self.class.instance_methods.select{ | i | i.to_s =~ /[a-z].+=$/ }
required_attributes = self.class.attributes.required_attributes
if required_attributes.empty?
required_attributes = self.class.superclass.attributes.required_attributes
- 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 define_accessor
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def define_accessor attr_name, opts
self.class_eval do
define_method attr_name do
instance_variable_get "@#{ attr_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 initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize options=nil
setters = self.class.instance_methods.select{ | i | i.to_s =~ /[a-z].+=$/ }
required_attributes = self.class.attributes.required_attributes
if required_attributes.empty?
required_attributes = self.class.superclass.attributes.required_attributes
Method inherited
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def inherited klass
map_ofp_type klass
primitive_sizes.each do | each |
define_accessor_meth :"unsigned_int#{ each }"
define_method :"check_unsigned_int#{ each }" do | number, 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 set_default
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_default setters
default_attributes = self.class.attributes.default_attributes
setters.each do | each |
opt_key = each.to_s.sub( '=', '' ).to_sym
if default_attributes.has_key? opt_key
- 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"