Showing 208 of 208 total issues
Class Event
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ActiveRecord::Base UNREASONABLY_LONG_DATE_SPAN = 300 TRUNCATE_DESCRIPTION_TEXT_LENGTH = 250 serialize :custom_application_fields, Array
Method download_agreement_letters
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def download_agreement_letters @event = Event.find(params[:id]) unless params.key?(:selected_participants) redirect_to(event_participants_url(@event), notice: I18n.t('events.agreement_letters_download.notices.no_participants_selected')) && return end
- Read upRead up
Class EventsController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class EventsController < ApplicationController include EventImageUploadHelper load_and_authorize_resource skip_authorize_resource only: %i(badges download_agreement_letters send_participants_email) before_action :set_event, only: %i(show edit update destroy participants
File events_controller.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pdf_generation/badges_pdf'require 'pdf_generation/applications_pdf'require 'pdf_generation/participants_pdf'require 'rubygems'require 'zip'
Method download_agreement_letters
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download_agreement_letters @event = Event.find(params[:id]) unless params.key?(:selected_participants) redirect_to(event_participants_url(@event), notice: I18n.t('events.agreement_letters_download.notices.no_participants_selected')) && return end
Method initialize
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(user) # Define abilities for the passed in user here. For example: # # user ||= User.new # guest user (not logged in) # if user.admin?
Function _init
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
_init : function() { var callback = this.options.callback; var selectValue = this.$select.val();
Method compare_participants_by_agreement
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def compare_participants_by_agreement(participant1, participant2) unless participant1.requires_agreement_letter_for_event?(self) unless participant2.requires_agreement_letter_for_event?(self) return participant1.email <=> participant2.email end
- Read upRead up
Method create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create @application_letter = ApplicationLetter.new(application_params) # event must be param to new_application_letter_path seminar_name = '' if params[:event_id]
Method new
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new if !current_user message = I18n.t('application_letters.login_before_creation') flash[:event_id] = params[:event_id] flash.keep(:event_id)
Consider simplifying this complex logical expression. Open
if event.phase == :execution (status_was == 'accepted' && status == 'canceled') || (status_was == 'alternative' && status == 'accepted') || (status_was == 'rejected' && status == 'accepted' && !event.has_alternative_application_letters?) elsif event.phase == :selection && event.participant_selection_locked false else
Method add_missing_permission_flashes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_missing_permission_flashes if current_user flash.now[:warning] ||= [] current_user.events_with_missing_agreement_letters.each do |event|
- Read upRead up
Method status_change_allowed?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def status_change_allowed? if event.phase == :execution (status_was == 'accepted' && status == 'canceled') || (status_was == 'alternative' && status == 'accepted') || (status_was == 'rejected' && status == 'accepted' && !event.has_alternative_application_letters?) elsif event.phase == :selection && event.participant_selection_locked false
- Read upRead up
Method send_generic_email
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.send_generic_email(hide_recipients, recipients, reply_to, subject, content, attachments = [])
Method generic_email
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def generic_email(recipients, reply_to, subject, content, attached_files = [])
Method initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user) # Define abilities for the passed in user here. For example: # # user ||= User.new # guest user (not logged in) # if user.admin?
- Read upRead up
Function ajaxUpdateApplicationStatus
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function ajaxUpdateApplicationStatus(form, errorMessage) { if (!window.FormData) return form.submit(); var xhr = new XMLHttpRequest();
- Read upRead up
Parameter value used in file name Open
send_file file_full_path, x_sendfile: true
- Read upRead up
- Exclude checks
Avoid too many return
statements within this method. Open
return -1 if participant2.agreement_letter_for_event?(self)