Showing 1,817 of 1,817 total issues

Avoid deeply nested control flow statements.
Open

            if (_hasDecorators(other)) {
              throw new ReferenceError("Decorators can't be placed on different accessors with for " + "the same property (" + element.key + ").");
            }
Severity: Major
Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if (nodeIsBlockContainer(container)) {
                    break;
                  }
    Severity: Major
    Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                    if (configAttr.parser(blockElement) === value) {
                      attributeInheritedFromBlock = true;
                      break;
                    }
      Severity: Major
      Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
        Severity: Major
        Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                          if (elements[j].key === elements[k].key && elements[j].placement === elements[k].placement) {
                            throw new TypeError("Duplicated element (" + elements[j].key + ")");
                          }
          Severity: Major
          Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (childIndex > 0) {
                          break;
                        }
            Severity: Major
            Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if ((_attrConfig$test = attrConfig.test) !== null && _attrConfig$test !== void 0 && _attrConfig$test.call(attrConfig, element) || !attrConfig.test) {
                              attributes$1.push(attribute);
                              if (attrConfig.listAttribute) {
                                attributes$1.push(attrConfig.listAttribute);
                              }
              Severity: Major
              Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if (!u) throw new Error("try statement without catch or finally");
                Severity: Major
                Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
                  Severity: Major
                  Found in actiontext/app/assets/javascripts/trix.js - About 45 mins to fix

                    Method validate_transformation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def validate_transformation(name, argument)
                              method_name = name.to_s.tr("-", "_")
                    
                              unless ActiveStorage.supported_image_processing_methods.any? { |method| method_name == method }
                                raise UnsupportedImageProcessingMethod, <<~ERROR.squish

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

                            def validate_arg_hash(argument)
                              argument.each do |key, value|
                                validate_arg_string(key)
                    
                                if value.is_a?(Integer) || value.is_a?(Float)

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

                          def stop_exclusive(compatible: [])
                            synchronize do
                              raise "invalid unlock" if @exclusive_thread != Thread.current
                    
                              @exclusive_depth -= 1
                    Severity: Minor
                    Found in activesupport/lib/active_support/concurrency/share_lock.rb - About 45 mins 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 missing_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def missing_name
                        # Since ruby v2.3.0 `did_you_mean` gem is loaded by default.
                        # It extends NameError#message with spell corrections which are SLOW.
                        # We should use original_message message instead.
                        message = respond_to?(:original_message) ? original_message : self.message
                    Severity: Minor
                    Found in activesupport/lib/active_support/core_ext/name_error.rb - About 45 mins 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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def update
                        if token = decode_verified_token
                          if acceptable_content?(token)
                            named_disk_service(token[:service_name]).upload token[:key], request.body, checksum: token[:checksum]
                            head :no_content
                    Severity: Minor
                    Found in activestorage/app/controllers/active_storage/disk_controller.rb - About 45 mins 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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def initialize(klass, namespace = nil, name = nil, locale = :en)
                          @name = name || klass.name
                    
                          raise ArgumentError, "Class name cannot be blank. You need to supply a name argument when anonymous class given" if @name.blank?
                    
                    
                    Severity: Minor
                    Found in activemodel/lib/active_model/naming.rb - About 45 mins 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 user_input_in_time_zone has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def user_input_in_time_zone(value)
                            return unless value.present?
                    
                            case value
                            when ::String
                    Severity: Minor
                    Found in activemodel/lib/active_model/type/time.rb - About 45 mins 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 prepareOptions has a Cognitive Complexity of 8 (exceeds 5 allowed). 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: Minor
                    Found in actionview/app/assets/javascripts/rails-ujs.esm.js - About 45 mins 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 check_options_validity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def check_options_validity(name)
                              if option = options[name]
                                if option.is_a?(Regexp)
                                  if options[:multiline] != true && regexp_using_multiline_anchors?(option)
                                    raise ArgumentError, "The provided regular expression is using multiline anchors (^ or $), " \
                    Severity: Minor
                    Found in activemodel/lib/active_model/validations/format.rb - About 45 mins 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 module_parent_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def module_parent_name
                        if defined?(@parent_name)
                          @parent_name
                        else
                          parent_name = name =~ /::[^:]+\z/ ? -$` : nil
                    Severity: Minor
                    Found in activesupport/lib/active_support/core_ext/module/introspection.rb - About 45 mins 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 truncate_bytes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def truncate_bytes(truncate_to, omission: "…")
                        omission ||= ""
                    
                        case
                        when bytesize <= truncate_to
                    Severity: Minor
                    Found in activesupport/lib/active_support/core_ext/string/filters.rb - About 45 mins 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