Showing 1,828 of 1,828 total issues

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 233.

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

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

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

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

Refactorings

Further Reading

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

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

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 233.

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

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

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

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

Refactorings

Further Reading

Function _getDecoratorsApi has 236 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function _getDecoratorsApi() {
    _getDecoratorsApi = function () {
      return api;
    };
    var api = {
Severity: Major
Found in actiontext/app/assets/javascripts/trix.js - About 1 day to fix

    Method generate has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

          def generate(owner, methods, location: nil, to: nil, prefix: nil, allow_nil: nil, nilable: true, private: nil, as: nil, signature: nil)
            unless to
              raise ArgumentError, "Delegation needs a target. Supply a keyword argument 'to' (e.g. delegate :hello, to: :greeter)."
            end
    
    
    Severity: Minor
    Found in activesupport/lib/active_support/delegation.rb - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    File callbacks.rb has 559 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "active_support/concern"
    require "active_support/descendants_tracker"
    require "active_support/core_ext/array/extract_options"
    require "active_support/core_ext/class/attribute"
    require "active_support/core_ext/string/filters"
    Severity: Major
    Found in activesupport/lib/active_support/callbacks.rb - About 1 day to fix

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

      var prepareOptions = function(options) {
        options.url = options.url || location.href;
        options.type = options.type.toUpperCase();
        if (options.type === "GET" && options.data) {
          if (options.url.indexOf("?") < 0) {
      Severity: Major
      Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 1 day to fix
      actionview/app/assets/javascripts/rails-ujs.js on lines 109..127

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

      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

        var prepareOptions = function(options) {
          options.url = options.url || location.href;
          options.type = options.type.toUpperCase();
          if (options.type === "GET" && options.data) {
            if (options.url.indexOf("?") < 0) {
      Severity: Major
      Found in actionview/app/assets/javascripts/rails-ujs.js and 1 other location - About 1 day to fix
      actionview/app/assets/javascripts/rails-ujs.esm.js on lines 130..148

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

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

      require "active_support/core_ext/hash/indifferent_access"
      require "active_support/core_ext/array/wrap"
      require "active_support/core_ext/string/filters"
      require "active_support/core_ext/object/to_query"
      require "active_support/deep_mergeable"
      Severity: Major
      Found in actionpack/lib/action_controller/metal/strong_parameters.rb - About 1 day to fix

        File schema_definitions.rb has 539 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module ActiveRecord
          module ConnectionAdapters # :nodoc:
            # Abstract representation of an index definition on a table. Instances of
            # this type are typically created and returned by methods in database
            # adapters. e.g. ActiveRecord::ConnectionAdapters::MySQL::SchemaStatements#indexes

          File cache.rb has 537 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "zlib"
          require "active_support/core_ext/array/extract_options"
          require "active_support/core_ext/enumerable"
          require "active_support/core_ext/module/attribute_accessors"
          require "active_support/core_ext/numeric/bytes"
          Severity: Major
          Found in activesupport/lib/active_support/cache.rb - About 1 day to fix

            Function applyDecs2301Factory has 214 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function applyDecs2301Factory() {
                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 1 day to fix

              Class Request has 57 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Request
                  include Rack::Request::Helpers
                  include ActionDispatch::Http::Cache::Request
                  include ActionDispatch::Http::MimeNegotiation
                  include ActionDispatch::Http::Parameters
              Severity: Major
              Found in actionpack/lib/action_dispatch/http/request.rb - About 1 day to fix

                File action_cable.js has 506 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                (function(global, factory) {
                  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define([ "exports" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, 
                  factory(global.ActionCable = {}));
                })(this, (function(exports) {
                  "use strict";
                Severity: Major
                Found in actioncable/app/assets/javascripts/action_cable.js - About 1 day to fix

                  File actioncable.js has 505 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  (function(global, factory) {
                    typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define([ "exports" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, 
                    factory(global.ActionCable = {}));
                  })(this, (function(exports) {
                    "use strict";
                  Severity: Major
                  Found in actioncable/app/assets/javascripts/actioncable.js - About 1 day to fix

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

                      if (typeof CustomEvent !== "function") {
                        CustomEvent = function(event, params) {
                          const evt = document.createEvent("CustomEvent");
                          evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
                          return evt;
                    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 210..229

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                    if (typeof CustomEvent !== "function") {
                      CustomEvent = function(event, params) {
                        const evt = document.createEvent("CustomEvent");
                        evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
                        return evt;
                    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 182..201

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

                    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 indexes has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def indexes(table_name)
                              indexes = []
                              current_index = nil
                              execute_and_free("SHOW KEYS FROM #{quote_table_name(table_name)}", "SCHEMA") do |result|
                                each_hash(result) do |row|

                    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

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

                    var adapters = {
                      logger: typeof console !== "undefined" ? console : undefined,
                      WebSocket: typeof WebSocket !== "undefined" ? WebSocket : undefined
                    };
                    
                    
                    Severity: Minor
                    Found in actioncable/app/assets/javascripts/actioncable.esm.js - About 7 hrs to fix

                      Method load_defaults has 190 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

                        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.js and 1 other location - About 7 hrs to fix
                        actionview/app/assets/javascripts/rails-ujs.esm.js on lines 150..168

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language