Showing 328 of 433 total issues
Method get_request_variety_from_params
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_request_variety_from_params(params)
query = ""
sortby = "newest"
varieties = []
if params[:request_variety] && !(query =~ /variety:/)
- 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_attachment_leaves_recursive
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _get_attachment_leaves_recursive(part, within_rfc822_attachment, parent_mail)
leaves_found = []
if part.multipart?
if part.parts.empty?
# This is typically caused by a missing final
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run(*args)
# Run an external program, and return its output.
# Standard error is suppressed unless the program
# fails (i.e. returns a non-zero exit status).
# If the program fails, returns nil and writes any error to stderr.
- 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 migrate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def migrate
count = unattached_files.count
unattached_files.find_each.with_index do |file, index|
Kernel.silence_warnings 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 mirror
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def mirror
return puts(not_a_mirror) unless mirror_service?
return puts(mirror_primary_not_disk_service) unless disk_service?
count = mirrorable_blobs.count
- 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 holding_pen_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.holding_pen_request
ir = InfoRequest.find_by_url_title("holding_pen")
if ir.nil?
ir = InfoRequest.new(
user: User.internal_admin_user,
Method subscribe_follow_notice
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def subscribe_follow_notice(track_thing)
wall_url_user = show_user_wall_path(url_name: track_thing.tracking_user.url_name)
case track_thing.track_type
when 'request_updates'
_('You are now <a href="{{wall_url_user}}">following</a> updates about \'{{link_to_request}}\', a request.',
Method track_set
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def track_set
if @user
@existing_track = TrackThing.find_existing(@user, @track_thing)
if @existing_track
flash[:notice] =
Method send_daily_notifications
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.send_daily_notifications
done_something = false
query = "notifications.frequency = ? AND " \
"notifications.send_after <= ? AND " \
"notifications.seen_at IS NULL AND " \
Method run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(*args)
# Run an external program, and return its output.
# Standard error is suppressed unless the program
# fails (i.e. returns a non-zero exit status).
# If the program fails, returns nil and writes any error to stderr.
Method extract_attachments
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_attachments
_mail = raw_email.mail!
attachment_attributes = MailHandler.get_attachment_attributes(_mail)
attachment_attributes = attachment_attributes.inject({}) do |memo, attrs|
attrs.delete(:original_body)
Method recent_requests
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.recent_requests
request_events = []
request_events_all_successful = false
# Get some successful requests
begin
Method translated_fields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def translated_fields
fields = @template.tag.div id: 'div-locales' do
@template.concat(locale_tabs)
locales = @template.tag.div class: 'tab-content' do
Method status_text_waiting_clarification
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def status_text_waiting_clarification(info_request, opts = {})
is_owning_user = opts.fetch(:is_owning_user)
str = ''.html_safe
Method short_description
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.short_description(state)
descriptions = {
'waiting_classification' => _("Needs status update"),
'waiting_response' => _("Awaiting response"),
'waiting_response_overdue' => _("Delayed"),
Method set_locale_fields_from_csv_row
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_locale_fields_from_csv_row(is_new, locale, row, options)
changed = ActiveSupport::OrderedHash.new
csv_field_names = options[:field_names]
csv_import_fields.each do |field_name, _field_notes|
localized_field_name = self.class.localized_csv_field_name(locale, field_name)
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if @post_redirect.present?
@user_signin =
User.authenticate_from_form(user_signin_params,
@post_redirect.reason_params[:user_name])
Method render_exception
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_exception(exception)
# In development let Rails handle the exception with its stack trace
# templates.
raise exception if Rails.application.config.consider_all_requests_local
Method update
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
raise ActiveRecord::RecordNotFound if cannot? :admin, @comment
old_body = @comment.body.dup
old_visible = @comment.visible
Method _get_attachment_leaves_recursive
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _get_attachment_leaves_recursive(part, within_rfc822_attachment, parent_mail)
leaves_found = []
if part.multipart?
if part.parts.empty?
# This is typically caused by a missing final