fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

Method groups_of_user_table has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def groups_of_user_table(user, options = {require_post_ability: false})
    content_tag :table, :class => "user_groups" do
      content_tag :tr do

        # first column:
Severity: Minor
Found in app/helpers/groups_helper.rb - About 1 hr 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 group_tree has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def group_tree(group, options = {class: "tree"}, &block)
    content_tag :ul, class: options[:class] do
      group.child_groups.collect do |child_group|
        content_tag :li do
          (block_given? ? yield(child_group) : child_group.name).html_safe +
Severity: Minor
Found in app/helpers/groups_helper.rb - About 1 hr 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 editable has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def editable(object, key, type: 'text', editable: nil, placeholder: nil, class: nil, input_class: nil, link_to: nil)
    if type == 'date'
      initial_value = localize object.send(key).to_date if object.send(key)
    elsif type == 'datetime'
      initial_value = localize object.send(key) if object.send(key)
Severity: Minor
Found in app/helpers/editable_helper.rb - About 1 hr 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 resource_breadcrumbs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def resource_breadcrumbs
    ancestor_resource_controllers.reverse.collect { |controller|
      if controller
        if controller.action_methods.include? 'index'
          underscored_controller_name = controller.name.gsub("Controller", "").underscore
Severity: Minor
Found in app/helpers/breadcrumbs_helper.rb - About 1 hr 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 fetch has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def fetch(key, options = {}, &block)
    # We need to have this in local memory. Otherwise, the value might change until
    # we compare the timestamps.
    r = renew_at

Severity: Minor
Found in core_ext/active_support/cache.rb - About 1 hr 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 lucky_guess has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  def lucky_guess
    query_string = params[:query]
    if query_string.present?
      @result = Event.where(name: query_string).limit(1).first
      @result ||= Page.where(title: query_string).limit(1).first
Severity: Minor
Found in app/controllers/search_controller.rb - About 1 hr 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 10 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    @user_params = user_params
    @basic_user_params = @user_params.select { |key, value| key.to_s.in? ['first_name', 'last_name', 'email', 'female', 'create_account'] }
    @basic_user_params[:first_name] ||= I18n.t(:first_name)
    @basic_user_params[:last_name] ||= I18n.t(:last_name)
Severity: Minor
Found in app/controllers/users_controller.rb - About 1 hr 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

Function handler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const handler = fragment => {
    const nodes = [];

    fragment.forEach(child => {
      if (child.isText) {
Severity: Minor
Found in app/vue/lib/tiptap/node_paste_rule.js - About 1 hr to fix

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

      def unassociate_profileable_and_renew_profileable_cache
        if not parent
          former_profileable = profileable
          self.profileable = nil if self.profileable_id
          self.save
    Severity: Minor
    Found in app/models/concerns/profile_field_caching.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 content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def content
        if @email.multipart?
          if @email.html_part
            @content_type = 'html'
            normalize_body(@email.html_part, @email.html_part.charset)
    Severity: Minor
    Found in app/models/received_mail.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 find_special_group has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_special_group( group_flag, options = {} )
          object_to_search = options[:parent_element].try(:child_groups)
          object_to_search ||= Group unless options[:local]
          object_to_search.find_by_flag( group_flag.to_sym ) if object_to_search && object_to_search != []
        end
    Severity: Minor
    Found in app/models/concerns/special_groups.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 age has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def age
        now = Time.now.utc.to_date
        dob = self.date_of_birth
        if dob
          now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1)
    Severity: Minor
    Found in app/models/concerns/user_date_of_birth.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 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 to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def to_s
        return 'global_admin' if global_admin?
        return 'admin' if admin?
        return 'officer' if officer?
        return 'global_officer' if global_officer?
    Severity: Minor
    Found in app/models/role.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 rights_for_signed_in_users has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def rights_for_signed_in_users
        can :read, :terms_of_use
        can :accept, :terms_of_use if not read_only_mode?
        can :use, :single_sign_on
    
    
    Severity: Minor
    Found in app/models/ability.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 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 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

    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

    Severity
    Category
    Status
    Source
    Language