Method ruboto_import_widget
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ruboto_import_widget(class_name, package_name='android.widget')
if class_name.is_a?(String) or class_name.is_a?(Symbol)
klass = java_import("#{package_name}.#{class_name}") || eval("Java::#{package_name}.#{class_name}")
else
klass = class_name
Method ruboto_import_widget
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ruboto_import_widget(class_name, package_name='android.widget')
if class_name.is_a?(String) or class_name.is_a?(Symbol)
klass = java_import("#{package_name}.#{class_name}") || eval("Java::#{package_name}.#{class_name}")
else
klass = class_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 configure
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def configure(context, params = {})
if (width = params.delete(:width))
getLayoutParams.width = View.convert_constant(width)
puts "\nDEPRECATION: The ':width' option is deprecated. Use :layout => {:width => XX} instead."
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 convert_constant
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.convert_constant(from)
return from unless from.is_a?(Symbol)
unless @@convert_constants.include?(from)
raise "Symbol #{from.inspect} doesn't have a corresponding View constant #{from.to_s.upcase}."
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 set_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_attribute(target, k, v)
assign_method = "#{k}="
field_assign_method = "#{k.to_s.gsub(/(_)([a-z])/) { $2.upcase }}="
setter_method = "set#{k.to_s.gsub(/(^|_)([a-z])/) { $2.upcase }}"
method_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 configure
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure(context, params = {})
if (list = params.delete(:list))
item_layout = params.delete(:item_layout)
params[:adapter] = android.widget.ArrayAdapter.new(context, item_layout || android.R::layout::simple_spinner_item, list)
dropdown_layout = params.delete(:dropdown_layout)
- 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"