mconf/mconf-web

View on GitHub

Showing 102 of 130 total issues

Method send_invitation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def send_invitation
    if params[:invite][:title].blank?
      flash[:error] = t('events.send_invitation.error_title')

    elsif params[:invite][:users].blank?
Severity: Minor
Found in app/controllers/events_controller.rb - About 55 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 format_date has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def format_date(date, format=:short, include_time=true)
    if date.present?
      if date.is_a?(Integer) && date.to_s.length == 13
        value = Time.at(date/1000)
      else
Severity: Minor
Found in app/helpers/dates_helper.rb - About 55 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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    if @space.save
      respond_with @space do |format|

        # the user that created the space is always an admin
Severity: Minor
Found in app/controllers/spaces_controller.rb - About 55 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 unique_mconf_id has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.unique_mconf_id(base_value)
      new_value = base_value
      new_value = new_value.parameterize unless base_value.nil?
      base = new_value

Severity: Minor
Found in lib/mconf/identifier.rb - About 55 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 user_info has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def user_info(ldap_user, ldap_configs)
      if ldap_user[ldap_configs.ldap_username_field] && !ldap_user[ldap_configs.ldap_username_field].empty?
        username = ldap_user[ldap_configs.ldap_username_field].first
      else
        username = ldap_user['uid'].first
Severity: Minor
Found in lib/mconf/ldap.rb - About 55 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 find_or_create_user has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def find_or_create_user(ldap_user, ldap_configs)
      Rails.logger.info "LDAP: finding or creating user"

      # get the username, full name and email from the data returned by the server
      username, email, name = user_info(ldap_user, ldap_configs)
Severity: Minor
Found in lib/mconf/ldap.rb - About 55 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

Avoid deeply nested control flow statements.
Open

          if room.private
            :key
          else
            guest_role
          end
Severity: Major
Found in lib/mconf/bigbluebutton_rails_controller_module.rb - About 45 mins to fix

    Method user_can_end_meeting has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def user_can_end_meeting(user, room)
          if (room.owner_type == "User" && room.owner.id == user.id)
            true
          elsif (room.owner_type == "Space")
            space = Space.find(room.owner.id)
    Severity: Minor
    Found in app/models/abilities/member_ability.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 validate_and_adjust_max_upload_size has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def validate_and_adjust_max_upload_size
        if max_upload_size_changed?
          if self.max_upload_size.blank?
            write_attribute(:max_upload_size, nil)
          else
    Severity: Minor
    Found in app/models/site.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

    Avoid deeply nested control flow statements.
    Open

              if !room.is_running? || room.user_created_meeting?(current_user)
                :moderator
              else
                :attendee
              end
    Severity: Major
    Found in lib/mconf/bigbluebutton_rails_controller_module.rb - About 45 mins to fix

      Method select has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def select
            # try to get already set collection (@spaces) or use the class name for a query (Space)
            klass = if controller_name == "tags"
              ActsAsTaggableOn::Tag
            else
      Severity: Minor
      Found in lib/mconf/select_controller_module.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

      Avoid deeply nested control flow statements.
      Open

                      case invalid_fields
                      when :username
                        Rails.logger.error "LDAP: authentication failed: the user has no username set in the LDAP server"
                        fail(I18n.t('devise.strategies.ldap_authenticatable.missing_username'))
                      when :name
      Severity: Major
      Found in lib/devise/strategies/ldap_authenticatable.rb - About 45 mins to fix

        Method check_statistics_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def check_statistics_params
            if params[:statistics].present?
              from = params[:statistics][:starts_on_time]
              to = params[:statistics][:ends_on_time]
              date_format = I18n.t('_other.datetimepicker.datepick_rails')
        Severity: Minor
        Found in app/controllers/manage_controller.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 social_login_enabled? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def social_login_enabled?(method=nil)
            if method == "google"
              Rails.application.config.omniauth_google_key.present? && Rails.application.config.omniauth_google_secret.present?
            elsif method == "facebook"
              Rails.application.config.omniauth_facebook_key.present? && Rails.application.config.omniauth_facebook_secret.present?
        Severity: Minor
        Found in app/models/site.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

        Avoid deeply nested control flow statements.
        Open

                        if user.nil?
                          Rails.logger.error "LDAP: authentication failed: application wasn't able to create a new user"
                          fail(I18n.t('devise.strategies.ldap_authenticatable.create_failed'))
                        else
                          # if user.active_for_authentication?
        Severity: Major
        Found in lib/devise/strategies/ldap_authenticatable.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    version_name = :logo168x128 unless resource.logo_image.send(version_name).file.exists?
          Severity: Major
          Found in app/helpers/logo_images_helper.rb - About 45 mins to fix

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

              def create
                @participant.event = @event
                if current_user
                  @participant.owner = current_user
                  @participant.email = current_user.email
            Severity: Minor
            Found in app/controllers/participants_controller.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 wrapped_button has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def wrapped_button(*args, &block)
                options = args.extract_options!
                wrapper_class = ['form-actions', options[:wrapper_class]].compact
                options.delete(:wrapper_class)
                template.content_tag :div, :class => wrapper_class do
            Severity: Minor
            Found in lib/extras/simple_form_extensions.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 convert has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.convert(value)
                  if value.blank?
                    nil
                  elsif Mconf::Filesize.is_number?(value)
                    begin
            Severity: Minor
            Found in lib/mconf/filesize.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 load_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def load_data(env_variables, filters='')
                  filter = split_into_regexes(filters)
                  filter = [/^shib-/] if filter.empty?
            
                  shib_data = {}
            Severity: Minor
            Found in lib/mconf/shibboleth.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

            Severity
            Category
            Status
            Source
            Language