Showing 1,828 of 1,828 total issues

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

    File compatibility.rb has 387 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module ActiveRecord
      class Migration
        module Compatibility # :nodoc: all
          def self.find(version)
            version = version.to_s
    Severity: Minor
    Found in activerecord/lib/active_record/migration/compatibility.rb - About 5 hrs to fix

      File database_statements.rb has 386 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module ActiveRecord
        module ConnectionAdapters # :nodoc:
          module DatabaseStatements
            def initialize
              super

        File time_zone.rb has 384 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "tzinfo"
        require "concurrent/map"
        
        module ActiveSupport
          # = Active Support \Time Zone
        Severity: Minor
        Found in activesupport/lib/active_support/values/time_zone.rb - About 5 hrs to fix

          File test_case.rb has 380 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "rack/session/abstract/id"
          require "active_support/core_ext/hash/conversions"
          require "active_support/core_ext/object/to_query"
          require "active_support/core_ext/module/anonymous"
          require "active_support/core_ext/module/redefine_method"
          Severity: Minor
          Found in actionpack/lib/action_controller/test_case.rb - About 5 hrs to fix

            Method fetch has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                  def fetch(name, options = nil, &block)
                    if block_given?
                      options = merged_options(options)
                      key = normalize_key(name, options)
            
            
            Severity: Minor
            Found in activesupport/lib/active_support/cache.rb - About 5 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

            Method store_accessor has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                  def store_accessor(store_attribute, *keys, prefix: nil, suffix: nil)
                    keys = keys.flatten
            
                    accessor_prefix =
                      case prefix
            Severity: Minor
            Found in activerecord/lib/active_record/store.rb - About 5 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

            Method execute_grouped_calculation has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
            Open

                  def execute_grouped_calculation(operation, column_name, distinct) # :nodoc:
                    group_fields = group_values
                    group_fields = group_fields.uniq if group_fields.size > 1
            
                    if group_fields.size == 1 && group_fields.first.respond_to?(:to_sym)
            Severity: Minor
            Found in activerecord/lib/active_record/relation/calculations.rb - About 5 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

            File schema_cache.rb has 378 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "active_support/core_ext/file/atomic"
            
            module ActiveRecord
              module ConnectionAdapters
                class SchemaReflection
            Severity: Minor
            Found in activerecord/lib/active_record/connection_adapters/schema_cache.rb - About 5 hrs to fix

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

                var disableFormElement = function(element) {
                  if (getData(element, "ujs:disabled")) {
                    return;
                  }
                  const replacement = element.getAttribute("data-disable-with");
              Severity: Major
              Found in actionview/app/assets/javascripts/rails-ujs.js and 1 other location - About 5 hrs to fix
              actionview/app/assets/javascripts/rails-ujs.esm.js on lines 402..418

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

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

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

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

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

              Refactorings

              Further Reading

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

              var disableFormElement = function(element) {
                if (getData(element, "ujs:disabled")) {
                  return;
                }
                const replacement = element.getAttribute("data-disable-with");
              Severity: Major
              Found in actionview/app/assets/javascripts/rails-ujs.esm.js and 1 other location - About 5 hrs to fix
              actionview/app/assets/javascripts/rails-ujs.js on lines 358..374

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

              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 SelectManager has 38 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class SelectManager < Arel::TreeManager
                  include Arel::Crud
              
                  STRING_OR_SYMBOL_CLASS = [Symbol, String]
              
              
              Severity: Minor
              Found in activerecord/lib/arel/select_manager.rb - About 5 hrs to fix

                Method deserialize has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                          def deserialize(value)
                            return value unless value.is_a?(::String)
                
                            scanner = StringScanner.new(value)
                            hash = {}

                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

                Method with_raw_connection has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                        def with_raw_connection(allow_retry: false, materialize_transactions: true)
                          @lock.synchronize do
                            connect! if @raw_connection.nil? && reconnect_can_restore_state?
                
                            self.materialize_transactions if materialize_transactions

                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

                Method run has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                        def run
                          loop do
                            if @stopping
                              @nio.close
                              break
                Severity: Minor
                Found in actioncable/lib/action_cable/connection/stream_event_loop.rb - About 4 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

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

                  function createWebSocketURL(url) {
                    if (typeof url === "function") {
                      url = url();
                    }
                    if (url && !/^wss?:/i.test(url)) {
                Severity: Major
                Found in actioncable/app/assets/javascripts/actioncable.js and 2 other locations - About 4 hrs to fix
                actioncable/app/assets/javascripts/action_cable.js on lines 472..485
                actioncable/app/assets/javascripts/actioncable.esm.js on lines 486..499

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

                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 createWebSocketURL(url) {
                  if (typeof url === "function") {
                    url = url();
                  }
                  if (url && !/^wss?:/i.test(url)) {
                Severity: Major
                Found in actioncable/app/assets/javascripts/actioncable.esm.js and 2 other locations - About 4 hrs to fix
                actioncable/app/assets/javascripts/action_cable.js on lines 472..485
                actioncable/app/assets/javascripts/actioncable.js on lines 472..485

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

                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 createWebSocketURL(url) {
                    if (typeof url === "function") {
                      url = url();
                    }
                    if (url && !/^wss?:/i.test(url)) {
                Severity: Major
                Found in actioncable/app/assets/javascripts/action_cable.js and 2 other locations - About 4 hrs to fix
                actioncable/app/assets/javascripts/actioncable.esm.js on lines 486..499
                actioncable/app/assets/javascripts/actioncable.js on lines 472..485

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

                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 CollectionAssociation has 37 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class CollectionAssociation < Association # :nodoc:
                      attr_accessor :nested_attributes_target
                
                      # Implements the reader method, e.g. foo.items for Foo.has_many :items
                      def reader
                Severity: Minor
                Found in activerecord/lib/active_record/associations/collection_association.rb - About 4 hrs to fix

                  Class CollectionProxy has 37 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class CollectionProxy < Relation
                        def initialize(klass, association, **) # :nodoc:
                          @association = association
                          super klass
                  
                  
                  Severity: Minor
                  Found in activerecord/lib/active_record/associations/collection_proxy.rb - About 4 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language