Showing 336 of 336 total issues

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

      def watch_and_resolve!(success, failure=nil, yield_nil_for_unresolved_promise=false)
        # Keep results between runs
        result = nil
    
        computation = proc do |comp|
    Severity: Minor
    Found in lib/volt/reactive/computation.rb - About 1 hr to fix

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

          def compute!(initial_run=false)
            @invalidated = false
      
            unless @stopped
      
      
      Severity: Minor
      Found in lib/volt/reactive/computation.rb - About 1 hr to fix

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

            def write_files_and_manifest
              asset_files = AssetFiles.from_cache(@volt_app.app_url, 'main', @volt_app.component_paths)
              # Write a temp css file
              js = asset_files.javascript(@volt_app)
              css = asset_files.css
        Severity: Minor
        Found in lib/volt/cli/asset_compile.rb - About 1 hr to fix

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

              preventDefault: function() {
                  var e = this.originalEvent;
          
                  this.isDefaultPrevented = returnTrue;
          
          
          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 4958..4966

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

          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

              stopPropagation: function() {
                  var e = this.originalEvent;
          
                  this.isPropagationStopped = returnTrue;
          
          
          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 4949..4957

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

          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 initialize has a Cognitive Complexity of 10 (exceeds 5 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: Minor
          Found in lib/volt/server/rack/opal_files.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def initialize
                  # rbnacl is not supported on windows.
                  windows = Gem.win_platform?
          
                  if windows
          Severity: Minor
          Found in lib/volt/server/message_bus/message_encoder.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 filtered_attributes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def filtered_attributes
                  # Run the read permission check
                  allow_and_deny_fields(:read).then do |allow, deny|
          
                    result = nil
          Severity: Minor
          Found in lib/volt/models/permissions.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 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.validate(model, field_name, args)
                if RUBY_PLATFORM != 'opal'
                  if args
                    value  = model.get(field_name)
          
          
          Severity: Minor
          Found in lib/volt/models/validators/unique_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 duration_in_words has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def duration_in_words(places=2, min_unit=:minutes, recent_message='just now')
                parts = []
                secs = to_i
                UNIT_MAP.each_pair do |unit, count|
                  val = (secs / count).floor
          Severity: Minor
          Found in lib/volt/helpers/time/distance.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 components has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def components
                return @components if @components
          
                @components = {}
                app_folders do |app_folder|
          Severity: Minor
          Found in lib/volt/server/rack/component_paths.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def get(attr_name, expand = false)
                # Reading an attribute, we may get back a nil model.
                attr_name = attr_name.to_sym
          
                check_valid_field_name(attr_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 start_message_bus has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def start_message_bus
                  return if ENV['NO_MESSAGE_BUS']
          
                  unless RUBY_PLATFORM == 'opal'
          
          
          Severity: Minor
          Found in lib/volt/volt/server_setup/app.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

          Function fix has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              fix: function( event ) {
                  if ( event[ jQuery.expando ] ) {
                      return event;
                  }
          
          
          Severity: Minor
          Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

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

              Function propFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function propFilter( props, specialEasing ) {
                  var index, name, easing, value, hooks;
              
                  // camelCase, specialEasing and expand cssHook pass
                  for ( index in props ) {
              Severity: Minor
              Found in app/volt/assets/js/jquery-2.0.3.js - About 1 hr to fix

                Method rezero_bindings has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def rezero_bindings(html, bindings)
                      @@base_binding_id ||= 20_000
                      # rezero
                      parts  = html.split(/(\<\!\-\- \$\/?[0-9]+ \-\-\>)/).reject { |v| v == '' }
                
                
                Severity: Minor
                Found in lib/volt/page/targets/attribute_section.rb - About 1 hr to fix

                  Method filtered_attributes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def filtered_attributes
                          # Run the read permission check
                          allow_and_deny_fields(:read).then do |allow, deny|
                  
                            result = nil
                  Severity: Minor
                  Found in lib/volt/models/permissions.rb - About 1 hr to fix

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

                      def initialize(thor, name, options)
                        @thor = thor
                        @component_name = name.chomp('/')
                        @name = 'volt-' + @component_name # remove trailing slash if present
                        @shell = Thor::Base.shell.new
                    Severity: Minor
                    Found in lib/volt/cli/new_gem.rb - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language