Showing 213 of 251 total issues
Method execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute( params )
raise RuntimeError, 'no user_id given' unless params[ :user_id ]
raise RuntimeError, 'no group_id given' unless params[ :group_id ]
user = User.find( params[ :user_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 import_group_with_descendants
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.import_group_with_descendants(group)
Graph::Group.sync group
group.descendant_groups.each { |g| Graph::Group.sync g }
group.descendant_groups.each do |child|
child.links_as_child.each do |link|
- 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_local_officers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def rights_for_local_officers
can :export_member_list, Group do |group|
user.in? group.officers_of_self_and_ancestors
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 executable_workflows_by_corporation
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def executable_workflows_by_corporation(user)
if @executable_workflows_by_corporation && @executable_workflows_by_corporation[user.id]
@executable_workflows_by_corporation[user.id]
else
@executable_workflows_by_corporation ||= {}
- 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 restore_profile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def restore_profile
raise "This user (#{id}) already has an existing profile. Not restoring from backup file." if profile_fields.any?
hash = ActiveSupport::JSON.decode(File.read(latest_backup_file))
if (address = hash['profile_fields'].select { |pf| pf['type'] == "ProfileFields::Address" }.first) && address['children'].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 format_phone_number
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.format_phone_number( phone_number_str )
return "" if phone_number_str.nil?
value = phone_number_str
# determine whether this is an international number
- 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 current_ability
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def current_ability(reload = false, options = {})
if reload
@current_ability = nil
@current_role = nil
@current_role_view = nil
- 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 public_navables
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def public_navables
if current_home_page
pages = [current_home_page]
if current_home_page.respond_to? :horizontal_nav_child_pages
pages += current_home_page.horizontal_nav_child_pages
- 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_all_by
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.find_all_by( params )
user = params[ :user ]
user ||= User.find params[:user_id] if params[:user_id]
user ||= User.find_by_title params[:user_title] if params[:user_title]
group = params[ :group ]
- 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
Avoid deeply nested control flow statements. Open
elsif object.kind_of? Project
self.child_projects << object unless self.child_projects.include? object
elsif object.kind_of? WorkflowKit::Workflow
# # This does not work since `child_workflows` is no real association:
# self.child_workflows << object unless self.child_workflows.include? object
Method convert_group_names_to_group_hashes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def convert_group_names_to_group_hashes( group_names )
group_names.map do |array_item|
if array_item.kind_of? String
{ name: array_item }
elsif array_item.kind_of? 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 status_export_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def status_export_string
self.corporations.collect do |corporation|
if membership = self.current_status_membership_in(corporation)
"#{I18n.localize(membership.valid_from.to_date) if membership.valid_from}: #{membership.group.name.try(:singularize)} in #{corporation.name}"
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 website
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def website
unless @website
@website = website_fields.first.try(:value)
@website = "https://#{@website}" if @website and not (@website.start_with?("http://") or @website.start_with?("https://"))
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
Avoid deeply nested control flow statements. Open
unless self.events.include? object
self.events << object
end
Avoid deeply nested control flow statements. Open
Sidekiq::Logging.logger.info "#{self.title} # navable caching for #{descendant.title}" if Sidekiq::Logging.logger && (! Rails.env.test?)
Method navable_children
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def navable_children
(respond_to?(:child_groups) ? child_groups : []) +
(respond_to?(:child_pages) ? child_pages.where.not(id: nil) : [])
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
Avoid deeply nested control flow statements. Open
sender_line if @sender and address.to_s.present?
Avoid deeply nested control flow statements. Open
rescue Prawn::Errors::IncompatibleStringEncoding
logger.warn "PDF ADDRESS LABEL EXPORT ENCODING ISSUE for #{address_label.name}."
text "ENCODING ISSUE!"
Avoid deeply nested control flow statements. Open
part.body.raw_source.replace part.body.decoded.gsub(search, replace) if part.body.decoded.include? search
Method fill_small_map_address_fields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fill_small_map_address_fields
# On collection groups, e.g. the corporations_parent group, only the
# groups should be shown on the map. These groups have a lot of
# child groups with address profile fields.
#
- 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"