Showing 336 of 336 total issues

Method field has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def field(name, klasses = nil, options = {})
        if klasses
          klasses = [klasses].flatten

          unless klasses.any? {|kl| FIELD_CASTS.key?(kl) }
Severity: Minor
Found in lib/volt/models/field_helpers.rb - About 1 hr to fix

    Method assign_from_old has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def assign_from_old(params, new_params)
          queued_deletes = []
    
          params.attributes.each_pair do |name, old_val|
            # If there is a new value, see if it has [name]
    Severity: Minor
    Found in lib/volt/models/url.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 start_child has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def start_child
          # Aquire the write lock, so we prevent anyone from using the child until
          # its setup or recreated.
          unless @drb_object
            # Get the id of the parent process, so we can wait for exit in the child
    Severity: Minor
    Found in lib/volt/server/forking_server.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 run_initial_setup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_initial_setup(initial_setup)
          # Save the changes
          if initial_setup
            # Run initial validation
            if Volt.in_mode?(:no_validate)
    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 validate has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.validate(model, field_name, args)
          errors = {}
          value  = model.get(field_name)
    
          if args.is_a?(Fixnum)
    Severity: Minor
    Found in lib/volt/models/validators/length_validator.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 start_binding has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def start_binding
          binding    = ''
          open_count = 1
    
          # scan until we reach a {{ or }}
    Severity: Minor
    Found in lib/volt/server/html_parser/sandlebars_parser.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 add_indirect_path has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_indirect_path(node, path, params)
          parts = url_parts(path)
    
          parts.each_with_index do |part, index|
            if has_binding?(part)
    Severity: Minor
    Found in lib/volt/router/routes.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 current_user_id has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def current_user_id
          # Check for a user_id from with_user
          if (user_id = Thread.current['with_user_id'])
            return user_id
          end
    Severity: Minor
    Found in lib/volt/volt/users.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 path_for_template has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def path_for_template(lookup_path, force_section = nil)
          parts      = lookup_path.split('/')
          parts_size = parts.size
    
          return nil, nil if parts_size == 0
    Severity: Minor
    Found in lib/volt/page/bindings/view_binding/view_lookup_for_path.rb - About 1 hr to fix

      Method start_child has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def start_child
            # Aquire the write lock, so we prevent anyone from using the child until
            # its setup or recreated.
            unless @drb_object
              # Get the id of the parent process, so we can wait for exit in the child
      Severity: Minor
      Found in lib/volt/server/forking_server.rb - About 1 hr to fix

        Function attr has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            attr: function( elem, name, value ) {
                var hooks, ret,
                    nType = elem.nodeType;
        
                // don't get/set attributes on text, comment and attribute nodes
        Severity: Minor
        Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

          Function handlers has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              handlers: function( event, handlers ) {
                  var i, matches, sel, handleObj,
                      handlerQueue = [],
                      delegateCount = handlers.delegateCount,
                      cur = event.target;
          Severity: Minor
          Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

            Function removeClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                removeClass: function( value ) {
                    var classes, elem, cur, clazz, j,
                        i = 0,
                        len = this.length,
                        proceed = arguments.length === 0 || typeof value === "string" && value;
            Severity: Minor
            Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

              Function toggleClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  toggleClass: function( value, stateVal ) {
                      var type = typeof value;
              
                      if ( typeof stateVal === "boolean" && type === "string" ) {
                          return stateVal ? this.addClass( value ) : this.removeClass( value );
              Severity: Minor
              Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                Function addClass has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    addClass: function( value ) {
                        var classes, elem, cur, clazz, j,
                            i = 0,
                            len = this.length,
                            proceed = typeof value === "string" && value;
                Severity: Minor
                Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

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

                      def parse(url)
                        if url[0] == '#'
                          # url only updates fragment
                          self.fragment = url[1..-1]
                          update!
                  Severity: Minor
                  Found in lib/volt/models/url.rb - About 1 hr to fix

                    Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def initialize(app_path=nil)
                          app_path ||= Dir.pwd
                    
                          if Volt.server? && !app_path
                            raise "Volt::App.new requires an app path to boot"
                    Severity: Minor
                    Found in lib/volt/volt/app.rb - About 1 hr to fix

                      Function finish has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          finish: function( type ) {
                              if ( type !== false ) {
                                  type = type || "fx";
                              }
                              return this.each(function() {
                      Severity: Minor
                      Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                        Method url_for has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def url_for(params)
                              host_with_port = host || location.host
                              host_with_port += ":#{port}" if port && port != 80
                              scheme = scheme || location.scheme
                        
                        
                        Severity: Minor
                        Found in lib/volt/models/url.rb - About 1 hr to fix

                          Method changed has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                def changed(attribute_name = nil)
                                  path = @model.path
                          
                                  promise = Promise.new
                          
                          
                          Severity: Minor
                          Found in lib/volt/models/persistors/model_store.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language