Showing 337 of 433 total issues
Method user_link_for_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def user_link_for_request(request)
if request.is_external?
user_name = request.external_user_name || _("Anonymous user")
if !request.external_url.nil?
link_to user_name, request.external_url
- 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 pending_states
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pending_states(opts)
# Which pending states can we transition into
if opts.fetch(:in_internal_review, false)
states = %w[internal_review gone_postal]
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 short_or_long_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def short_or_long_name
if short_name.nil? || short_name.empty?
name.nil? ? "" : name
else
short_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 get_present_file_extensions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_present_file_extensions
ret = {}
get_attachments_for_display.each do |attachment|
ext = AlaveteliFileTypes.mimetype_to_extension(attachment.content_type)
if ext.nil? && !attachment.filename.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 cut_excerpt_part
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cut_excerpt_part(part_position, part, separator, options)
return "", "" unless part
radius = options.fetch(:radius, 100)
omission = options.fetch(:omission, "...")
- 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 request_exim_sent?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.request_exim_sent?(ir)
# Look for line showing request was sent
found = false
ir.mail_server_logs.each do |mail_server_log|
test_outgoing = " <= " + ir.incoming_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 _convert_part_body_to_text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _convert_part_body_to_text(part)
if part.nil?
text = "[ Email has no body, please see attachments ]"
else
# whatever kind of attachment it is, get the UTF-8 encoded text
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
if @admin_user.update(user_params)
if @admin_user == @user && !@admin_user.is_admin?
flash[:notice] = 'User successfully updated - ' \
'you are no longer an admin.'
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
raise ActiveRecord::RecordNotFound if cannot? :admin, @comment
old_body = @comment.body.dup
old_visible = @comment.visible
- 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 alert_survey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.alert_survey
return unless Survey.enabled?
InfoRequest.surveyable.each do |info_request|
# Exclude users who have already completed the survey or
- 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 readable_init
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.readable_init
unless ActsAsXapian.bindings_available
raise NoXapianRubyBindingsError, "Xapian Ruby bindings not installed"
end
if @@init_values.empty?
- 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 view_email
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def view_email
@public_body = PublicBody.find_by_url_name_with_historic(params[:url_name])
raise ActiveRecord::RecordNotFound, "None found" if @public_body.nil?
AlaveteliLocalization.with_locale(AlaveteliLocalization.locale) do
- 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 search_redirect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def search_redirect
@query = params.delete(:query)
if @query.nil? || @query.empty?
@query = nil
@page = 1
- 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 filename_and_content_to_mimetype
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filename_and_content_to_mimetype(filename, content)
# Try filename
ret = filename_to_mimetype(filename)
return ret unless ret.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 normalise_content_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalise_content_type(content_type)
# e.g. http://www.whatdotheyknow.com/request/93/response/250
if (content_type == 'application/excel') || (content_type == 'application/msexcel') || (content_type == 'application/x-ms-excel')
content_type = 'application/vnd.ms-excel'
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 new_stripe_users
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def new_stripe_users
count = 0
sub_ids = []
stripe_plans.each do |plan_id|
Stripe::Subscription.list(
- 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 get_all_addresses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_all_addresses(mail, include_invalid: false)
addrs = []
addrs << mail.to
addrs << mail[:to].try(:value) if mail.to.nil? && include_invalid
addrs << mail.cc
- 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"