Showing 126 of 136 total issues
Method draw_rect_in_context
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw_rect_in_context(context, options)
rect = options.fetch(:rect)
radius = options.fetch(:radius, 0)
rounded_corners = options[:rounded_corners] || [:top_left, :top_right, :bottom_right, :bottom_left]
Method set_layer_options
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_layer_options(key, value)
if key == 'rounded_corners'
layer_bounds = bounds
if value[:overlap]
size = layer_bounds.size
Method set_text_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_text_options(key, value)
if key == 'content_horizontal_alignment' && value.is_a?(Symbol) && %[left right center fill].include?(value.to_s)
view.setValue class_factory("UIControlContentHorizontalAlignment_#{value.camelize}"), forKey: camelize_factory(key)
true
elsif key == 'content_vertical_alignment' && value.is_a?(Symbol) && %[top bottom center fill].include?(value.to_s)
- 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 draw_in_context
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def draw_in_context(context)
return if computed_options[:hidden]
size_to_fit_if_needed
set_text_position
- 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 preload_sections_schedule_from
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def preload_sections_schedule_from(index, load_count)
service = preloader_index_service
@preloader_queue ||= []
Method compute_cell_style_options
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def compute_cell_style_options(style_sources, additional_suffixes)
base_styles = {common: [], specific: []}
suffixes = {common: [], specific: []}
all_styles = []
Method load_image
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_image
return if @loading || image_data || !computed_options[:url]
@loading = true
refs = strong_references
Method find_keys
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def find_keys(*arg)
if arg[0].is_a?(Hash)
options = arg[0]
if arg[1] && arg[1].is_a?(Hash)
sort_options = arg[1][:sort] || {}
- 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 generate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.generate(obj, parametrize = true)
if parametrize && obj.is_a?(Hash)
obj.each do |key, value|
obj[key] = value.to_s if PARAMETRIZE_CLASSES.include?(value.class)
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 setup_fonts
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def setup_fonts
return unless @base_config
colors = @base_config.fonts.to_hash.inject({}) do |res, (font, value)|
if [:system, :bold, :italic, :monospace].include?(value)
value = Symbol.uifont[value]
- 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 compute_style_options
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def compute_style_options(*style_sources)
@styles = []
if element.cell_section?
# FIXME: sometimes cause error: undefined method `style_suffixes' for instance of BaseSection's subclass
begin
- 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_option
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def set_option(key, value)
# return if value.nil?
# ignore options
return if ignore_option?(key) || value.nil?
- 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 create_navigation_button
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_navigation_button(title, args = {}, &block)
args[:style] ||= UIBarButtonItemStylePlain
args[:action] ||= block || nil
# TODO: Find better place for this code, may be just create custom control
if title.is_a?(UIButton)
- 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 update_with_url
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_with_url(url, options = {}, &block)
use_callback = block_given?
filtered_attributes = filtered_updatable_attributes(options)
attributes = attributes_to_post_data(model_name, filtered_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 prepare_for_store
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def prepare_for_store(object, options = {})
if object.is_a?(Array)
object.map { |entity| prepare_for_store(entity, options) }.compact
else
object.bag_key = self.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"
Further reading
Method inspect_hash
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def inspect_hash(hash, depth = 0)
return '{}' if hash.blank?
res = hash.map.with_index do |(key, value), i|
k = "#{' '*depth}#{i.zero? ? '{' : ' '}#{key.inspect}=>"
pair = if value.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"
Further reading
Method draw_in_context
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw_in_context(context)
return if computed_options[:hidden]
size_to_fit_if_needed
set_text_position
Method fetch_has_many_with_attributes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fetch_has_many_with_attributes(key, data, sync_options = {})
# TODO: should we skip add/delete/save unless should_save?
should_save = sync_options[:save]
models_to_add = []
Method draw_options
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw_options
options = computed_options
text = (options[:html] || options[:text]).to_s.gsub(/\A[\n\r]+/, '')
text_color = (options[:text_color] || :black).uicolor
font = (extract_font_from(options) || :system).uifont
Method extract_attributed_string_options
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_attributed_string_options(options)
attributes = {}
line_height = options[:line_height]
line_spacing = options[:line_spacing]
text_alignment = options[:text_alignment]