Showing 48 of 56 total issues
Method deserialize_checkboxes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.deserialize_checkboxes(attributes)
attributes.each do |k, v|
if k.include?('checkboxes')
if v
attributes[k] = v.split(',').map { |i| i.strip } # strip needed to inculde not just the first element because of white space
- 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 store_external_images
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def store_external_images
return if self.errors.any?
replace_image true, :external_title_image_url if external_title_image_url.present?
replace_image false, :image_2_url if image_2_url.present?
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 update_rating_counter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_rating_counter
number_of_ratings = self.ratings.count
self.update_attributes(percentage_of_positive_ratings: calculate_percentage_of_biased_ratings('positive', 50),
percentage_of_neutral_ratings: calculate_percentage_of_biased_ratings('neutral', 50),
- 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 parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(payload, sso_secret = nil)
sso = new
sso.sso_secret = sso_secret if sso_secret
parsed = Rack::Utils.parse_query(payload)
- 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 actions_for_successful_update_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def actions_for_successful_update_for resource, prev_unconfirmed_email = nil
resource.save_already_validated_standard_address!
if is_navigational_format?
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
- 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 validate_each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
case record.country
when 'Deutschland'
length = 5
if value.to_s.length != length
- 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 common_sense_check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def common_sense_check selected_payment, selected_transport
if (selected_payment == 'cash_on_delivery' && selected_transport == 'pickup') || (selected_payment == 'cash' && selected_transport != 'pickup')
I18n.t 'transaction.errors.combination_invalid',
selected_payment: I18n.t("enumerize.business_transaction.selected_payment.#{selected_payment}")
elsif (selected_payment != 'paypal' && selected_transport == 'bike_courier')
- 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 normalize_filename
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalize_filename
self.class.attachment_definitions.each do |name, _hash|
attachment = self.send(name)
if attachment.present?
if self.new_record? || self.changed_attributes.keys.include?("#{name}_file_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"