Showing 316 of 336 total issues

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

Avoid too many return statements within this function.
Open

            return compare & 4 ? -1 : 1;
Severity: Major
Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return rootjQuery.ready( selector );
    Severity: Major
    Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                          return results;
      Severity: Major
      Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return ret == null ?
                        undefined :
                        ret;
        Severity: Major
        Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return this;
          Severity: Major
          Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                    return results;
            Severity: Major
            Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return this.constructor( context ).find( selector );
              Severity: Major
              Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return jQuery.makeArray( selector, this );
                Severity: Major
                Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return results;
                  Severity: Major
                  Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return results;
                    Severity: Major
                    Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return select( selector.replace( rtrim, "$1" ), context, results, seed );
                      Severity: Major
                      Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return ret;
                        Severity: Major
                        Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return a.compareDocumentPosition ? -1 : 1;
                          Severity: Major
                          Found in app/volt/assets/js/jquery-2.0.3.js - About 30 mins to fix

                            Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def initialize(volt_app, target, context, binding_name, getter, variable_name, index_name, template_name)
                                  super(volt_app, target, context, binding_name)
                            
                                  @item_name     = variable_name
                                  @index_name    = index_name
                            Severity: Minor
                            Found in lib/volt/page/bindings/each_binding.rb - About 25 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 get_controller_and_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def self.get_controller_and_action(controller_path)
                                  fail "Invalid controller path: #{controller_path.inspect}" unless controller_path && controller_path.size > 0
                            
                                  action = controller_path[-1]
                            
                            
                            Severity: Minor
                            Found in lib/volt/page/bindings/view_binding/controller_handler.rb - About 25 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 create_controller_handler has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def create_controller_handler(full_path, controller_path)
                                  # If arguments is nil, then an blank SubContext will be created
                                  args = [SubContext.new(@arguments, nil, true)]
                            
                                  # get the controller class and action
                            Severity: Minor
                            Found in lib/volt/page/bindings/view_binding.rb - About 25 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 set_content_to_template has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def set_content_to_template(volt_app, template_name)
                                  if self.is_a?(DomSection)
                                    # DomTemplates are an optimization when working with the DOM (as opposed to other targets)
                                    dom_template = (@@template_cache[template_name] ||= DomTemplate.new(volt_app, template_name))
                            
                            
                            Severity: Minor
                            Found in lib/volt/page/targets/base_section.rb - About 25 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