Showing 126 of 136 total issues
Method draw_background_in_context
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def draw_background_in_context(context = nil)
context ||= UIGraphicsGetCurrentContext()
options = draw_options
rect, background_color, border_width, border_color, border_sides, corner_radius, dashes_array, rounded_corners = options.slice(:rect, :background_color, :border_width, :border_color, :border_sides, :corner_radius, :dashes, :rounded_corners).values
- 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 calculate_frame_for
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def calculate_frame_for(parent_bounds, options)
width = options[:width]
height = options[:height]
top = options[:top]
right = options[:right]
- 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
Class Section
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
class Section
# MotionPrime::Section is container for Elements.
# Sections are located inside Screen and can contain multiple Elements.
# On render, each element will be added to parent screen.
Class AbstractCollectionSection
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractCollectionSection < Section
include HasStyleChainBuilder
attr_accessor :collection_element, :did_appear
attr_reader :decelerating
File _sync_mixin.rb
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
module MotionPrime
module ModelSyncMixin
extend ::MotionSupport::Concern
def self.included(base)
Method preload_sections_after
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def preload_sections_after(from_index, load_limit = nil)
return unless async_data?
service = preloader_index_service
load_limit ||= self.class.async_data_options.try(:[], :preload_cells_count)
- 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
Class FormSection
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class FormSection < TableSection
# MotionPrime::FormSection is container for Field Sections.
# Forms are located inside Screen and can contain multiple Field Sections.
# On render, each field will be added to parent screen.
Class TableSection
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class TableSection < AbstractCollectionSection
include TableSectionRefreshMixin
include HasSearchBar
class_attribute :group_header_options, :pull_to_refresh_block, :pull_to_refresh_options
File base_section.rb
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
motion_require '../helpers/has_authorization'
module MotionPrime
class Section
# MotionPrime::Section is container for Elements.
# Sections are located inside Screen and can contain multiple Elements.
Method draw_background_in_context
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def draw_background_in_context(context = nil)
context ||= UIGraphicsGetCurrentContext()
options = draw_options
rect, background_color, border_width, border_color, border_sides, corner_radius, dashes_array, rounded_corners = options.slice(:rect, :background_color, :border_width, :border_color, :border_sides, :corner_radius, :dashes, :rounded_corners).values
Method calculate_frame_for
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_frame_for(parent_bounds, options)
width = options[:width]
height = options[:height]
top = options[:top]
right = options[:right]
Class DrawElement
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class DrawElement < BaseElement
# MotionPrime::DrawElement is container for drawRect method options.
# Elements are located inside Sections
include FrameCalculatorMixin
Class BaseElement
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class BaseElement
# MotionPrime::BaseElement is container for UIView class elements with options.
# Elements are located inside Sections
include ::MotionSupport::Callbacks
Method load_image
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def load_image
return if @loading || image_data || !computed_options[:url]
@loading = true
refs = strong_references
- 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
Class TableDelegate
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class TableDelegate
include DelegateMixin
attr_accessor :table_section
def initialize(options)
Class ApiClient
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ApiClient
attr_accessor :access_token
def initialize(options = {})
self.access_token = options[:access_token]
File view_styler.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
module MotionPrime
class ViewStyler
include FrameCalculatorMixin
include HasStyles
include HasClassFactory
Method request!
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def request!(method, path, data, files = nil, options = {}, &block)
use_callback = block_given?
path_with_base = path_with_base(path, config.api_namespace)
client_method = files.present? ? :"multipart_#{method}" : method
AFMotion::Client.shared.send client_method, path_with_base, data do |response, form_data, progress|
- 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 style
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def style(*args, &block)
names = Array.wrap(args)
options = names.pop if args.last.is_a?(Hash)
if options.present?
- 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_has_many
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def fetch_has_many(key, options = {}, sync_options = {}, &block)
use_callback = block_given?
NSLog("SYNC: started sync for #{key} in #{self.class_name_without_kvo}")
params = (options[:params] || {}).deep_merge(sync_options[:params] || {})
- 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"