fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

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

  def fill_small_map_address_fields
    # On collection groups, e.g. the corporations_parent group, only the
    # groups should be shown on the map. These groups have a lot of
    # child groups with address profile fields.
    #
Severity: Minor
Found in app/controllers/groups_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

Avoid deeply nested control flow statements.
Open

              part.body.raw_source.replace part.body.decoded.gsub(search, replace) if part.body.decoded.include? search
Severity: Major
Found in core_ext/mail/message.rb - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                     book_rate_line(address_label) if @book_rate and address_label
    Severity: Major
    Found in app/pdfs/address_labels_dpag7037_pdf.rb - About 45 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if self.value_changed? && (! @do_not_save_parent) && self.parent && self.parent.reload && self.parent.children.reload && (self.parent.value != (composed_value = self.parent.composed_value))
            self.parent.update_attributes value: composed_value
            @do_not_save_parent = false
          end
      Severity: Major
      Found in app/models/concerns/profile_field_composed_value.rb - About 40 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def initialize(name, address_field, name_surrounding_field, personal_title = '', company = '')
        Severity: Minor
        Found in app/models/address_label.rb - About 35 mins to fix

          Method support_request_email has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def support_request_email(sender_user, receiver_email, text, meta_data, navable)
          Severity: Minor
          Found in app/mailers/support_request_mailer.rb - About 35 mins to fix

            Method thumb_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def thumb_path
                url = file.url if has_type?("svg")
                url ||= file.url(:thumb) if has_type?("image") or has_type?("pdf")
                url ||= file.url(:video_thumb) if has_type?("video")
                url ||= helpers.image_path('file.png')
            Severity: Minor
            Found in app/models/attachment.rb - About 35 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 postal_address_postal_code_and_town has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def postal_address_postal_code_and_town
                  if str = address_label.postal_address
                    str.gsub!(postal_address_street_with_number.to_s, ' ') if postal_address_street_with_number.to_s.present?
                    str.gsub!("\n" + postal_address_second_address_line.to_s, ' ' ) if postal_address_second_address_line.to_s.present?
                    str.gsub!(/\n#{postal_address_country.to_s}\z/m, ' ') if postal_address_country.to_s.present?
            Severity: Minor
            Found in app/models/list_exports/list_export_user.rb - About 35 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 needs_review= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def needs_review=(new_needs_review)
                new_needs_review = false if new_needs_review == "false"
                if new_needs_review != self.needs_review
                  attribute_will_change!(:needs_review)
                end
            Severity: Minor
            Found in app/models/concerns/review.rb - About 35 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 male_or_female_salutation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def male_or_female_salutation
                if female?
                  if age < 18
                    I18n.translate(:to_ms, locale)
                  else
            Severity: Minor
            Found in app/models/concerns/user_gender.rb - About 35 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 member_table_rows has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def member_table_rows
                if memberships.count == members.count
                  memberships_for_member_list.reorder('valid_from ASC').collect do |membership|
                    if user = membership.user
                      hash = {
            Severity: Minor
            Found in app/models/concerns/group_member_list.rb - About 35 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 << has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def <<(child)
                unless child.in? self.children
                  if child.in? self.descendants
                    link = DagLink.where(
                      ancestor_type: 'Page', ancestor_id: self.id,
            Severity: Minor
            Found in app/models/page.rb - About 35 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 access_indicator has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def access_indicator
                if current_navable.respond_to?(:draft?) && current_navable.draft?
                  content_tag :span, t(:draft), class: 'label label-primary draft_label'
                elsif current_access
                  css = 'access-indicator has_tooltip'
            Severity: Minor
            Found in app/helpers/access_indicator_helper.rb - About 35 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 generate_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.generate_for(user)
                raise RuntimeError, 'no user given' if not user
                raise RuntimeError, 'the given user has no last_name' if not user.last_name.present?
                raise RuntimeError, 'the given user has no first_name' if not user.first_name.present?
            
            
            Severity: Minor
            Found in app/models/user_alias.rb - About 35 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 update_last_seen_activity has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def update_last_seen_activity(description = nil, object = nil)
                unless readonly?
                  if description and not self.incognito?
                    activity = find_or_build_last_seen_activity
                    activity.touch unless activity.new_record? # even if the attributes didn't change. The user probably hit 'reload' then.
            Severity: Minor
            Found in app/models/user.rb - About 35 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 birthday_this_year has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def birthday_this_year
                begin
                  date_of_birth.change(:year => Time.zone.now.year)
                rescue
                  if date_of_birth.try(:month) == 2 && date_of_birth.try(:day) == 29
            Severity: Minor
            Found in app/models/concerns/user_date_of_birth.rb - About 35 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 value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def value
                return super if updated_at && (updated_at < 5.seconds.ago)
                return super if children.none?
            
                # Recalculate the value and store it.
            Severity: Minor
            Found in app/models/concerns/profile_field_composed_value.rb - About 35 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 geo_information has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def geo_information( key )
                    return nil if self.value == "—"
                    return geo_location.send(key).strip if self.value.present? && geo_location.send(key).kind_of?(String) && geo_location.send(key).strip.present?
                    return geo_location.send(key) if self.value.present? && geo_location.send(key).present?
                  end
            Severity: Minor
            Found in app/models/profile_fields/address.rb - About 35 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 identify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.identify(login_string)
            
                # Priorization: Check alias first. (Bug fix)
                user_identified_by_alias = User.find_by_alias(login_string)
                users_that_match_the_login_string = [ User.find_by_alias(login_string) ] if user_identified_by_alias
            Severity: Minor
            Found in app/models/user_account.rb - About 35 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_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def find_user
                if not handle_mystery_user
                  @user = User.find(params[:id]) if params[:id].present?
                  @user ||= User.find_by_alias(params[:alias]) if params[:alias].present?
                  @user ||= User.new
            Severity: Minor
            Found in app/controllers/users_controller.rb - About 35 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