Showing 58 of 433 total issues
Method alert_overdue_requests
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.alert_overdue_requests
info_requests = InfoRequest.where("described_state = 'waiting_response'
AND awaiting_description = ?
AND user_id is not null
AND use_notifications = ?
Method alert_tracks
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.alert_tracks
done_something = false
now = Time.zone.now
one_week_ago = now - 7.days
User.where(["last_daily_track_email < ?", now - 1.day ]).find_each do |user|
Method import_csv_from_file
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor, available_locales = [])
errors = []
notes = []
begin
ActiveRecord::Base.transaction do
Method body_request_events
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def body_request_events
feed_type = params[:feed_type]
if @public_body.id != params[:id].to_i
raise PermissionDenied, "#{@public_body.id} != #{params[:id]}"
end
Method alert_comment_on_request
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.alert_comment_on_request
# We only check comments made in the last month - this means if the
# cron jobs broke for more than a month events would be lost, but no
# matter. I suspect the performance gain will be needed (with an index on updated_at)
Method show
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def show
long_cache
@page = get_search_page_from_params
requests_per_page = 25
Method get_attachment_text_one_file
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
# NOTE: re. charset: TMail always tries to convert email bodies
# to UTF8 by default, so normally it should already be that.
text = ''
# TODO: - tell all these command line tools to return utf-8
Method upload_response
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def upload_response
AlaveteliLocalization.with_locale(locale) do
@info_request = InfoRequest.not_embargoed.find_by_url_title!(params[:url_title])
@reason_params = {
Method render_new_compose
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def render_new_compose
params[:info_request] = {} unless params[:info_request]
# Reconstruct the params
# first the public body (by URL name or id)
Method create
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create
set_last_request(@info_request)
if params[:last_info_request_event_id].to_i != @info_request.
last_event_id_needing_description
Method initialize_query
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize_query(options)
#raise options.to_yaml
self.runtime += Benchmark.realtime {
offset = options[:offset] || 0
Method signchangeemail
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
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),
Method public_bodies
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.public_bodies
per_graph = 10
minimum_requests = AlaveteliConfiguration.minimum_requests_for_statistics
# Make sure minimum_requests is > 0 to avoid division-by-zero
minimum_requests = [minimum_requests, 1].max
Method to_admin_message
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def to_admin_message(name, email, subject, message, logged_in_user, last_request, last_body)
Avoid deeply nested control flow statements. Open
Open
rescue
$stderr.puts("Error processing zip file: #{$ERROR_INFO.inspect}")
Avoid deeply nested control flow statements. Open
Open
raise "dry run mismatched real run" if !errors.empty?
Consider simplifying this complex logical expression. Open
Open
elsif curr_state && (event.event_type == 'followup_sent' || event.event_type == 'sent') && event.described_state && (event.described_state == 'waiting_response' || event.described_state == 'internal_review')
# Followups can set the status to waiting response / internal
# review. Initial requests ('sent') set the status to waiting response.
# We want to store that in calculated_state state so it gets
Avoid too many return
statements within this method. Open
Open
return true
Avoid too many return
statements within this method. Open
Open
return false if empty_return_path?
Avoid too many return
statements within this method. Open
Open
return 0