Showing 336 of 336 total issues

Method run_worker has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def run_worker
        while (message = @message_queue.pop)
          break if message == :QUIT

          begin
Severity: Minor
Found in lib/volt/server/message_bus/peer_to_peer/peer_connection.rb - About 1 hr 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 dispatch_in_thread has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def dispatch_in_thread(channel, message)
      callback_id, class_name, method_name, meta_data, *args = message
      method_name = method_name.to_sym

      # Get the class
Severity: Minor
Found in lib/volt/tasks/dispatcher.rb - About 1 hr 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 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def set(attribute_name, value, &block)
      # Assign, without the =
      attribute_name = attribute_name.to_sym

      check_valid_field_name(attribute_name)
Severity: Minor
Found in lib/volt/models/model.rb - About 1 hr 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 getter_to_setter has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def getter_to_setter(getter)
      getter = getter.strip.gsub(/\(\s*\)/, '')

      # Check to see if this can be converted to a setter
      if getter[0] =~ /^[A-Z]/ && getter[-1] != ')'
Severity: Minor
Found in lib/volt/server/html_parser/attribute_scope.rb - About 1 hr 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 item_added has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def item_added(position)
      item_context = nil

      binding_name     = @@binding_number
      @@binding_number += 1
Severity: Minor
Found in lib/volt/page/bindings/each_binding.rb - About 1 hr to fix

    Function dispatch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        dispatch: function( event ) {
    
            // Make a writable jQuery.Event from the native event object
            event = jQuery.event.fix( event );
    
    
    Severity: Minor
    Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

      Function access has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
              var i = 0,
                  length = elems.length,
                  bulk = key == null;
      
      
      Severity: Minor
      Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

        Method validate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.validate(model, field_name, args)
              errors = {}
              value  = model.get(field_name)
        
              type_restriction = args.is_a?(Hash) ? (args[:type] || args[:types]) : args
        Severity: Minor
        Found in lib/volt/models/validators/type_validator.rb - About 1 hr to fix

          Method add_linking_in_asset_path has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def add_linking_in_asset_path
                app_path = @volt_app.app_path
                @env.context_class.class_eval do
                  # We "freedom-patch" sprockets-helpers asset_path method to
                  # automatically link assets.
          Severity: Minor
          Found in lib/volt/server/rack/sprockets_helpers_setup.rb - About 1 hr to fix

            Method update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def update(path, section_or_arguments = nil, options = {})
                  Computation.run_without_tracking do
                    @options = options
            
                    # A blank path needs to load a missing template, otherwise it tries to load
            Severity: Minor
            Found in lib/volt/page/bindings/view_binding.rb - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                                      } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
                                          diff = cache[1];
              
                                      // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
                                      } else {
              Severity: Critical
              Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                            if ( start && start[ 3 ] !== unit ) {
                                // Trust units reported by jQuery.css
                                unit = unit || start[ 3 ];
                
                                // Make sure we update the tween properties later on
                Severity: Critical
                Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                  Function setOffset has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      setOffset: function( elem, options, i ) {
                          var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
                              position = jQuery.css( elem, "position" ),
                              curElem = jQuery( elem ),
                              props = {};
                  Severity: Minor
                  Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                    Method parse has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def parse
                          loop do
                            if last && SPECIAL[last]
                              # In a script or style tag, just look for the first end
                              close_tag = "</#{last}>"
                    Severity: Minor
                    Found in lib/volt/server/html_parser/sandlebars_parser.rb - About 1 hr to fix

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

                              if ( jQuery.isFunction( value ) ) {
                                  return this.each(function( j ) {
                                      jQuery( this ).removeClass( value.call( this, j, this.className ) );
                                  });
                              }
                      Severity: Major
                      Found in app/volt/assets/js/jquery-2.0.3.js and 1 other location - About 1 hr to fix
                      app/volt/assets/js/jquery-2.0.3.js on lines 3830..3834

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

                      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 ( jQuery.isFunction( value ) ) {
                                  return this.each(function( j ) {
                                      jQuery( this ).addClass( value.call( this, j, this.className ) );
                                  });
                              }
                      Severity: Major
                      Found in app/volt/assets/js/jquery-2.0.3.js and 1 other location - About 1 hr to fix
                      app/volt/assets/js/jquery-2.0.3.js on lines 3869..3873

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

                      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 server has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def server
                            move_to_root
                            if ENV['PROFILE_BOOT']
                              begin
                                require 'ruby-prof'
                      Severity: Minor
                      Found in lib/volt/cli.rb - About 1 hr to fix

                        Function style has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            style: function( elem, name, value, extra ) {
                                // Don't set styles on text and comment nodes
                                if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
                                    return;
                                }
                        Severity: Minor
                        Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                          Method update_binding_anchors! has 32 lines of code (exceeds 25 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 1 hr to fix

                            Function load has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            jQuery.fn.load = function( url, params, callback ) {
                                if ( typeof url !== "string" && _load ) {
                                    return _load.apply( this, arguments );
                                }
                            
                            
                            Severity: Minor
                            Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language