Showing 1,817 of 1,817 total issues

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

var createXHR = function(options, done) {
  const xhr = new XMLHttpRequest;
  xhr.open(options.type, options.url, true);
  xhr.setRequestHeader("Accept", options.accept);
  if (typeof options.data === "string") {
Severity: Major
Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 7 hrs to fix
actionview/app/assets/javascripts/rails-ujs.js on lines 128..146

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

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

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

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

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

Refactorings

Further Reading

Class Application has 53 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Application < Engine
    autoload :Bootstrap,              "rails/application/bootstrap"
    autoload :Configuration,          "rails/application/configuration"
    autoload :DefaultMiddlewareStack, "rails/application/default_middleware_stack"
    autoload :Finisher,               "rails/application/finisher"
Severity: Major
Found in railties/lib/rails/application.rb - About 7 hrs to fix

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

      function assertValidReturnValue(e, t) {
        var r = typeof t;
        if (1 === e) {
          if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
          void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
    Severity: Major
    Found in actiontext/app/assets/javascripts/trix.js and 3 other locations - About 7 hrs to fix
    actiontext/app/assets/javascripts/trix.js on lines 2608..2617
    actiontext/app/assets/javascripts/trix.js on lines 2793..2802
    actiontext/app/assets/javascripts/trix.js on lines 3001..3010

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

    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

        function assertValidReturnValue(e, t) {
          var r = typeof t;
          if (1 === e) {
            if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
            void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
    Severity: Major
    Found in actiontext/app/assets/javascripts/trix.js and 3 other locations - About 7 hrs to fix
    actiontext/app/assets/javascripts/trix.js on lines 2793..2802
    actiontext/app/assets/javascripts/trix.js on lines 3001..3010
    actiontext/app/assets/javascripts/trix.js on lines 3221..3230

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

    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

        function assertValidReturnValue(e, t) {
          var r = typeof t;
          if (1 === e) {
            if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
            void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
    Severity: Major
    Found in actiontext/app/assets/javascripts/trix.js and 3 other locations - About 7 hrs to fix
    actiontext/app/assets/javascripts/trix.js on lines 2608..2617
    actiontext/app/assets/javascripts/trix.js on lines 2793..2802
    actiontext/app/assets/javascripts/trix.js on lines 3221..3230

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

    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

        function assertValidReturnValue(e, t) {
          var r = typeof t;
          if (1 === e) {
            if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
            void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
    Severity: Major
    Found in actiontext/app/assets/javascripts/trix.js and 3 other locations - About 7 hrs to fix
    actiontext/app/assets/javascripts/trix.js on lines 2608..2617
    actiontext/app/assets/javascripts/trix.js on lines 3001..3010
    actiontext/app/assets/javascripts/trix.js on lines 3221..3230

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

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

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

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

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

    Refactorings

    Further Reading

    File database_tasks.rb has 475 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "active_record/database_configurations"
    
    module ActiveRecord
      module Tasks # :nodoc:
        class DatabaseNotSupported < StandardError; end # :nodoc:
    Severity: Minor
    Found in activerecord/lib/active_record/tasks/database_tasks.rb - About 7 hrs to fix

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

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

      Function applyDecs2203RFactory has 184 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function applyDecs2203RFactory() {
          function createAddInitializerMethod(e, t) {
            return function (r) {
              !function (e, t) {
                if (e.v) throw new Error("attempted to call " + t + " after decoration was finished");
      Severity: Major
      Found in actiontext/app/assets/javascripts/trix.js - About 7 hrs to fix

        Method load_defaults has 184 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          File configuration.rb has 470 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "ipaddr"
          require "active_support/core_ext/array/wrap"
          require "active_support/core_ext/kernel/reporting"
          require "active_support/file_update_checker"
          require "active_support/configuration_file"
          Severity: Minor
          Found in railties/lib/rails/application/configuration.rb - About 7 hrs to fix

            Method build_stack has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

                  def build_stack
                    ActionDispatch::MiddlewareStack.new do |middleware|
                      unless Array(config.hosts).empty?
                        middleware.use ::ActionDispatch::HostAuthorization, config.hosts, **config.host_authorization
                      end
            Severity: Minor
            Found in railties/lib/rails/application/default_middleware_stack.rb - About 7 hrs to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function applyDecs2203Factory has 179 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function applyDecs2203Factory() {
                function createAddInitializerMethod(e, t) {
                  return function (r) {
                    !function (e, t) {
                      if (e.v) throw new Error("attempted to call " + t + " after decoration was finished");
            Severity: Major
            Found in actiontext/app/assets/javascripts/trix.js - About 7 hrs to fix

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

              const Rails = {
                $: $,
                ajax: ajax,
                buttonClickSelector: buttonClickSelector,
                buttonDisableSelector: buttonDisableSelector,
              Severity: Major
              Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 7 hrs to fix
              actionview/app/assets/javascripts/rails-ujs.js on lines 521..556

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

              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 Rails = {
                  $: $,
                  ajax: ajax,
                  buttonClickSelector: buttonClickSelector,
                  buttonDisableSelector: buttonDisableSelector,
              Severity: Major
              Found in actionview/app/assets/javascripts/rails-ujs.js and 1 other location - About 7 hrs to fix
              actionview/app/assets/javascripts/rails-ujs.esm.js on lines 574..609

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

              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

              Method expand_from_hash has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                    def expand_from_hash(attributes, &block)
                      return ["1=0"] if attributes.empty?
              
                      attributes.flat_map do |key, value|
                        if key.is_a?(Array)
              Severity: Minor
              Found in activerecord/lib/active_record/relation/predicate_builder.rb - About 7 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Severity
              Category
              Status
              Source
              Language