Showing 328 of 433 total issues
Method bulk_destroy
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bulk_destroy
if params[:commit] == "No"
redirect_to(admin_request_url(params[:request_id]))
end
Method _destroy_and_rebuild_index_safely
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self._destroy_and_rebuild_index_safely(model_classes, verbose, terms, values, texts)
batch_size = 1000
model_classes.each do |model_class|
model_class_count = model_class.count
0.step(model_class_count, batch_size) do |i|
Method attempt_to_find_original_attachment_attributes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attempt_to_find_original_attachment_attributes(mail, body:, nested: false)
all_attributes = get_attachment_attributes(mail)
def calculate_hexdigest(body)
# ensure bodies have the same line endings and are encoded the same
Method get_status_from_params
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_status_from_params(params)
query = ""
if params[:latest_status]
statuses = []
if params[:latest_status].class == String
Method phase
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def phase(cached_value_ok=false)
if @info_request.awaiting_description?
:response_received
else
state = @info_request.calculate_status(cached_value_ok)
Method timeline
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def timeline
# Recent events
@events_title = get_events_title
@events = WillPaginate::Collection.create((params[:page] or 1), 100) do |pager|
Method get_status_description
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_status_description(status)
descriptions = {
'waiting_classification' => _("Awaiting classification."),
'waiting_response' => _("Awaiting response."),
'waiting_response_overdue' => _("Delayed."),
Method update
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
if @user.suspended?
flash[:error] = _('Suspended users cannot edit their profile')
redirect_to edit_profile_about_me_path
return
Method update_index
has 28 lines of code (exceeds 25 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
Method authenticate_from_form
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.authenticate_from_form(params, specific_user_login = false)
params[:email].strip!
if specific_user_login
auth_fail_message = _("Either the email or password was not recognised, please try again.")
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def create
set_last_request(@info_request)
if params[:last_info_request_event_id].to_i != @info_request.
last_event_id_needing_description
- 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 default_message_replacements
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def default_message_replacements
opts = {}
if info_request
opts[:url] = request_url(info_request) if info_request.url_title
- 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 show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def show
medium_cache
AlaveteliLocalization.with_locale(locale) do
# Test for whole request being hidden
return render_hidden if cannot?(:read, @info_request)
- 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 template_changed
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def template_changed
if raw_body.empty? || HTMLEntities.new.decode(raw_body) =~
/\A#{template_regex(letter_template.body(default_message_replacements))}/
if message_type == 'followup'
if what_doing == 'internal_review'
- 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 foi_error_messages_for
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def foi_error_messages_for(*params)
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
objects = params.collect { |object_name| instance_variable_get("@#{object_name}") }.compact
count = objects.inject(0) { |sum, object| sum + object.errors.count }
return if count.zero?
- 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 list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def list
long_cache
@tag = params[:tag] || 'all'
@tag = @tag.upcase if @tag.scan(/./mu).size == 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 create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
begin
@pro_account = current_user.pro_account ||= current_user.build_pro_account
# Ensure previous incomplete subscriptions are cancelled to prevent them
- 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 cache_attachments
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cache_attachments
if !params[:skip_cache].nil?
yield
else
if foi_fragment_cache_exists?(cache_key_path)
- 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 start
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def start()
# Start a POP3 session and ensure that it will be closed in any case.
unless block_given?
raise ArgumentError, "AlaveteliMailPoller#start takes a block"
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 extract_attached_message_headers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def extract_attached_message_headers(leaf)
body = get_part_body(leaf)
# Test to see if we are in the first part of the attached
# RFC822 message and it is text, if so add headers.
if leaf.within_rfc822_attachment == leaf && get_content_type(leaf) == 'text/plain'
- 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"