actiontext/app/assets/javascripts/actiontext.js

Summary

Maintainability
F
2 mos
Test Coverage

File actiontext.js has 862 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function(factory) {
  typeof define === "function" && define.amd ? define(factory) : factory();
})((function() {
  "use strict";
  var sparkMd5 = {
Severity: Major
Found in actiontext/app/assets/javascripts/actiontext.js - About 2 days 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 actiontext/app/assets/javascripts/actiontext.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 actiontext/app/assets/javascripts/actiontext.js and 3 other locations - About 1 mo to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 5..411
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 5..411
      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 actiontext/app/assets/javascripts/actiontext.js and 3 other locations - About 3 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 510..574
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 510..574
      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 actiontext/app/assets/javascripts/actiontext.js and 3 other locations - About 3 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 650..711
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 650..711
      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 actiontext/app/assets/javascripts/actiontext.js and 3 other locations - About 3 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 417..459
      activestorage/app/assets/javascripts/activestorage.esm.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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 2 days to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 576..605
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 576..605
      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 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 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

      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

        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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 7 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 813..830
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 813..830
      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 6 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 790..811
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 790..811
      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 5 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 485..498
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 485..498
      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

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

        function didClick(event) {
          const {target: target} = event;
          if ((target.tagName == "INPUT" || target.tagName == "BUTTON") && target.type == "submit" && target.form) {
            submitButtonsByForm.set(target.form, target);
          }
      Severity: Major
      Found in actiontext/app/assets/javascripts/actiontext.js and 1 other location - About 2 hrs to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 773..778

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

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

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

        addEventListener("trix-attachment-add", (event => {
          const {attachment: attachment, target: target} = event;
          if (attachment.file) {
            const upload = new AttachmentUpload(attachment, target);
            upload.start();
      Severity: Major
      Found in actiontext/app/assets/javascripts/actiontext.js and 2 other locations - About 1 hr to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 883..889
      actiontext/app/javascript/actiontext/index.js on lines 3..10

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

      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 1 hr to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 764..771
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 764..771
      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 1 hr to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 468..475
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 468..475
      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 50 mins to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 461..466
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 461..466
      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 40 mins to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 477..483
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 477..483
      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 actiontext/app/assets/javascripts/actiontext.js and 4 other locations - About 35 mins to fix
      actiontext/app/assets/javascripts/actiontext.esm.js on lines 644..648
      activestorage/app/assets/javascripts/activestorage.esm.js on lines 644..648
      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