diaspora/diaspora

View on GitHub

Showing 4,490 of 4,490 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  alnum: "\\u0030-\\u0039" +
         "\\u0041-\\u005a" +
         "\\u0061-\\u007a" +
         "\\u00aa-\\u00aa" +
         "\\u00b5-\\u00b5" +
Severity: Major
Found in lib/assets/javascripts/posix-bracket-expressions.js and 1 other location - About 1 wk to fix
lib/assets/javascripts/posix-bracket-expressions.js on lines 5..438

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1733.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  word: "\\u0030-\\u0039" +
        "\\u0041-\\u005a" +
        "\\u005f-\\u005f" +
        "\\u0061-\\u007a" +
        "\\u00aa-\\u00aa" +
Severity: Major
Found in lib/assets/javascripts/posix-bracket-expressions.js and 1 other location - About 1 wk to fix
lib/assets/javascripts/posix-bracket-expressions.js on lines 686..1119

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 1733.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File posix-bracket-expressions.js has 883 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later

var PosixBracketExpressions = {
  // source: https://github.com/ruby/ruby/blob/ruby_2_4/enc/unicode/9.0.0/name2ctype.h#L3544
  word: "\\u0030-\\u0039" +
Severity: Major
Found in lib/assets/javascripts/posix-bracket-expressions.js - About 2 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    app.views.ResharesInfo = app.views.Base.extend({
    
      templateName : "reshares-info",
    
      events : {
    Severity: Major
    Found in app/assets/javascripts/app/views/reshares_info_view.js and 1 other location - About 1 day to fix
    app/assets/javascripts/app/views/likes_info_view.js on lines 3..33

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 294.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    app.views.LikesInfo = app.views.Base.extend({
    
      templateName : "likes-info",
    
      events : {
    Severity: Major
    Found in app/assets/javascripts/app/views/likes_info_view.js and 1 other location - About 1 day to fix
    app/assets/javascripts/app/views/reshares_info_view.js on lines 3..33

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 294.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Class User has 63 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class User < ApplicationRecord
      include AuthenticationToken
      include Connecting
      include Querying
      include SocialActions
    Severity: Major
    Found in app/models/user.rb - About 1 day to fix

      File user.rb has 451 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class User < ApplicationRecord
        include AuthenticationToken
        include Connecting
        include Querying
        include SocialActions
      Severity: Minor
      Found in app/models/user.rb - About 6 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

              .destroy({
                success: function(){
                  app.events.trigger("aspect_membership:destroy", {
                    membership: {
                      aspectId: app.aspect.get("id"),
        Severity: Major
        Found in app/assets/javascripts/app/views/contact_view.js and 1 other location - About 5 hrs to fix
        app/assets/javascripts/app/views/contact_view.js on lines 38..53

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 151.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            },{
              success: function(){
                app.events.trigger("aspect_membership:create", {
                  membership: {
                    aspectId: app.aspect.get("id"),
        Severity: Major
        Found in app/assets/javascripts/app/views/contact_view.js and 1 other location - About 5 hrs to fix
        app/assets/javascripts/app/views/contact_view.js on lines 62..77

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 151.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Assignment Branch Condition size for index is too high. [53.49/20]
        Open

          def index
            conditions = {:recipient_id => current_user.id}
            if params[:type] && types.has_key?(params[:type])
              conditions[:type] = types[params[:type]]
            end

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        File publisher_view.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-v3-or-Later
        
        /*   Copyright (c) 2010-2012, Diaspora Inc.  This file is
         *   licensed under the Affero General Public License version 3 or later.  See
         *   the COPYRIGHT file.
        Severity: Minor
        Found in app/assets/javascripts/app/views/publisher_view.js - About 5 hrs to fix

          Assignment Branch Condition size for legacy_create is too high. [45.93/20]
          Open

            def legacy_create
              photo_params = params.require(:photo).permit(:pending, :set_profile_photo, aspect_ids: [])
              if photo_params[:aspect_ids] == "all"
                photo_params[:aspect_ids] = current_user.aspects.map(&:id)
              elsif photo_params[:aspect_ids].is_a?(Hash)

          This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                $.ajax({
                  url: url,
                  dataType: "json",
                  type: "POST",
                  beforeSend: function() {
          Severity: Major
          Found in app/assets/javascripts/mobile/mobile_post_actions.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/mobile/mobile_post_actions.js on lines 59..73

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 120.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                $.ajax({
                  url: url,
                  dataType: "json",
                  type: "DELETE",
                  beforeSend: function() {
          Severity: Major
          Found in app/assets/javascripts/mobile/mobile_post_actions.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/mobile/mobile_post_actions.js on lines 30..44

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 120.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Class AccountMigration has 32 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class AccountMigration < ApplicationRecord
            include Diaspora::Federated::Base
          
            belongs_to :old_person, class_name: "Person"
            belongs_to :new_person, class_name: "Person"
          Severity: Minor
          Found in app/models/account_migration.rb - About 4 hrs to fix

            Class Person has 32 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Person < ApplicationRecord
              include Diaspora::Fields::Guid
            
              # NOTE API V1 to be extracted
              acts_as_api
            Severity: Minor
            Found in app/models/person.rb - About 4 hrs to fix

              Assignment Branch Condition size for perform is too high. [40.22/20]
              Open

                  def perform
                    # Queue users for removal due to inactivity
                    if AppConfig.settings.maintenance.remove_old_users.enable?
                      users = User.where("last_seen < ? and locked_at is null and remove_after is null", 
                        Time.now - (AppConfig.settings.maintenance.remove_old_users.after_days.to_i).days)

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Assignment Branch Condition size for new is too high. [39.67/20]
              Open

                def new
                  if !params[:modal] && !session[:mobile_view] && request.format.html?
                    redirect_to conversations_path
                    return
                  end

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Assignment Branch Condition size for destroy is too high. [37.7/20]
              Open

                def destroy
                  aspect = current_user.aspects.joins(:aspect_memberships).where(aspect_memberships: {id: params[:id]}).first
                  contact = current_user.contacts.joins(:aspect_memberships).where(aspect_memberships: {id: params[:id]}).first
              
                  raise ActiveRecord::RecordNotFound unless aspect.present? && contact.present?

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Assignment Branch Condition size for mobile_reshare_icon is too high. [36.03/20]
              Open

                def mobile_reshare_icon(post)
                  if (post.public? || reshare?(post)) && (user_signed_in? && post.author != current_user.person)
                    absolute_root = reshare?(post) ? post.absolute_root : post
              
                    if absolute_root && absolute_root.author != current_user.person
              Severity: Minor
              Found in app/helpers/mobile_helper.rb by rubocop

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Severity
              Category
              Status
              Source
              Language