Showing 336 of 336 total issues

Method log_dispatch has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def log_dispatch(class_name, method_name, run_time, args, error)
Severity: Minor
Found in lib/volt/extra_core/logger.rb - About 35 mins to fix

    Method add_multiple_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_multiple_attribute(tag_name, id, attribute_name, parts, content)
    Severity: Minor
    Found in lib/volt/server/html_parser/attribute_scope.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def initialize(handler, path, tag_name, attributes, unary)
      Severity: Minor
      Found in lib/volt/server/html_parser/component_view_scope.rb - About 35 mins to fix

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

                    for ( ; i < length; i++ ) {
                        value = callback( elems[ i ], i, arg );
        
                        if ( value != null ) {
                            ret[ ret.length ] = value;
        Severity: Minor
        Found in app/volt/assets/js/jquery-2.0.3.js and 1 other location - About 35 mins to fix
        app/volt/assets/js/jquery-2.0.3.js on lines 695..701

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 47.

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

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

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

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

        Refactorings

        Further Reading

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

                    for ( i in elems ) {
                        value = callback( elems[ i ], i, arg );
        
                        if ( value != null ) {
                            ret[ ret.length ] = value;
        Severity: Minor
        Found in app/volt/assets/js/jquery-2.0.3.js and 1 other location - About 35 mins to fix
        app/volt/assets/js/jquery-2.0.3.js on lines 685..691

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 47.

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

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

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

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

        Refactorings

        Further Reading

        Method connect! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def connect!
              # The websocket url can be overridden by config.public.websocket_url
              socket_url = Volt.config.try(:public).try(:websocket_url) || begin
                "#{`document.location.host`}/socket"
              end
        Severity: Minor
        Found in lib/volt/page/channel.rb - About 35 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 detect_added_and_moved has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def detect_added_and_moved(skip_channel)
            previous_index = 0
            @current_ids.each_with_index do |id, index|
              if (cur_previous = @previous_ids[previous_index]) && cur_previous == id
                # Same in both previous and new
        Severity: Minor
        Found in app/volt/tasks/live_query/query_tracker.rb - About 35 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 call_ready has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def call_ready
              if @controller
                # Set the current section on the controller if it wants so it can manipulate
                # the dom if needed.
                # Only assign sections for action's, so we don't get AttributeSections bound
        Severity: Minor
        Found in lib/volt/page/bindings/view_binding.rb - About 35 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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def delete(collection, id)
            # Load the model, then call .destroy on it
            query = nil
        
            Volt.skip_permissions do
        Severity: Minor
        Found in app/volt/tasks/store_tasks.rb - About 35 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_binding_anchors! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_binding_anchors!(nodes)
              new_bindings = {}
        
              @binding_anchors.each_pair do |name, anchors|
                new_name         = @@binding_number
        Severity: Minor
        Found in lib/volt/page/targets/dom_template.rb - About 35 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 add_multiple_attribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_multiple_attribute(tag_name, id, attribute_name, parts, content)
              case attribute_name
                when 'checked', 'value'
                  if parts.size > 1
                    if tag_name == 'textarea'
        Severity: Minor
        Found in lib/volt/server/html_parser/attribute_scope.rb - About 35 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 assign_all_attributes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def assign_all_attributes(attrs, track_changes = false)
              # Assign each attribute using setters
              attrs.each_pair do |key, value|
                key = key.to_sym
        
        
        Severity: Minor
        Found in lib/volt/models/model.rb - About 35 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 <=> has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def <=>(other)
            if Time === other
              to_f <=> other.to_f
            else
              r = other <=> self
        Severity: Minor
        Found in lib/volt/utils/time_opal_patch.rb - About 35 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 strftime has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def strftime(format)
            %x{
              return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) {
                var result = "",
                    zero   = flags.indexOf('0') !== -1,
        Severity: Minor
        Found in lib/volt/utils/time_opal_patch.rb - About 35 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 run_changed has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def run_changed(attribute_name = nil)
                  # no_validate mode should only be used internally.  no_validate mode is a
                  # performance optimization that prevents validation from running after each
                  # change when assigning multile attributes.
                  unless Volt.in_mode?(:no_validate)
        Severity: Minor
        Found in lib/volt/models/helpers/change_helpers.rb - About 35 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 parse_query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse_query
              query_hash = {}
              qury = query
        
              if qury
        Severity: Minor
        Found in lib/volt/models/url.rb - About 35 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 sync has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def sync
            raise ".sync can only be used on the server" if Volt.client?
        
            result = nil
            error = nil
        Severity: Minor
        Found in lib/volt/utils/promise_extensions.rb - About 35 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 colorize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def colorize(string, color)
                if STDOUT.tty? && string
                  case color
                  when :cyan
                    "\e[1;34m" + string + "\e[0;37m"
        Severity: Minor
        Found in lib/volt/extra_core/logger.rb - About 35 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 css has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def css
              css_files = []
              @assets.each do |type, path|
                case type
                  when :folder
        Severity: Minor
        Found in lib/volt/server/rack/asset_files.rb - About 35 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 release_read_lock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def release_read_lock
            loop do
              c = @counter.value
              if @counter.compare_and_swap(c, c - 1)
                # If one or more writers were waiting, and we were the last reader, wake a writer up
        Severity: Minor
        Found in lib/volt/utils/read_write_lock.rb - About 35 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