Showing 213 of 251 total issues
Avoid too many return
statements within this method. Open
return t :events
Avoid too many return
statements within this method. Open
return 12.pt if num_of_lines_required(str, 12.pt) < 5
Avoid too many return
statements within this method. Open
return 7.pt
Avoid too many return
statements within this method. Open
return 8.pt if num_of_lines_required(str, 8.pt) < 8
Avoid too many return
statements within this method. Open
return 10.pt if num_of_lines_required(str, 10.pt) < 6
Method fill_cached_method
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def fill_cached_method(method)
Sidekiq::Logging.logger.info "#{title} # fill_cached_method #{method}" if Sidekiq::Logging.logger && (! Rails.env.test?)
if Rails.cache.running_from_background_job && Rails.cache.renew_at
# When running from a background job, split it into sub-tasks.
self.renew_cache_later method: method
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def value
v = super
v = v.to_i if ( not v.to_i == nil ) and ( v.to_i.to_s == v ) if v.respond_to?( :to_i )
v = true if v == "true"
v = false if v == "false"
- 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 change_type_according_to_other_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def change_type_according_to_other_attributes
self.type = "Membership" if ancestor_type == "Group" and descendant_type == "User"
self.type = "Memberships::Status" if self.type == "Membership" and ancestor.kind_of?(StatusGroup)
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 postal_address=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def postal_address=(new_postal_address)
if new_postal_address != self.postal_address
if new_postal_address
self.clear_postal_address
self.add_flag :postal_address
- 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 role_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def role_for( structureable )
return nil if not structureable.respond_to? :parent_groups
# return :main_admin if self.main_admin_of? structureable
return :admin if self.admin_of? structureable
return :member if self.member_of? structureable
- 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 logo_link_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def logo_link_path
if Page.public_website_present?
if current_navable.kind_of?(Page) && current_navable.has_flag?(:root)
root_path
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 rescue_from_too_big_to_marshal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rescue_from_too_big_to_marshal(block_without_caching, &block_with_caching)
begin
yield
rescue ArgumentError, NameError => exc
if exc.message.include? 'year too big to marshal'
- 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 data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def data
super.select { |user|
case @options[:quarter]
when nil, ''
true
- 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 greeting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def greeting
if Time.zone.now > "4:00".to_time and Time.zone.now < "11:00".to_time
I18n.t(:good_morning, locale: locale)
elsif Time.zone.now > "11:00".to_time and Time.zone.now < "17:00".to_time
I18n.t(:good_day, locale: locale)
- 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 rights_for_everyone
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rights_for_everyone
# Feature switches
#
can :use, :semester_calendars
- 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 process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process(options = {})
if sender_user && recipient_group && recipient_group.has_flag?(:mail_test_group)
recipient_group.child_users << sender_user unless recipient_group.child_users.include? sender_user
recipient_group.update mailing_list_sender_filter: :open
recipient_group.delete_cache
- 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 find_without_types
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_without_types( *types )
self.all.to_a.collect do |attachment|
re = attachment
for type in types
if not attachment.content_type
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
authorize! :submit, term_report
raise ActionController::BadRequest, "term report #{term_report.id} cannot be submitted because it has already been accepted." if term_report.accepted?
raise ActionController::BadRequest, "term report #{term_report.id} cannot be submitted because it has already been submitted." if term_report.submitted? && (term_report.submitted_at > term_report.rejected_at)
raise ActionController::BadRequest, "term report #{term_report.id} is not due." unless term_report.due?
- 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 children_cache_key
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def children_cache_key
"Group#{child_group_ids.sum if respond_to?(:child_group_ids)}Page#{child_page_ids.sum if respond_to?(:child_page_ids)}User#{child_user_ids.sum if respond_to?(:child_user_ids)}"
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 global_logo_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def global_logo_url
unless @logo_url
@logo_url = Attachment.logos.first.try(:file).try(:url)
# TODO # #current_navable.nav_node.breadcrumb_root
- 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"