hendolim/countonanon

View on GitHub

Showing 57 of 83 total issues

Function request has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  request: function(messages) {
    var href = this.endpoint.href,
        xhr  = Faye.ENV.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest(),
        self = this;

Severity: Minor
Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

          if ((element    && element    !== register._element)   ||
              (eventName  && eventName  !== register._type)      ||
              (callback   && callback   !== register._callback)  ||
              (context      && context      !== register._context))
            continue;
    Severity: Critical
    Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

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

          def advize(response, connection_type)
            return unless [Channel::HANDSHAKE, Channel::CONNECT].include?(response['channel'])
      
            if connection_type == 'eventsource'
              interval = (@engine.timeout * 1000).floor
      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

      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

                  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

                  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

                  Avoid deeply nested control flow statements.
                  Open

                                          if (v) {
                                              partial.push(quote(k) + (gap ? ': ' : ':') + v);
                                          }
                  Severity: Major
                  Found in faye-1.1.2/lib/faye-browser.js - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language