codebar/planner

View on GitHub

Showing 11 of 191 total issues

Class WorkshopsController has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

class Admin::WorkshopsController < Admin::ApplicationController
  include  Admin::SponsorConcerns
  include  Admin::WorkshopConcerns

  before_action :set_workshop_by_id, only: %i[show edit destroy update]
Severity: Minor
Found in app/controllers/admin/workshops_controller.rb - About 3 hrs to fix

    Class ApplicationController has 25 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class ApplicationController < ActionController::Base
      protect_from_forgery with: :exception
    
      include Pundit::Authorization
      include Pagy::Backend
    Severity: Minor
    Found in app/controllers/application_controller.rb - About 2 hrs to fix

      Class EventPresenter has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class EventPresenter < BasePresenter
        PRESENTER = { workshop: 'WorkshopPresenter',
                      meeting: 'MeetingPresenter',
                      event: 'EventPresenter' }.freeze
      
      
      Severity: Minor
      Found in app/presenters/event_presenter.rb - About 2 hrs to fix

        Method attend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

          def attend
            event = @invitation.event
            return redirect_back fallback_location: root_path, notice: t('messages.already_rsvped') if @invitation.attending?
        
            if @invitation.student_spaces? || @invitation.coach_spaces?
        Severity: Minor
        Found in app/controllers/invitations_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 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create
            member_type = cookies[:member_type]
            current_service = AuthService.find_by(provider: omnihash[:provider],
                                                  uid: omnihash[:uid])
        
        
        Severity: Minor
        Found in app/controllers/auth_services_controller.rb - About 1 hr to fix

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

            def create
              member_type = cookies[:member_type]
              current_service = AuthService.find_by(provider: omnihash[:provider],
                                                    uid: omnihash[:uid])
          
          
          Severity: Minor
          Found in app/controllers/auth_services_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 reject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def reject
                @workshop = WorkshopPresenter.decorate(@invitation.workshop)
                if @invitation.workshop.date_and_time - 3.5.hours >= Time.zone.now
          
                  if @invitation.attending.eql? false
          Severity: Minor
          Found in app/controllers/concerns/invitation_controller_concerns.rb - About 45 mins 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 accept has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def accept
                user = current_user || @invitation.member
                workshop = @invitation.workshop
                return back_with_message(t('messages.already_rsvped')) if @invitation.attending?
          
          
          Severity: Minor
          Found in app/controllers/concerns/invitation_controller_concerns.rb - About 45 mins 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 mail_args has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def mail_args(member, subject, from_email = 'meetings@codebar.io', cc = '', bcc = '')
          Severity: Minor
          Found in app/helpers/email_header_helper.rb - About 35 mins to fix

            Method rsvp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def rsvp
                unless @workshop.available_for_rsvp?
                  return redirect_back(
                    fallback_location: root_path,
                    notice: t('workshops.registration_not_open')
            Severity: Minor
            Found in app/controllers/workshops_controller.rb - About 25 mins 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 send_event_emails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def send_event_emails(event, chapter)
                return 'The event is not invitable' unless event.invitable?
            
                invite_coaches_to_event(event, chapter) unless event.audience.eql?('Students')
                invite_students_to_event(event, chapter) unless event.audience.eql?('Coaches')
            Severity: Minor
            Found in app/models/invitation_manager.rb - About 25 mins 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