mconf/mconf-web

View on GitHub

Showing 130 of 130 total issues

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

  def decline
    # canceling a request/invitation means it will be destroyed, otherwise it is actually
    # marked as declined and kept in the database
    user_canceling_request = @join_request.is_request? && @join_request.candidate == current_user
    admin_canceling_invitation = @join_request.is_invite? &&
Severity: Minor
Found in app/controllers/join_requests_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 handle_access_denied has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_access_denied(exception)

    # anonymous users are required to sign in
    if !user_signed_in?
      redirect_to login_path
Severity: Minor
Found in app/controllers/spaces_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 logo_image has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def logo_image(resource, options={})
    options[:size] = validate_logo_size(options[:size])

    if resource.is_a?(User)
      model_type = :user
Severity: Minor
Found in app/helpers/logo_images_helper.rb - About 1 hr to fix

    Method link_to_trackable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def link_to_trackable(trackable, cls, options = {})
        if trackable.nil?
          # e.g. 'MyModule::Event' to 'my_module_event'
          cls = cls.underscore.gsub(/\//, '_')
    
    
    Severity: Minor
    Found in app/helpers/public_activities_helper.rb - About 1 hr to fix

      Method login has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def login
          certificate = request.headers['SSL_CLIENT_CERT']
      
          @cert = Mconf::SSLClientCert.new(certificate, session)
      
      
      Severity: Minor
      Found in app/controllers/certificate_authentication_controller.rb - About 1 hr to fix

        Method invitation_email has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def invitation_email(invitation)
            @invitation = Invitation.find(invitation)
        
            if @invitation.recipient.nil?
              if @invitation.recipient_email.nil?
        Severity: Minor
        Found in app/mailers/event_mailer.rb - About 1 hr to fix

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

              def register_abilities(user)
                can :manage, :all
          
                cannot [:leave], Space do |space|
                  !space.users.include?(user) || space.is_last_admin?(user)
          Severity: Minor
          Found in app/models/abilities/superuser_ability.rb - About 1 hr to fix

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

              def associate_with_new_account(shib)
                token = shib.find_or_create_token()
            
                # if there's already a user and an association, we don't need to do anything, just
                # return and, when the user is redirected back to #login, the token will be checked again
            Severity: Minor
            Found in app/controllers/shibboleth_controller.rb - About 1 hr to fix

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

                def associate_with_new_account(shib)
                  token = shib.find_or_create_token()
              
                  # if there's already a user and an association, we don't need to do anything, just
                  # return and, when the user is redirected back to #login, the token will be checked again
              Severity: Minor
              Found in app/controllers/shibboleth_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 spaces has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def spaces
                  words = params[:q].try(:split, /\s+/)
                  query = Space.with_disabled.search_by_terms(words, can?(:manage, Space)).search_order
              
                  # start applying filters
              Severity: Minor
              Found in app/controllers/manage_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 process_invitations has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def process_invitations
                  already_invited = []
                  errors = []
                  success = []
                  ids = params[:candidates].try(:split, ',') || []
              Severity: Minor
              Found in app/controllers/join_requests_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 notify_admins_of_users_pending_approval has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.notify_admins_of_users_pending_approval
                  # The Activities with keys user.created are used to inform the admins that a
                  # new user has registered.
                  activities = get_recent_activity
                    .where(trackable_type: 'User', notified: [nil, false], key: 'user.created')
              Severity: Minor
              Found in app/workers/user_notifications_worker.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 space_join_button has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def space_join_button(space, options={})
              
                  # no user logged, renders a register button
                  if !user_signed_in?
                    options[:class] = "#{options[:class]} btn btn-large btn-block btn-success"
              Severity: Minor
              Found in app/helpers/spaces_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 login has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def login
                  certificate = request.headers['SSL_CLIENT_CERT']
              
                  @cert = Mconf::SSLClientCert.new(certificate, session)
              
              
              Severity: Minor
              Found in app/controllers/certificate_authentication_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 load_spaces_index has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def load_spaces_index
                  spaces = Space.where(approved: true)
                  @user_spaces = user_signed_in? ? current_user.spaces : Space.none
                  words = params[:q].try(:split, /\s+/)
              
              
              Severity: Minor
              Found in app/controllers/spaces_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 send_invitation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def send_invitation
                  # adjusts the dates set by the user in the datetimepicker to dates we can set in the invitation
                  if !adjust_dates_for_invitation(params)
                    flash[:error] = t('custom_bigbluebutton_rooms.send_invitation.error_date_format')
              
              
              Severity: Minor
              Found in app/controllers/custom_bigbluebutton_rooms_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 recordings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def recordings
                  words = params[:q].try(:split, /\s+/)
                  query = BigbluebuttonRecording.search_by_terms(words).search_order
              
                  [:published, :available].each do |filter|
              Severity: Minor
              Found in app/controllers/manage_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 associate_with_existent_account has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def associate_with_existent_account(shib)
              
                  # try to authenticate the user with his login and password
                  valid = false
                  if params.has_key?(:user)
              Severity: Minor
              Found in app/controllers/shibboleth_controller.rb - About 1 hr to fix

                Method find_or_create_token_and_user has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def find_or_create_token_and_user
                      @token = find_or_create_token
                      @user = @token.user
                
                      if @user.nil?
                Severity: Minor
                Found in lib/mconf/ssl_client_cert.rb - About 1 hr to fix

                  Method process_invitations has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def process_invitations
                      already_invited = []
                      errors = []
                      success = []
                      ids = params[:candidates].try(:split, ',') || []
                  Severity: Minor
                  Found in app/controllers/join_requests_controller.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language