Showing 213 of 251 total issues
Avoid too many return
statements within this method. Open
return 'former_member' if former_member?
Avoid too many return
statements within this method. Open
return 7.pt
Avoid too many return
statements within this method. Open
return 10.pt if num_of_lines_required(str, 10.pt) < 6
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 8.pt if num_of_lines_required(str, 8.pt) < 8
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 reference
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def reference
ref = super
if ref.kind_of? DagLink
if ref.ancestor_type == "Group" and ref.descendant_type == "User"
ref.becomes(Membership)
- 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 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 link_to_add_profile_field
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def link_to_add_profile_field( args )
raise ActionController::ParameterMissing, "expected argument 'profileable'" unless args[:profileable].present?
raise ActionController::ParameterMissing, "expected argument 'profile_field_type'" unless args[:profile_field_type].present?
raise ActionController::ParameterMissing, "expected argument 'profile_section'" unless args[:profile_section].present?
label_in_english_with_underscores = args[:profile_field_type].demodulize.underscore
- 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 to_csv
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_csv
CSV.generate(csv_options) do |csv|
csv << headers
data.each do |row|
csv << columns.collect do |column_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"
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"
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 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 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 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 allowed_preview_roles
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def allowed_preview_roles
return ['global_admin', 'admin', 'officer', 'global_officer', 'user', 'public'] if global_admin?
return ['admin', 'officer', 'user', 'public'] if admin?
return ['officer', 'global_officer', 'user', 'public'] if global_officer? and officer?
return ['officer', 'user', 'public'] if officer?
- 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"