Showing 13 of 22 total issues
Complex method Arkenstone::Associations::Resources::HasManySingletonMethods#build (26.8) Open
def build(options)
parent_id = "#{arkenstone_parent_instance.class.to_s.demodulize.underscore}_id"
new_resource = arkenstone_nested_class.build(options.merge({ parent_id => arkenstone_parent_instance.id }))
parent_resource_instances = arkenstone_parent_instance.send arkenstone_nested_resource_name.to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method validate_presence
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_presence(attr, options)
message = options[:message] || "can't be blank"
test = options[:presence]
method_not_defined = test != self.class.method_defined?(attr)
if method_not_defined
- Read upRead up
- Create a ticketCreate a ticket
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 saveable_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def saveable_attributes
return attributes unless Arkenstone::Hook.has_hooks? self.class
attrs = {}
Arkenstone::Hook.all_hooks_for_class(self.class).each do |hook|
- Read upRead up
- Create a ticketCreate a ticket
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
Complex method Arkenstone::Document::included (22.4) Open
def included(base)
base.send :include, Arkenstone::Helpers
base.send :include, Arkenstone::Associations
base.send :include, Arkenstone::Document::InstanceMethods
base.send :include, Arkenstone::Network
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Arkenstone::Validation::InstanceMethods#validate_confirmation (21.9) Open
def validate_confirmation(attr, options)
message = options[:message] || "confirmation does not match #{attr}"
test = options[:confirmation]
attr_confirmation = "#{attr}_confirmation".to_sym
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method has_one
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def has_one(child_model_name, options = {})
setup_arkenstone_data
child_url_fragment = options[:model_name] || child_model_name
# The method for accessing the cached single resource is `cached_[name]`. If the value is nil it creates a request to pull the value from the server.
- Read upRead up
- Create a ticketCreate a ticket
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 has_and_belongs_to_many
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def has_and_belongs_to_many(model_klass_name)
# Gather the namespace
namespace = to_s.split(/::/)
model_klass_name = model_klass_name.to_s.singularize.underscore.to_sym
current_klass_name = namespace.pop.underscore.to_sym
- Read upRead up
- Create a ticketCreate a ticket
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
Complex method Arkenstone::Validation::InstanceMethods#validate_with_validators (20.2) Open
def validate_with_validators
return if self.class.fields_to_validate.nil?
self.class.fields_to_validate.each do |attr, validators|
validators.each do |validator_hash, _arg|
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Arkenstone::Hook::all_hooks_for_class (20.1) Open
def all_hooks_for_class(klass)
all_hooks = []
if klass.arkenstone_inherit_hooks
klass.ancestors.each do |ancestor|
break if ancestor == Arkenstone::Associations::InstanceMethods
- Read upRead up
- Create a ticketCreate a ticket
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
TODO found Open
# TODO: - refactor the network stuff into it's own module, so that we don't have `self` here
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
# TODO: Refactor this to handle more status codes.
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
# TODO: consider splitting the bigger associations (has_many) into separate files
- Create a ticketCreate a ticket
- Exclude checks
TODO found Open
# TODO: How do we handle redirects (30x)?
- Create a ticketCreate a ticket
- Exclude checks