fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

Avoid too many return statements within this method.
Open

    return t :events
Severity: Major
Found in app/helpers/events_helper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return 12.pt if num_of_lines_required(str, 12.pt) < 5
    Severity: Major
    Found in app/pdfs/address_labels_pdf.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return 7.pt
      Severity: Major
      Found in app/pdfs/address_labels_pdf.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return 8.pt if num_of_lines_required(str, 8.pt) < 8
        Severity: Major
        Found in app/pdfs/address_labels_pdf.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return 10.pt if num_of_lines_required(str, 10.pt) < 6
          Severity: Major
          Found in app/pdfs/address_labels_pdf.rb - About 30 mins to fix

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

              def fill_cached_method(method)
                Sidekiq::Logging.logger.info "#{title} # fill_cached_method #{method}" if Sidekiq::Logging.logger && (! Rails.env.test?)
                if Rails.cache.running_from_background_job && Rails.cache.renew_at
                  # When running from a background job, split it into sub-tasks.
                  self.renew_cache_later method: method
            Severity: Minor
            Found in app/models/concerns/caching.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 value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def value
                  v = super
                  v = v.to_i if ( not v.to_i == nil ) and ( v.to_i.to_s == v ) if v.respond_to?( :to_i )
                  v = true if v == "true"
                  v = false if v == "false"
            Severity: Minor
            Found in app/models/workflow_kit/parameter.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 change_type_according_to_other_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def change_type_according_to_other_attributes
                self.type = "Membership" if ancestor_type == "Group" and descendant_type == "User"
                self.type = "Memberships::Status" if self.type == "Membership" and ancestor.kind_of?(StatusGroup)
              end
            Severity: Minor
            Found in app/models/concerns/dag_link_types.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 postal_address= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def postal_address=(new_postal_address)
                    if new_postal_address != self.postal_address
                      if new_postal_address
                        self.clear_postal_address
                        self.add_flag :postal_address
            Severity: Minor
            Found in app/models/profile_fields/address.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 role_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def role_for( structureable )
                return nil if not structureable.respond_to? :parent_groups
                # return :main_admin if self.main_admin_of? structureable
                return :admin if self.admin_of? structureable
                return :member if self.member_of? structureable
            Severity: Minor
            Found in app/models/concerns/user_roles.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 logo_link_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def logo_link_path
                if Page.public_website_present?
                  if current_navable.kind_of?(Page) && current_navable.has_flag?(:root)
                    root_path
                  else
            Severity: Minor
            Found in app/helpers/logo_helper.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 rescue_from_too_big_to_marshal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def rescue_from_too_big_to_marshal(block_without_caching, &block_with_caching)
                begin
                  yield
                rescue ArgumentError, NameError => exc
                  if exc.message.include? 'year too big to marshal'
            Severity: Minor
            Found in app/models/concerns/caching.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 data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def data
                  super.select { |user|
                    case @options[:quarter]
                    when nil, ''
                      true
            Severity: Minor
            Found in app/models/list_exports/birthday_list.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 greeting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def greeting
                if Time.zone.now > "4:00".to_time and Time.zone.now < "11:00".to_time
                  I18n.t(:good_morning, locale: locale)
                elsif Time.zone.now > "11:00".to_time and Time.zone.now < "17:00".to_time
                  I18n.t(:good_day, locale: locale)
            Severity: Minor
            Found in app/models/concerns/user_notifications.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 rights_for_everyone has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def rights_for_everyone
            
                # Feature switches
                #
                can :use, :semester_calendars
            Severity: Minor
            Found in app/models/ability.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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def process(options = {})
                if sender_user && recipient_group && recipient_group.has_flag?(:mail_test_group)
                  recipient_group.child_users << sender_user unless recipient_group.child_users.include? sender_user
                  recipient_group.update mailing_list_sender_filter: :open
                  recipient_group.delete_cache
            Severity: Minor
            Found in app/models/incoming_mails/test_mail.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 find_without_types has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.find_without_types( *types )
                self.all.to_a.collect do |attachment|
                  re = attachment
                  for type in types
                    if not attachment.content_type
            Severity: Minor
            Found in app/models/attachment.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 create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def create
                authorize! :submit, term_report
                raise ActionController::BadRequest, "term report #{term_report.id} cannot be submitted because it has already been accepted." if term_report.accepted?
                raise ActionController::BadRequest, "term report #{term_report.id} cannot be submitted because it has already been submitted." if term_report.submitted? && (term_report.submitted_at > term_report.rejected_at)
                raise ActionController::BadRequest, "term report #{term_report.id} is not due." unless term_report.due?
            Severity: Minor
            Found in app/controllers/term_report_submissions_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 children_cache_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def children_cache_key
                "Group#{child_group_ids.sum if respond_to?(:child_group_ids)}Page#{child_page_ids.sum if respond_to?(:child_page_ids)}User#{child_user_ids.sum if respond_to?(:child_user_ids)}"
              end
            Severity: Minor
            Found in app/models/concerns/structureable.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 global_logo_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              def global_logo_url
                unless @logo_url
                  @logo_url = Attachment.logos.first.try(:file).try(:url)
            
                  # TODO # #current_navable.nav_node.breadcrumb_root
            Severity: Minor
            Found in app/helpers/logo_helper.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