Showing 1,823 of 1,823 total issues

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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 1 day to fix
actiontext/app/assets/javascripts/actiontext.esm.js on lines 609..642
activestorage/app/assets/javascripts/activestorage.esm.js on lines 609..642
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

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.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.esm.js on lines 609..642
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

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

export class DirectUpload {
  constructor(file, url, delegate, customHeaders = {}) {
    this.id = ++id
    this.file = file
    this.url = url
Severity: Major
Found in activestorage/app/javascript/activestorage/direct_upload.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.esm.js on lines 609..642
activestorage/app/assets/javascripts/activestorage.js on lines 601..634

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

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 actiontext/app/assets/javascripts/actiontext.esm.js and 4 other locations - About 1 day to fix
actiontext/app/assets/javascripts/actiontext.js on lines 600..633
activestorage/app/assets/javascripts/activestorage.esm.js on lines 609..642
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

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

  const handleMethodWithRails = rails => function(e) {
    const link = this;
    const method = link.getAttribute("data-method");
    if (!method) {
      return;
Severity: Major
Found in actionview/app/assets/javascripts/rails-ujs.js and 1 other location - About 1 day to fix
actionview/app/assets/javascripts/rails-ujs.esm.js on lines 441..467

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

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

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

const handleMethodWithRails = rails => function(e) {
  const link = this;
  const method = link.getAttribute("data-method");
  if (!method) {
    return;
Severity: Major
Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 1 day to fix
actionview/app/assets/javascripts/rails-ujs.js on lines 393..419

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

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

  const ajax = options => {
    options = prepareOptions(options);
    var xhr = createXHR(options, (function() {
      const response = processResponse(xhr.response != null ? xhr.response : xhr.responseText, xhr.getResponseHeader("Content-Type"));
      if (Math.floor(xhr.status / 100) === 2) {
Severity: Major
Found in actionview/app/assets/javascripts/rails-ujs.js and 1 other location - About 1 day to fix
actionview/app/assets/javascripts/rails-ujs.esm.js on lines 107..128

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

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

const ajax = options => {
  options = prepareOptions(options);
  var xhr = createXHR(options, (function() {
    const response = processResponse(xhr.response != null ? xhr.response : xhr.responseText, xhr.getResponseHeader("Content-Type"));
    if (Math.floor(xhr.status / 100) === 2) {
Severity: Major
Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 1 day to fix
actionview/app/assets/javascripts/rails-ujs.js on lines 87..108

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

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

Function _regeneratorRuntime has 299 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function _regeneratorRuntime() {
    "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
    _regeneratorRuntime = function () {
      return e;
    };
Severity: Major
Found in actiontext/app/assets/javascripts/trix.js - About 1 day to fix

    Class Parameters has 76 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Parameters
        include ActiveSupport::DeepMergeable
    
        cattr_accessor :permit_all_parameters, instance_accessor: false, default: false
    
    
    Severity: Major
    Found in actionpack/lib/action_controller/metal/strong_parameters.rb - About 1 day to fix

      File rails-ujs.js has 623 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
      Unobtrusive JavaScript
      https://github.com/rails/rails/blob/main/actionview/app/javascript
      Released under the MIT license
       */
      Severity: Major
      Found in actionview/app/assets/javascripts/rails-ujs.js - About 1 day to fix

        Class AppBase has 72 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class AppBase < Base # :nodoc:
              include Database
              include Devcontainer
              include AppName
        
        
        Severity: Major
        Found in railties/lib/rails/generators/app_base.rb - About 1 day to fix

          File rails-ujs.esm.js has 611 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
          Unobtrusive JavaScript
          https://github.com/rails/rails/blob/main/actionview/app/javascript
          Released under the MIT license
           */
          Severity: Major
          Found in actionview/app/assets/javascripts/rails-ujs.esm.js - About 1 day to fix

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

            var processResponse = function(response, type) {
              if (typeof response === "string" && typeof type === "string") {
                if (type.match(/\bjson\b/)) {
                  try {
                    response = JSON.parse(response);
            Severity: Major
            Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 1 day to fix
            actionview/app/assets/javascripts/rails-ujs.js on lines 147..167

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

            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

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

              var processResponse = function(response, type) {
                if (typeof response === "string" && typeof type === "string") {
                  if (type.match(/\bjson\b/)) {
                    try {
                      response = JSON.parse(response);
            Severity: Major
            Found in actionview/app/assets/javascripts/rails-ujs.js and 1 other location - About 1 day to fix
            actionview/app/assets/javascripts/rails-ujs.esm.js on lines 170..190

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

            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

                    get c() {
                      return function (e, t) {
                        if (t.length > 0) {
                          for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) {
                            var s = {
            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 3107..3130

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

            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

                    get c() {
                      return function (e, t) {
                        if (t.length > 0) {
                          for (var r = [], n = e, a = e.name, i = t.length - 1; i >= 0; i--) {
                            var s = {
            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 2888..2911

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

            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

            Identical blocks of code found in 4 locations. Consider refactoring.
            Open

              class Consumer {
                constructor(url) {
                  this._url = url;
                  this.subscriptions = new Subscriptions(this);
                  this.connection = new Connection(this);
            Severity: Major
            Found in actioncable/app/assets/javascripts/action_cable.js and 3 other locations - About 1 day to fix
            actioncable/app/assets/javascripts/actioncable.esm.js on lines 455..484
            actioncable/app/assets/javascripts/actioncable.js on lines 442..471
            actioncable/app/javascript/action_cable/consumer.js on lines 30..63

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

            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

            Identical blocks of code found in 4 locations. Consider refactoring.
            Open

            class Consumer {
              constructor(url) {
                this._url = url;
                this.subscriptions = new Subscriptions(this);
                this.connection = new Connection(this);
            Severity: Major
            Found in actioncable/app/assets/javascripts/actioncable.esm.js and 3 other locations - About 1 day to fix
            actioncable/app/assets/javascripts/action_cable.js on lines 442..471
            actioncable/app/assets/javascripts/actioncable.js on lines 442..471
            actioncable/app/javascript/action_cable/consumer.js on lines 30..63

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

            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

            Identical blocks of code found in 4 locations. Consider refactoring.
            Open

              class Consumer {
                constructor(url) {
                  this._url = url;
                  this.subscriptions = new Subscriptions(this);
                  this.connection = new Connection(this);
            Severity: Major
            Found in actioncable/app/assets/javascripts/actioncable.js and 3 other locations - About 1 day to fix
            actioncable/app/assets/javascripts/action_cable.js on lines 442..471
            actioncable/app/assets/javascripts/actioncable.esm.js on lines 455..484
            actioncable/app/javascript/action_cable/consumer.js on lines 30..63

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

            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