fiedl/your_platform

View on GitHub

Showing 251 of 251 total issues

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

  def member_of?( object, options = {} )
    if object.kind_of? Group
      if options[:at]
        Membership.find_all_by(user: self, group: object).at_time(options[:at]).any?
      elsif options[:with_invalid] or options[:also_in_the_past]
Severity: Minor
Found in app/models/concerns/user_roles.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 deliver has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def deliver
    if not user.has_account?
      self.comment = "User has no account."
      self.failed_at = Time.zone.now
      self.save
Severity: Minor
Found in app/models/post_delivery.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
    authorize! :change_status, user
    raise 'no corporation given.' unless corporation
    raise 'no status_group given.' unless status_group
    raise 'status_group does not match corporation' unless corporation.descendant_group_ids.include? status_group.id
Severity: Minor
Found in app/controllers/api/v1/change_status_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 index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    authorize! :index, PublicActivity::Activity

    @user = User.find params[:user_id] if params[:user_id].present?
    @page = Page.find params[:page_id] if params[:page_id].present?
Severity: Minor
Found in app/controllers/activities_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 public_navables has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def public_navables
    if current_home_page
      pages = [current_home_page]
      if current_home_page.respond_to? :horizontal_nav_child_pages
        pages += current_home_page.horizontal_nav_child_pages
Severity: Minor
Found in app/models/horizontal_nav.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 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

    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 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 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 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 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 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

      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 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 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 cached_block has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def cached_block(options = {}, &block)
            # This gives the method name that called the #cached method.
            # See: http://www.ruby-doc.org/core-2.1.2/Kernel.html
            #
            if options[:method_name] && options[:arguments] && options[:arguments].any?
        Severity: Minor
        Found in app/models/concerns/caching.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