fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

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

    def self.format_phone_number( phone_number_str )
      return "" if phone_number_str.nil?
      value = phone_number_str

      # determine whether this is an international number
Severity: Minor
Found in app/models/profile_fields/phone.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 status_export_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def status_export_string
    self.corporations.collect do |corporation|
      if membership = self.current_status_membership_in(corporation)
        "#{I18n.localize(membership.valid_from.to_date) if membership.valid_from}: #{membership.group.name.try(:singularize)} in #{corporation.name}"
      else
Severity: Minor
Found in app/models/concerns/user_status.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 website has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def website
    unless @website
      @website = website_fields.first.try(:value)
      @website = "https://#{@website}" if @website and not (@website.start_with?("http://") or @website.start_with?("https://"))
    end
Severity: Minor
Found in app/models/concerns/profile_fields.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 navable_children has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def navable_children
      (respond_to?(:child_groups) ? child_groups : []) +
      (respond_to?(:child_pages) ? child_pages.where.not(id: nil) : [])
    end
Severity: Minor
Found in app/models/concerns/navable.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 import_group_with_descendants has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.import_group_with_descendants(group)
    Graph::Group.sync group
    group.descendant_groups.each { |g| Graph::Group.sync g }
    group.descendant_groups.each do |child|
      child.links_as_child.each do |link|
Severity: Minor
Found in app/models/graph/base.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def execute( params )
      raise RuntimeError, 'no user_id given' unless params[ :user_id ]
      raise RuntimeError, 'no group_id given' unless params[ :group_id ]

      user = User.find( params[ :user_id ] )
Severity: Minor
Found in app/models/workflow_kit/remove_from_group_brick.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 current_ability has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def current_ability(reload = false, options = {})
    if reload
      @current_ability = nil
      @current_role = nil
      @current_role_view = nil
Severity: Minor
Found in app/controllers/concerns/current_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

Avoid deeply nested control flow statements.
Open

              Sidekiq::Logging.logger.info "#{self.title} # navable caching for #{descendant.title}" if Sidekiq::Logging.logger && (! Rails.env.test?)
Severity: Major
Found in app/models/concerns/navable_caching.rb - About 45 mins to fix

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

        def convert_group_names_to_group_hashes( group_names )
          group_names.map do |array_item|
            if array_item.kind_of? String
              { name: array_item }
            elsif array_item.kind_of? Hash
    Severity: Minor
    Found in app/models/group_mixins/import.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 executable_workflows_by_corporation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def executable_workflows_by_corporation(user)
        if @executable_workflows_by_corporation && @executable_workflows_by_corporation[user.id]
          @executable_workflows_by_corporation[user.id]
        else
          @executable_workflows_by_corporation ||= {}
    Severity: Minor
    Found in app/helpers/workflows_helper.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 rights_for_local_officers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def rights_for_local_officers
        can :export_member_list, Group do |group|
          user.in? group.officers_of_self_and_ancestors
        end
    
    
    Severity: Minor
    Found in app/models/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

    Avoid deeply nested control flow statements.
    Open

          elsif object.kind_of? Project
            self.child_projects << object unless self.child_projects.include? object
          elsif object.kind_of? WorkflowKit::Workflow
            # # This does not work since `child_workflows` is no real association:
            # self.child_workflows << object unless self.child_workflows.include? object
    Severity: Major
    Found in app/models/concerns/structureable.rb - About 45 mins to fix

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

        def self.find_all_by( params )
          user = params[ :user ]
          user ||= User.find params[:user_id] if params[:user_id]
          user ||= User.find_by_title params[:user_title] if params[:user_title]
          group = params[ :group ]
      Severity: Minor
      Found in app/models/membership.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def execute( params )
            raise RuntimeError, 'no user_id given' unless params[ :user_id ]
            raise RuntimeError, 'no group_id given' unless params[ :group_id ]
      
            user = User.find( params[ :user_id ] )
      Severity: Minor
      Found in app/models/workflow_kit/add_to_group_brick.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

              unless self.events.include? object
                self.events << object
              end
      Severity: Major
      Found in app/models/concerns/structureable.rb - About 45 mins to fix

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

          def restore_profile
            raise "This user (#{id}) already has an existing profile. Not restoring from backup file." if profile_fields.any?
            hash = ActiveSupport::JSON.decode(File.read(latest_backup_file))
        
            if (address = hash['profile_fields'].select { |pf| pf['type'] == "ProfileFields::Address" }.first) && address['children'].present?
        Severity: Minor
        Found in app/models/concerns/user_backup.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 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

                         address.gsub!("\nDeutschland", "") if I18n.locale == :de # in order to save space for in-country deliveries.
        Severity: Major
        Found in app/pdfs/address_labels_dpag7037_pdf.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                           sender_line if @sender and address.to_s.present?
          Severity: Major
          Found in app/pdfs/address_labels_dpag7037_pdf.rb - About 45 mins to fix

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

              def create
                authorize! :update, room
            
                terminate_existing_occupancies
            
            
            Severity: Minor
            Found in app/controllers/api/v1/room_occupancies_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

            Severity
            Category
            Status
            Source
            Language