activestorage/app/assets/javascripts/activestorage.esm.js

Summary

Maintainability
F
2 mos
Test Coverage

File activestorage.esm.js has 817 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var sparkMd5 = {
  exports: {}
};

(function(module, exports) {
Severity: Major
Found in activestorage/app/assets/javascripts/activestorage.esm.js - About 1 day to fix

    Function md5cycle has 133 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function md5cycle(x, k) {
          var a = x[0], b = x[1], c = x[2], d = x[3];
          a += (b & c | ~b & d) + k[0] - 680876936 | 0;
          a = (a << 7 | a >>> 25) + b | 0;
          d += (a & b | ~a & c) + k[1] - 389564586 | 0;
    Severity: Major
    Found in activestorage/app/assets/javascripts/activestorage.esm.js - About 5 hrs to fix

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

      (function(module, exports) {
        (function(factory) {
          {
            module.exports = factory();
          }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 3 other locations - About 1 mo to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 5..411
      actiontext/app/assets/javascripts/actiontext.js on lines 8..414
      activestorage/app/assets/javascripts/activestorage.js on lines 9..415

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

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

      class BlobRecord {
        constructor(file, checksum, url, customHeaders = {}) {
          this.file = file;
          this.attributes = {
            filename: file.name,
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 3 other locations - About 3 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 510..574
      actiontext/app/assets/javascripts/actiontext.js on lines 504..568
      activestorage/app/assets/javascripts/activestorage.js on lines 505..569

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

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

      class DirectUploadController {
        constructor(input, file) {
          this.input = input;
          this.file = file;
          this.directUpload = new DirectUpload(this.file, this.url, this);
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 3 other locations - About 3 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 650..711
      actiontext/app/assets/javascripts/actiontext.js on lines 639..700
      activestorage/app/assets/javascripts/activestorage.js on lines 640..701

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

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

      class FileChecksum {
        static create(file, callback) {
          const instance = new FileChecksum(file);
          instance.create(callback);
        }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 3 other locations - About 3 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 417..459
      actiontext/app/assets/javascripts/actiontext.js on lines 417..459
      activestorage/app/assets/javascripts/activestorage.js on lines 418..460

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

      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 BlobUpload {
        constructor(blob) {
          this.blob = blob;
          this.file = blob.file;
          const {url: url, headers: headers} = blob.directUploadData;
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 2 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 576..605
      actiontext/app/assets/javascripts/actiontext.js on lines 569..598
      activestorage/app/assets/javascripts/activestorage.js on lines 570..599
      activestorage/app/javascript/activestorage/blob_upload.js on lines 1..35

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

      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

      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

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

      function submitForm(form) {
        let button = submitButtonsByForm.get(form) || findElement(form, "input[type=submit], button[type=submit]");
        if (button) {
          const {disabled: disabled} = button;
          button.disabled = false;
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 7 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 813..830
      actiontext/app/assets/javascripts/actiontext.js on lines 791..808
      activestorage/app/assets/javascripts/activestorage.js on lines 792..809
      activestorage/app/javascript/activestorage/ujs.js on lines 60..78

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

      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

      function handleFormSubmissionEvent(event) {
        const form = event.target;
        if (form.hasAttribute(processingAttribute)) {
          event.preventDefault();
          return;
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 6 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 790..811
      actiontext/app/assets/javascripts/actiontext.js on lines 769..790
      activestorage/app/assets/javascripts/activestorage.js on lines 770..791
      activestorage/app/javascript/activestorage/ujs.js on lines 34..58

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

      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

      function dispatchEvent(element, type, eventInit = {}) {
        const {disabled: disabled} = element;
        const {bubbles: bubbles, cancelable: cancelable, detail: detail} = eventInit;
        const event = document.createEvent("Event");
        event.initEvent(type, bubbles || true, cancelable || true);
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 5 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 485..498
      actiontext/app/assets/javascripts/actiontext.js on lines 481..494
      activestorage/app/assets/javascripts/activestorage.js on lines 482..495
      activestorage/app/javascript/activestorage/helpers.js on lines 25..41

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

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

      function didClick(event) {
        const button = event.target.closest("button, input");
        if (button && button.type === "submit" && button.form) {
          submitButtonsByForm.set(button.form, button);
        }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 2 other locations - About 1 hr to fix
      activestorage/app/assets/javascripts/activestorage.js on lines 756..761
      activestorage/app/javascript/activestorage/ujs.js on lines 17..22

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

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

      function toArray(value) {
        if (Array.isArray(value)) {
          return value;
        } else if (Array.from) {
          return Array.from(value);
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 1 hr to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 500..508
      actiontext/app/assets/javascripts/actiontext.js on lines 495..503
      activestorage/app/assets/javascripts/activestorage.js on lines 496..504
      activestorage/app/javascript/activestorage/helpers.js on lines 43..51

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

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

      function start() {
        if (!started) {
          started = true;
          document.addEventListener("click", didClick, true);
          document.addEventListener("submit", didSubmitForm, true);
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 1 hr to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 764..771
      actiontext/app/assets/javascripts/actiontext.js on lines 747..754
      activestorage/app/assets/javascripts/activestorage.js on lines 748..755
      activestorage/app/javascript/activestorage/ujs.js on lines 8..15

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

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

      function findElements(root, selector) {
        if (typeof root == "string") {
          selector = root;
          root = document;
        }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 1 hr to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 468..475
      actiontext/app/assets/javascripts/actiontext.js on lines 466..473
      activestorage/app/assets/javascripts/activestorage.js on lines 467..474
      activestorage/app/javascript/activestorage/helpers.js on lines 8..15

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

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

      function getMetaValue(name) {
        const element = findElement(document.head, `meta[name="${name}"]`);
        if (element) {
          return element.getAttribute("content");
        }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 50 mins to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 461..466
      actiontext/app/assets/javascripts/actiontext.js on lines 460..465
      activestorage/app/assets/javascripts/activestorage.js on lines 461..466
      activestorage/app/javascript/activestorage/helpers.js on lines 1..6

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

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

      function findElement(root, selector) {
        if (typeof root == "string") {
          selector = root;
          root = document;
        }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 40 mins to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 477..483
      actiontext/app/assets/javascripts/actiontext.js on lines 474..480
      activestorage/app/assets/javascripts/activestorage.js on lines 475..481
      activestorage/app/javascript/activestorage/helpers.js on lines 17..23

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

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

      function notify(object, methodName, ...messages) {
        if (object && typeof object[methodName] == "function") {
          return object[methodName](...messages);
        }
      }
      Severity: Major
      Found in activestorage/app/assets/javascripts/activestorage.esm.js and 4 other locations - About 35 mins to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 644..648
      actiontext/app/assets/javascripts/actiontext.js on lines 634..638
      activestorage/app/assets/javascripts/activestorage.js on lines 635..639
      activestorage/app/javascript/activestorage/direct_upload.js on lines 45..49

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

      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

      There are no issues that match your filters.

      Category
      Status