Showing 338 of 434 total issues
Method signchangeemail
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def signchangeemail
# "authenticated?" has done the redirect to signin page for us
return unless authenticated? || ask_to_login(
web: _('To change your email address used on {{site_name}}',
site_name: site_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 authorise
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def authorise
@subscription = current_user.pro_account.subscriptions.
retrieve(params.require(:id))
if !@subscription
- 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 contact
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def contact
# if they clicked remove for link to request/body, remove it
if params[:remove]
@last_request = nil
cookies['last_request_id'] = 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 to_admin_message
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def to_admin_message(name, email, subject, message, logged_in_user, last_request, last_body)
Method with_query
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.with_query(query, tag)
like_query = "%#{query}%"
has_first_letter = tag.size == 1
underscore_locale = AlaveteliLocalization.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 valid_to_reply_to?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_to_reply_to?
email = from_email.try(:downcase)
# check validity of email
return false if email.nil? || !MySociety::Validate.is_valid_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"
Further reading
Method params_diff
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def params_diff
# split out parameters into old/new diffs, and other ones
old_params = {}
new_params = {}
other_params = {}
- 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 set_described_state
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_described_state(new_state, set_by = nil, message = "")
old_described_state = described_state
ActiveRecord::Base.transaction do
self.awaiting_description = false
last_event = info_request_events.last
- 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 populate_from_ical_feed
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def populate_from_ical_feed
cal_file = open(ical_feed_url)
cal_parser = Icalendar::Parser.new(cal_file)
cals = cal_parser.parse
cal = cals.first
- 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_csv_from_file
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor, available_locales = [])
Method unmasked_body
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unmasked_body
MailHandler.attachment_body_for_hexdigest(
raw_email.mail,
hexdigest: hexdigest
)
- 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_csv
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.import_csv(csv, tag, tag_behaviour, dry_run, editor, available_locales = [])
Method get_main_body_text_part
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_main_body_text_part(leaves=[])
leaves = foi_attachments if leaves.empty?
# Find first part which is text/plain or text/html
# (We have to include HTML, as increasingly there are mail clients that
- 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 explorable_in_datasette?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def explorable_in_datasette?(attachment)
return false unless attachment.is_public?
return false unless attachment.incoming_message.is_public?
return false unless info_request_is_public?(attachment)
return false unless attachment.content_type == 'text/csv'
- 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 redeliver
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def redeliver
message_ids = params[:url_title].split(',').map(&:strip)
previous_request = @incoming_message.info_request
destination_request = 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 update_index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.update_index(flush = false, verbose = false)
# STDOUT.puts("start of ActsAsXapian.update_index") if verbose
# Before calling writable_init we have to make sure every model class has been initialized.
# i.e. has had its class code loaded, so acts_as_xapian has been called inside it, and
- 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 ensure_masked
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ensure_masked
if @attachment.masked?
yield
else
FoiAttachmentMaskJob.perform_later(@attachment)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def create
AlaveteliLocalization.with_locale(AlaveteliLocalization.default_locale) do
if params[:change_request_id]
@change_request = PublicBodyChangeRequest.find(params[:change_request_id])
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 perform_search
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def perform_search(models, query, sortby, collapse, per_page = 25, this_page = nil)
Method index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index
@title ||= 'Listing users'
@query = params[:query].try(:strip)
- 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"