openSUSE/osem

View on GitHub

Showing 151 of 151 total issues

Method toggle_user has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def toggle_user
      user = User.find_by(email: user_params[:email])
      state = user_params[:state]

      url = if @track
Severity: Minor
Found in app/controllers/admin/roles_controller.rb - About 1 hr to fix

    Method calendar has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def calendar
        respond_to do |format|
          format.ics do
            calendar = Icalendar::Calendar.new
            Conference.all.each do |conf|
    Severity: Minor
    Found in app/controllers/conferences_controller.rb - About 1 hr to fix

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            respond_to do |format|
              format.html
              # Explicitly call #to_json to avoid the use of EventSerializer
              format.json { render json: Booth.where(state: :confirmed, program: @program).to_json }
              format.xlsx do
      Severity: Major
      Found in app/controllers/admin/booths_controller.rb and 2 other locations - About 1 hr to fix
      app/controllers/admin/events_controller.rb on lines 25..37
      app/controllers/admin/tracks_controller.rb on lines 16..28

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 62.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            respond_to do |format|
              format.html
              # Explicitly call #to_json to avoid the use of EventSerializer
              format.json { render json: Event.where(state: :confirmed, program: @program).to_json }
              format.xlsx do
      Severity: Major
      Found in app/controllers/admin/events_controller.rb and 2 other locations - About 1 hr to fix
      app/controllers/admin/booths_controller.rb on lines 11..23
      app/controllers/admin/tracks_controller.rb on lines 16..28

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 62.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

            respond_to do |format|
              format.html
              # Explicitly call #to_json to avoid the use of EventSerializer
              format.json { render json: Track.where(state: :confirmed, program: @program).to_json }
              format.xlsx do
      Severity: Major
      Found in app/controllers/admin/tracks_controller.rb and 2 other locations - About 1 hr to fix
      app/controllers/admin/booths_controller.rb on lines 11..23
      app/controllers/admin/events_controller.rb on lines 25..37

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 62.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Method show has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def show
            @program = @conference.program || Program.new(conference_id: @conference.id)
      
            # Overview and since last login information
            @total_reg = @conference.registrations.count
      Severity: Minor
      Found in app/controllers/admin/conferences_controller.rb - About 1 hr to fix

        Method show has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
            event_schedules = @program.selected_event_schedules(
              includes: [{ event: %i[event_type speakers submitter] }]
            )
        
        
        Severity: Minor
        Found in app/controllers/schedules_controller.rb - About 1 hr to fix

          Method user_change_description has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def user_change_description(version)
              if version.event == 'create'
                link_to_user(version.item_id) + ' signed up'
              elsif version.event == 'update'
                if version.changeset.keys.include?('reset_password_sent_at')
          Severity: Minor
          Found in app/helpers/versions_helper.rb - About 1 hr to fix

          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 reply has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

            def reply
              unless can? :reply, @survey
                redirect_to conference_survey_path(@conference, @survey), alert: 'This survey is currently closed'
                return
              end
          Severity: Minor
          Found in app/controllers/surveys_controller.rb - About 1 hr to fix

          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 signed_in_with_cfp_role has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def signed_in_with_cfp_role(user)
              # ids of all the conferences for which the user has the 'cfp' role
              conf_ids_for_cfp = Conference.with_role(:cfp, user).pluck(:id)
          
              can :show, Conference do |conf|
          Severity: Minor
          Found in app/models/admin_ability.rb - About 1 hr to fix

            Method signed_in_with_track_organizer_role has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def signed_in_with_track_organizer_role(user)
                # ids of all the conferences for which the user has the 'track organizer' role
                conf_ids_for_track_organizer = Track.with_role(:track_organizer, user).joins(:program).pluck(:conference_id)
                # ids of all the tracks for which the user has the 'track_organizer' role
                track_ids_for_track_organizer = Track.with_role(:track_organizer, user).pluck(:id)
            Severity: Minor
            Found in app/models/admin_ability.rb - About 1 hr to fix

              Function add has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                add: function (previous_parent, new_parent, event) {
                  event.appendTo(new_parent);
                  var event_schedule_id = event.attr("event_schedule_id");
                  var my_url = url;
                  var type = 'POST';
              Severity: Minor
              Found in app/assets/javascripts/osem-schedule.js - About 1 hr to fix

                Method create has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    @url = conference_program_proposals_path(@conference.short_title)
                
                    # We allow proposal submission and sign up on same page.
                    # If user is not signed in then first create new user and then sign them in
                Severity: Minor
                Found in app/controllers/proposals_controller.rb - About 1 hr to fix

                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 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create
                    @registration = @conference.registrations.new(registration_params)
                
                    @user = if current_user.nil?
                              # @user needs to be set for devise/registrations/new_embedded
                Severity: Minor
                Found in app/controllers/conference_registrations_controller.rb - About 1 hr to fix

                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 not_signed_in has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def not_signed_in
                    can [:index], Conference
                    can [:show], Conference do |conference|
                      conference.splashpage&.public == true
                    end
                Severity: Minor
                Found in app/models/ability.rb - About 1 hr to fix

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def reject
                        @booth.reject!
                  
                        if @booth.save
                          if @conference.email_settings.send_on_booths_rejection
                  Severity: Major
                  Found in app/controllers/admin/booths_controller.rb and 1 other location - About 1 hr to fix
                  app/controllers/admin/booths_controller.rb on lines 68..79

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def accept
                        @booth.accept!
                  
                        if @booth.save
                          if @conference.email_settings.send_on_booths_acceptance
                  Severity: Major
                  Found in app/controllers/admin/booths_controller.rb and 1 other location - About 1 hr to fix
                  app/controllers/admin/booths_controller.rb on lines 91..102

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 52.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Method draw_second_square has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def draw_second_square
                      move_up 150
                      if @conference.picture?
                        conference_image = case @conference.picture.ticket.url[0, 4]
                                           when 'http', 'ftp:' # CDNs
                  Severity: Minor
                  Found in app/pdfs/ticket_pdf.rb - About 1 hr to fix

                    Method revert_attribute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def revert_attribute
                          if params[:attribute] && @version.changeset.reject{ |_, values| values[0].blank? && values[1].blank? }.keys.include?(params[:attribute])
                            if @version.item[params[:attribute]] == @version.changeset[params[:attribute]][0]
                              flash[:error] = 'The item is already in the state that you are trying to revert it back to'
                    
                    
                    Severity: Minor
                    Found in app/controllers/admin/versions_controller.rb - About 1 hr to fix

                    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 total_price has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.total_price(conference, user, paid: false)
                        tickets = Ticket.where(conference_id: conference.id)
                        result = nil
                        begin
                          tickets.each do |ticket|
                    Severity: Minor
                    Found in app/models/ticket.rb - About 1 hr to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language