mconf/mconf-web

View on GitHub

Showing 130 of 130 total issues

Class User has 49 methods (exceeds 20 allowed). Consider refactoring.
Open

class User < ActiveRecord::Base
  include PublicActivity::Common
  include Mconf::ApprovalModule
  include Mconf::DisableModule

Severity: Minor
Found in app/models/user.rb - About 6 hrs to fix

    Method authenticate! has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

          def authenticate!
            if ldap_enabled? && valid_params_sent?
              Rails.logger.info "LDAP: LDAP is enabled, trying to connect to LDAP server"
              configs = ldap_configs
              ldap = ldap_connection(configs)
    Severity: Minor
    Found in lib/devise/strategies/ldap_authenticatable.rb - About 4 hrs 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

    File user.rb has 357 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'devise/encryptors/station_encryptor'
    require 'digest/sha1'
    require './lib/mconf/approval_module'
    
    class User < ActiveRecord::Base
    Severity: Minor
    Found in app/models/user.rb - About 4 hrs to fix

      Method bigbluebutton_role has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

        def bigbluebutton_role(room)
          if BigbluebuttonRails.configuration.guest_support
            guest_role = :guest
          else
            guest_role = :attendee
      Severity: Minor
      Found in lib/mconf/bigbluebutton_rails_controller_module.rb - About 4 hrs 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

      Class Space has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Space < ActiveRecord::Base
        include PublicActivity::Common
        include Mconf::ApprovalModule
        include Mconf::DisableModule
      
      
      Severity: Minor
      Found in app/models/space.rb - About 3 hrs to fix

        Method logo_image has a Cognitive Complexity of 25 (exceeds 5 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 3 hrs 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 24 (exceeds 5 allowed). Consider refactoring.
        Open

          def login
        
            # to force a redirect back to where the user was
            # needed because the app would block a redirect since the auth is in an external url
            params["return_to"] = user_return_to
        Severity: Minor
        Found in app/controllers/shibboleth_controller.rb - About 3 hrs 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 update has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            # map cropping attributes to be attributes of the profile
            [:crop_x, :crop_y, :crop_w, :crop_h, :crop_img_w, :crop_img_h].each do |attr|
              if params['user'] && params['user'][attr.to_s]
                @user.profile.send("#{attr}=", params['user'][attr.to_s])
        Severity: Minor
        Found in app/controllers/users_controller.rb - About 3 hrs 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 24 (exceeds 5 allowed). Consider refactoring.
        Open

          def create
        
            # if it's an admin creating new requests (inviting) for his space
            if params[:type] == 'invite' && can?(:manage_join_requests, @space)
              success, errors, already_invited = process_invitations
        Severity: Minor
        Found in app/controllers/join_requests_controller.rb - About 3 hrs 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 register_abilities has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def register_abilities(user)
              abilities_for_bigbluebutton_rails(user)
        
              # Users
              can [:index, :show, :fellows, :current, :select], User
        Severity: Major
        Found in app/models/abilities/member_ability.rb - About 3 hrs to fix

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

          class Event < ActiveRecord::Base
            extend FriendlyId
          
            include PublicActivity::Common
          
          
          Severity: Minor
          Found in app/models/event.rb - About 3 hrs to fix

            Class SpacesController has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class SpacesController < InheritedResources::Base
              include Mconf::ApprovalControllerModule # for approve, disapprove
              include Mconf::DisableControllerModule # for enable, disable
              include Mconf::SelectControllerModule # select
            
            
            Severity: Minor
            Found in app/controllers/spaces_controller.rb - About 3 hrs to fix

              Method link_to_trackable has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 authenticate! has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def authenticate!
                      if ldap_enabled? && valid_params_sent?
                        Rails.logger.info "LDAP: LDAP is enabled, trying to connect to LDAP server"
                        configs = ldap_configs
                        ldap = ldap_connection(configs)
              Severity: Major
              Found in lib/devise/strategies/ldap_authenticatable.rb - About 2 hrs to fix

                Class Shibboleth has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Shibboleth
                
                    # the key used to indicate in the session if the user is signed in
                    # via shibboleth or not
                    SESSION_KEY = :shib_login
                Severity: Minor
                Found in lib/mconf/shibboleth.rb - About 2 hrs to fix

                  Method call has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def call(env)
                      ssl_failed = false
                  
                      if /^\/users\/certificate(.json)/.match env['REQUEST_URI']
                        ENV['SSL_CLIENT_CERT'] ||= ''
                  Severity: Minor
                  Found in lib/extras/client_cert_middleware.rb - About 2 hrs 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

                  Class SSLClientCert has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class SSLClientCert
                  
                      # the key used to indicate in the session if the user is signed in
                      # via certificate or not
                      SESSION_KEY = :certificate_login
                  Severity: Minor
                  Found in lib/mconf/ssl_client_cert.rb - About 2 hrs to fix

                    Method process_additions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def process_additions
                        errors = []
                        success = []
                        ids = params[:candidates].try(:split, ',') || []
                        ids.each do |id|
                    Severity: Minor
                    Found in app/controllers/join_requests_controller.rb - About 2 hrs 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 users has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def users
                        words = params[:q].try(:split, /\s+/)
                        query = User.with_disabled.search_by_terms(words, can?(:manage, User)).search_order
                    
                        [:disabled, :approved, :can_record].each do |filter|
                    Severity: Minor
                    Found in app/controllers/manage_controller.rb - About 2 hrs 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 bigbluebutton_role has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def bigbluebutton_role(room)
                        if BigbluebuttonRails.configuration.guest_support
                          guest_role = :guest
                        else
                          guest_role = :attendee
                    Severity: Major
                    Found in lib/mconf/bigbluebutton_rails_controller_module.rb - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language