Showing 1,823 of 1,823 total issues

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

  class DirectUploadsController {
    constructor(form) {
      this.form = form;
      this.inputs = findElements(form, inputSelector).filter((input => input.files.length));
    }
Severity: Major
Found in activestorage/app/assets/javascripts/activestorage.js and 4 other locations - About 1 day to fix
actiontext/app/assets/javascripts/actiontext.esm.js on lines 715..756
actiontext/app/assets/javascripts/actiontext.js on lines 702..743
activestorage/app/assets/javascripts/activestorage.esm.js on lines 715..756
activestorage/app/javascript/activestorage/direct_uploads_controller.js on lines 6..50

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

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 5 locations. Consider refactoring.
Open

export class DirectUploadsController {
  constructor(form) {
    this.form = form
    this.inputs = findElements(form, inputSelector).filter(input => input.files.length)
  }
actiontext/app/assets/javascripts/actiontext.esm.js on lines 715..756
actiontext/app/assets/javascripts/actiontext.js on lines 702..743
activestorage/app/assets/javascripts/activestorage.esm.js on lines 715..756
activestorage/app/assets/javascripts/activestorage.js on lines 703..744

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

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 5 locations. Consider refactoring.
Open

  class DirectUploadsController {
    constructor(form) {
      this.form = form;
      this.inputs = findElements(form, inputSelector).filter((input => input.files.length));
    }
Severity: Major
Found in actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 1 day to fix
actiontext/app/assets/javascripts/actiontext.esm.js on lines 715..756
activestorage/app/assets/javascripts/activestorage.esm.js on lines 715..756
activestorage/app/assets/javascripts/activestorage.js on lines 703..744
activestorage/app/javascript/activestorage/direct_uploads_controller.js on lines 6..50

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

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 5 locations. Consider refactoring.
Open

class DirectUploadsController {
  constructor(form) {
    this.form = form;
    this.inputs = findElements(form, inputSelector).filter((input => input.files.length));
  }
Severity: Major
Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 1 day to fix
actiontext/app/assets/javascripts/actiontext.esm.js on lines 715..756
actiontext/app/assets/javascripts/actiontext.js on lines 702..743
activestorage/app/assets/javascripts/activestorage.js on lines 703..744
activestorage/app/javascript/activestorage/direct_uploads_controller.js on lines 6..50

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

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 abstract_adapter.rb has 795 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "set"
require "active_record/connection_adapters/sql_type_metadata"
require "active_record/connection_adapters/abstract/schema_dumper"
require "active_record/connection_adapters/abstract/schema_creation"
require "active_support/concurrency/null_lock"

    File schema_statements.rb has 791 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveRecord
      module ConnectionAdapters
        module PostgreSQL
          module SchemaStatements
            # Drops the database specified on the +name+ attribute

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

      class AttachmentUpload {
        constructor(attachment, element) {
          this.attachment = attachment;
          this.element = element;
          this.directUpload = new DirectUpload(attachment.file, this.directUploadUrl, this);
      Severity: Major
      Found in actiontext/app/assets/javascripts/actiontext.esm.js and 2 other locations - About 1 day to fix
      actiontext/app/assets/javascripts/actiontext.js on lines 821..854
      actiontext/app/javascript/actiontext/attachment_upload.js on lines 3..45

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

      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 3 locations. Consider refactoring.
      Open

      export class AttachmentUpload {
        constructor(attachment, element) {
          this.attachment = attachment
          this.element = element
          this.directUpload = new DirectUpload(attachment.file, this.directUploadUrl, this)
      Severity: Major
      Found in actiontext/app/javascript/actiontext/attachment_upload.js and 2 other locations - About 1 day to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 848..881
      actiontext/app/assets/javascripts/actiontext.js on lines 821..854

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

      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 3 locations. Consider refactoring.
      Open

        class AttachmentUpload {
          constructor(attachment, element) {
            this.attachment = attachment;
            this.element = element;
            this.directUpload = new DirectUpload(attachment.file, this.directUploadUrl, this);
      Severity: Major
      Found in actiontext/app/assets/javascripts/actiontext.js and 2 other locations - About 1 day to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 848..881
      actiontext/app/javascript/actiontext/attachment_upload.js on lines 3..45

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

      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 abstract_mysql_adapter.rb has 770 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require "active_record/connection_adapters/abstract_adapter"
      require "active_record/connection_adapters/statement_pool"
      require "active_record/connection_adapters/mysql/column"
      require "active_record/connection_adapters/mysql/database_statements"
      require "active_record/connection_adapters/mysql/explain_pretty_printer"

        Class AbstractMysqlAdapter has 94 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class AbstractMysqlAdapter < AbstractAdapter
              include MySQL::DatabaseStatements
              include MySQL::Quoting
              include MySQL::SchemaStatements
        
        

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

              if (0 !== i && (h.addInitializer = createAddInitializerMethod(n, v)), o || 0 !== i && 2 !== i) {
                if (2 === i) d = function (e) {
                  return assertInstanceIfPrivate(l, e), a.value;
                };else {
                  var y = 0 === i || 1 === i;
          Severity: Major
          Found in actiontext/app/assets/javascripts/trix.js and 1 other location - About 1 day to fix
          actiontext/app/assets/javascripts/trix.js on lines 2958..2977

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

          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

                if (0 !== a && (p.addInitializer = createAddInitializerMethod(n, d)), s || 0 !== a && 2 !== a) {
                  if (2 === a) l = function (e) {
                    return assertInstanceIfPrivate(c, e), r.value;
                  };else {
                    var h = 0 === a || 1 === a;
          Severity: Major
          Found in actiontext/app/assets/javascripts/trix.js and 1 other location - About 1 day to fix
          actiontext/app/assets/javascripts/trix.js on lines 3175..3194

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

          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 schema_statements.rb has 741 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "active_support/core_ext/string/access"
          require "openssl"
          
          module ActiveRecord
            module ConnectionAdapters # :nodoc:

            Method load_defaults has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
            Open

                  def load_defaults(target_version)
                    # To introduce a change in behavior, follow these steps:
                    # 1. Add an accessor on the target object (e.g. the ActiveJob class for
                    #    global Active Job config).
                    # 2. Set a default value there preserving existing behavior for existing
            Severity: Minor
            Found in railties/lib/rails/application/configuration.rb - About 1 day 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

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

                  for (var r, n, a = [], i = new Map(), s = new Map(), o = 0; o < t.length; o++) {
                    var c = t[o];
                    if (Array.isArray(c)) {
                      var l,
                        u,
            Severity: Major
            Found in actiontext/app/assets/javascripts/trix.js and 1 other location - About 1 day to fix
            actiontext/app/assets/javascripts/trix.js on lines 2682..2699

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

            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

                    for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) {
                      var c = r[o];
                      if (Array.isArray(c)) {
                        var l,
                          u,
            Severity: Major
            Found in actiontext/app/assets/javascripts/trix.js and 1 other location - About 1 day to fix
            actiontext/app/assets/javascripts/trix.js on lines 2859..2876

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

            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 Mapper has 85 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Mapper
                  class BacktraceCleaner < ActiveSupport::BacktraceCleaner # :nodoc:
                    def initialize
                      super
                      remove_silencers!
            Severity: Major
            Found in actionpack/lib/action_dispatch/routing/mapper.rb - About 1 day to fix

              File route_set.rb has 691 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "action_dispatch/journey"
              require "active_support/core_ext/object/to_query"
              require "active_support/core_ext/module/redefine_method"
              require "active_support/core_ext/module/remove_method"
              require "active_support/core_ext/array/extract_options"
              Severity: Major
              Found in actionpack/lib/action_dispatch/routing/route_set.rb - About 1 day to fix

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

                class DirectUpload {
                  constructor(file, url, delegate, customHeaders = {}) {
                    this.id = ++id;
                    this.file = file;
                    this.url = url;
                Severity: Major
                Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 1 day to fix
                actiontext/app/assets/javascripts/actiontext.esm.js on lines 609..642
                actiontext/app/assets/javascripts/actiontext.js on lines 600..633
                activestorage/app/assets/javascripts/activestorage.js on lines 601..634
                activestorage/app/javascript/activestorage/direct_upload.js on lines 7..43

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

                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

                Severity
                Category
                Status
                Source
                Language