hpi-schuelerklub/workshop-portal

View on GitHub

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
Severity: Minor
Found in app/models/event.rb - About 5 hrs to fix

    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
    Severity: Minor
    Found in app/controllers/events_controller.rb - About 3 hrs to fix

    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
    Severity: Minor
    Found in app/controllers/events_controller.rb - About 2 hrs to fix

      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'
      Severity: Minor
      Found in app/controllers/events_controller.rb - About 2 hrs to fix

        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
        Severity: Minor
        Found in app/controllers/events_controller.rb - About 1 hr to fix

          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?
          Severity: Minor
          Found in app/models/ability.rb - About 1 hr to fix

            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();
            Severity: Minor
            Found in app/assets/javascripts/bootstrap-colorselector.js - About 1 hr to fix

              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
              Severity: Minor
              Found in app/models/event.rb - About 1 hr to fix

              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]
              Severity: Minor
              Found in app/controllers/application_letters_controller.rb - About 1 hr to fix

                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)
                Severity: Minor
                Found in app/controllers/application_letters_controller.rb - About 1 hr to fix

                  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
                  Severity: Major
                  Found in app/models/application_letter.rb - About 1 hr to fix

                    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|
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - About 45 mins to fix

                    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
                    Severity: Minor
                    Found in app/models/application_letter.rb - About 45 mins to fix

                    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 = [])
                    Severity: Minor
                    Found in app/services/mailer.rb - About 45 mins to fix

                      Method generic_email has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def generic_email(recipients, reply_to, subject, content, attached_files = [])
                      Severity: Minor
                      Found in app/mailers/portal_mailer.rb - About 35 mins to fix

                        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?
                        Severity: Minor
                        Found in app/models/ability.rb - About 35 mins to fix

                        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();
                        Severity: Minor
                        Found in app/assets/javascripts/applications.js - About 35 mins to fix

                        Parameter value used in file name
                        Open

                        send_file file_full_path, x_sendfile: true

                        Unescaped model attribute
                        Open

                        <%= @event.custom_application_fields

                        Avoid too many return statements within this method.
                        Open

                        return -1 if participant2.agreement_letter_for_event?(self)
                        Severity: Major
                        Found in app/models/event.rb - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language