Showing 213 of 251 total issues
Avoid deeply nested control flow statements. Open
book_rate_line(address_label) if @book_rate and address_label
Avoid deeply nested control flow statements. Open
address.gsub!("\nDeutschland", "") if I18n.locale == :de # in order to save space for in-country deliveries.
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :update, room
terminate_existing_occupancies
- 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
Consider simplifying this complex logical expression. Open
if self.value_changed? && (! @do_not_save_parent) && self.parent && self.parent.reload && self.parent.children.reload && (self.parent.value != (composed_value = self.parent.composed_value))
self.parent.update_attributes value: composed_value
@do_not_save_parent = false
end
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(name, address_field, name_surrounding_field, personal_title = '', company = '')
Method support_request_email
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def support_request_email(sender_user, receiver_email, text, meta_data, navable)
Method postal_address_postal_code_and_town
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def postal_address_postal_code_and_town
if str = address_label.postal_address
str.gsub!(postal_address_street_with_number.to_s, ' ') if postal_address_street_with_number.to_s.present?
str.gsub!("\n" + postal_address_second_address_line.to_s, ' ' ) if postal_address_second_address_line.to_s.present?
str.gsub!(/\n#{postal_address_country.to_s}\z/m, ' ') if postal_address_country.to_s.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 needs_review=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def needs_review=(new_needs_review)
new_needs_review = false if new_needs_review == "false"
if new_needs_review != self.needs_review
attribute_will_change!(:needs_review)
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 geo_information
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def geo_information( key )
return nil if self.value == "—"
return geo_location.send(key).strip if self.value.present? && geo_location.send(key).kind_of?(String) && geo_location.send(key).strip.present?
return geo_location.send(key) if self.value.present? && geo_location.send(key).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 thumb_path
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def thumb_path
url = file.url if has_type?("svg")
url ||= file.url(:thumb) if has_type?("image") or has_type?("pdf")
url ||= file.url(:video_thumb) if has_type?("video")
url ||= helpers.image_path('file.png')
- 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_last_seen_activity
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_last_seen_activity(description = nil, object = nil)
unless readonly?
if description and not self.incognito?
activity = find_or_build_last_seen_activity
activity.touch unless activity.new_record? # even if the attributes didn't change. The user probably hit 'reload' then.
- 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 access_indicator
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def access_indicator
if current_navable.respond_to?(:draft?) && current_navable.draft?
content_tag :span, t(:draft), class: 'label label-primary draft_label'
elsif current_access
css = 'access-indicator has_tooltip'
- 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 birthday_this_year
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def birthday_this_year
begin
date_of_birth.change(:year => Time.zone.now.year)
rescue
if date_of_birth.try(:month) == 2 && date_of_birth.try(:day) == 29
- 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 identify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.identify(login_string)
# Priorization: Check alias first. (Bug fix)
user_identified_by_alias = User.find_by_alias(login_string)
users_that_match_the_login_string = [ User.find_by_alias(login_string) ] if user_identified_by_alias
- 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 <<
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def <<(child)
unless child.in? self.children
if child.in? self.descendants
link = DagLink.where(
ancestor_type: 'Page', ancestor_id: self.id,
- 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_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_for(user)
raise RuntimeError, 'no user given' if not user
raise RuntimeError, 'the given user has no last_name' if not user.last_name.present?
raise RuntimeError, 'the given user has no first_name' if not user.first_name.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 value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def value
return super if updated_at && (updated_at < 5.seconds.ago)
return super if children.none?
# Recalculate the value and store it.
- 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 member_table_rows
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def member_table_rows
if memberships.count == members.count
memberships_for_member_list.reorder('valid_from ASC').collect do |membership|
if user = membership.user
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 male_or_female_salutation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def male_or_female_salutation
if female?
if age < 18
I18n.translate(:to_ms, locale)
else
- 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_guest_user_from_form_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_guest_user_from_form_data
if (name = params[:guest_user_name]).present? || (email = params[:guest_user_email] || params[:email]).present?
unless current_user
cookies[:guest_user_name] = name
cookies[:guest_user_email] = 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"