Showing 336 of 336 total issues

Method decode has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def self.decode(obj)
      if Array === obj
        obj.map {|v| decode(v) }
      elsif Hash === obj
        if obj.size == 1 && (escape = obj['$escape'])
Severity: Minor
Found in lib/volt/utils/ejson.rb - About 3 hrs 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

File model.rb has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'volt/models/model_wrapper'
require 'volt/models/array_model'
require 'volt/models/helpers/base'
require 'volt/models/model_hash_behaviour'
require 'volt/models/validations/validations'
Severity: Minor
Found in lib/volt/models/model.rb - About 3 hrs to fix

    Class ReactiveArray has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class ReactiveArray
        include Eventable
    
        def initialize(array = [])
          @array      = array
    Severity: Minor
    Found in lib/volt/reactive/reactive_array.rb - About 3 hrs to fix

      Class Routes has 27 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Routes
          def initialize
            # Paths where there are no bindings (an optimization)
            @direct_routes   = {}
      
      
      Severity: Minor
      Found in lib/volt/router/routes.rb - About 3 hrs to fix

        Method acquire_write_lock has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

          def acquire_write_lock
            loop do
              c = @counter.value
              fail 'Too many writers!' if (c & MAX_WRITERS) == MAX_WRITERS
        
        
        Severity: Minor
        Found in lib/volt/utils/read_write_lock.rb - About 3 hrs 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 Sizzle has 76 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Sizzle( selector, context, results, seed ) {
            var match, elem, m, nodeType,
                // QSA vars
                i, groups, old, nid, newContext, newSelector;
        
        
        Severity: Major
        Found in app/volt/assets/js/jquery-2.0.3.js - About 3 hrs to fix

          Method check_errors has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_errors
                if @value && @value.is_a?(Numeric)
                  if @args.is_a?(Hash)
          
                    @args.each do |arg, val|
          Severity: Minor
          Found in lib/volt/models/validators/numericality_validator.rb - About 2 hrs 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 21 (exceeds 5 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 2 hrs 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 acquire_read_lock has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def acquire_read_lock
              loop do
                c = @counter.value
                fail 'Too many reader threads!' if (c & MAX_READERS) == MAX_READERS
          
          
          Severity: Minor
          Found in lib/volt/utils/read_write_lock.rb - About 2 hrs 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 add has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              add: function( elem, types, handler, data, selector ) {
          
                  var handleObjIn, eventHandle, tmp,
                      events, t, handleObj,
                      special, handlers, type, namespaces, origType,
          Severity: Major
          Found in app/volt/assets/js/jquery-2.0.3.js - About 2 hrs to fix

            Function matcherFromGroupMatchers has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
                // A counter to specify which element is currently being matched
                var matcherCachedRuns = 0,
                    bySet = setMatchers.length > 0,
                    byElement = elementMatchers.length > 0,
            Severity: Major
            Found in app/volt/assets/js/jquery-2.0.3.js - About 2 hrs to fix

              Method update has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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 move_to_root has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                    def move_to_root
                      unless Gem.win_platform?
                        # Change CWD to the root of the volt project
                        pwd = Dir.pwd
                        changed = false
              Severity: Minor
              Found in lib/volt/cli.rb - About 2 hrs 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 a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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 compute! has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                  def compute!(initial_run=false)
                    @invalidated = false
              
                    unless @stopped
              
              
              Severity: Minor
              Found in lib/volt/reactive/computation.rb - About 2 hrs 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 done has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function done( status, nativeStatusText, responses, headers ) {
                          var isSuccess, success, error, response, modified,
                              statusText = nativeStatusText;
              
                          // Called once
              Severity: Major
              Found in app/volt/assets/js/jquery-2.0.3.js - About 2 hrs to fix

                Function setMatcher has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
                    if ( postFilter && !postFilter[ expando ] ) {
                        postFilter = setMatcher( postFilter );
                    }
                    if ( postFinder && !postFinder[ expando ] ) {
                Severity: Major
                Found in app/volt/assets/js/jquery-2.0.3.js - About 2 hrs to fix

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

                      def initialize(builder, app_url, app_path, component_paths)
                        Opal::Processor.source_map_enabled = Volt.source_maps?
                        Opal::Processor.const_missing_enabled = true
                  
                        # Setup Opal paths
                  Severity: Major
                  Found in lib/volt/server/rack/opal_files.rb - About 2 hrs to fix

                    Method field has a Cognitive Complexity of 19 (exceeds 5 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 2 hrs 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 depend has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def depend
                          # If there is no @dependencies, don't depend because it has been removed
                          return unless @dependencies
                    
                          current = Computation.current
                    Severity: Minor
                    Found in lib/volt/reactive/dependency.rb - About 2 hrs 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