hendolim/countonanon

View on GitHub

Showing 83 of 83 total issues

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

  subscribe: function(channel, callback, context) {
    if (channel instanceof Array)
      return Faye.map(channel, function(c) {
        return this.subscribe(c, callback, context);
      }, this);
Severity: Minor
Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

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

        def process(messages, env, &callback)
          local    = env.nil?
          messages = [messages].flatten
          info('Processing messages: ? (local: ?)', messages, local)
    
    
    Severity: Minor
    Found in faye-1.1.2/lib/faye/protocol/server.rb - About 1 hr to fix

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

          def subscribe(channel, force = false, &block)
            if Array === channel
              return channel.map { |c| subscribe(c, force, &block) }
            end
      
      
      Severity: Minor
      Found in faye-1.1.2/lib/faye/protocol/client.rb - About 1 hr to fix

        Method handle_websocket has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def handle_websocket(request)
              options   = {:extensions => @extensions, :ping => @options[:ping]}
              ws        = Faye::WebSocket.new(request.env, [], options)
              client_id = nil
        
        
        Severity: Minor
        Found in faye-1.1.2/lib/faye/adapters/rack_adapter.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 call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def call(env)
              Faye.ensure_reactor_running!
              request = Rack::Request.new(env)
        
              unless request.path_info =~ @endpoint_re
        Severity: Minor
        Found in faye-1.1.2/lib/faye/adapters/rack_adapter.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 disconnect has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def disconnect(message, local = false, &callback)
              response   = make_response(message)
              client_id  = message['clientId']
        
              @engine.client_exists(client_id) do |exists|
        Severity: Minor
        Found in faye-1.1.2/lib/faye/protocol/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 create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create
            respond_to do |format|
              @message = @conversation.messages.new(message_params)
              @messages = @conversation.messages
              if @messages.length==0
        Severity: Minor
        Found in app/controllers/messages_controller.rb - About 1 hr to fix

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

              def call(env)
                filename = File.basename(env['PATH_INFO'])
                filename = @path_map[filename] || filename
          
                cache = @index[filename] ||= {}
          Severity: Minor
          Found in faye-1.1.2/lib/faye/adapters/static_server.rb - About 1 hr to fix

            Method async_each has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.async_each(list, iterator, callback)
                n       = list.size
                i       = -1
                calls   = 0
                looping = false
            Severity: Minor
            Found in faye-1.1.2/lib/faye.rb - About 1 hr to fix

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

                def create
                  @characteristic = Characteristic.new(characteristic_params)
              
                  respond_to do |format|
                    if @characteristic.save
              Severity: Minor
              Found in app/controllers/characteristics_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/profiles_controller.rb on lines 28..37

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

              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

                def create
                  @profile = Profile.new(profile_params)
              
                  respond_to do |format|
                    if @profile.save
              Severity: Minor
              Found in app/controllers/profiles_controller.rb and 1 other location - About 1 hr to fix
              app/controllers/characteristics_controller.rb on lines 26..35

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

              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 process has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def process(messages, env, &callback)
                    local    = env.nil?
                    messages = [messages].flatten
                    info('Processing messages: ? (local: ?)', messages, local)
              
              
              Severity: Minor
              Found in faye-1.1.2/lib/faye/protocol/server.rb - About 55 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 receive_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def receive_message(message)
                    id = message['id']
              
                    if message.has_key?('successful')
                      callback = @response_callbacks.delete(id)
              Severity: Minor
              Found in faye-1.1.2/lib/faye/protocol/client.rb - About 55 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 unsubscribe has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def unsubscribe(channel, &block)
                    if Array === channel
                      return channel.map { |c| unsubscribe(c, &block) }
                    end
              
              
              Severity: Minor
              Found in faye-1.1.2/lib/faye/protocol/client.rb - About 55 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 handshake has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handshake(&block)
                    return if @advice['reconnect'] == NONE
                    return if @state != UNCONNECTED
              
                    @state = CONNECTING
              Severity: Minor
              Found in faye-1.1.2/lib/faye/protocol/client.rb - About 55 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 handle_error has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handle_error(message, immediate = false)
                    return unless envelope = @envelopes[message['id']]
                    return unless request = envelope.request
              
                    request.callback do |req|
              Severity: Minor
              Found in faye-1.1.2/lib/faye/protocol/dispatcher.rb - About 55 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

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

                def update
                  respond_to do |format|
                    if @profile.update(profile_params)
                      format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }
                      format.json { render :show, status: :ok, location: @profile }
              Severity: Minor
              Found in app/controllers/profiles_controller.rb and 1 other location - About 55 mins to fix
              app/controllers/characteristics_controller.rb on lines 42..49

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

              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

                def update
                  respond_to do |format|
                    if @characteristic.update(characteristic_params)
                      format.html { redirect_to @characteristic, notice: 'Characteristic was successfully updated.' }
                      format.json { render :show, status: :ok, location: @characteristic }
              Severity: Minor
              Found in app/controllers/characteristics_controller.rb and 1 other location - About 55 mins to fix
              app/controllers/profiles_controller.rb on lines 44..51

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

              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 remove_extension has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def remove_extension(extension)
                    return unless @extensions
                    @extensions.delete_if do |ext|
                      next false unless ext == extension
                      extension.removed(self) if extension.respond_to?(:removed)
              Severity: Minor
              Found in faye-1.1.2/lib/faye/protocol/extensible.rb - About 45 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 unsubscribe has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def unsubscribe(client_id, channel, &callback)
                      if @clients.has_key?(client_id)
                        should_trigger = @clients[client_id].delete?(channel)
                        @clients.delete(client_id) if @clients[client_id].empty?
                      end
              Severity: Minor
              Found in faye-1.1.2/lib/faye/engines/memory.rb - About 45 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