hendolim/countonanon

View on GitHub

Showing 57 of 83 total issues

File faye-browser.js has 1910 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function() {
'use strict';

var Faye = {
  VERSION:          '1.1.2',
Severity: Major
Found in faye-1.1.2/lib/faye-browser.js - About 5 days to fix

    Method connect has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def connect
          @state ||= UNCONNECTED
          return unless @state == UNCONNECTED
          @state = CONNECTING
    
    
    Severity: Minor
    Found in faye-1.1.2/lib/faye/transport/web_socket.rb - About 4 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 handle_request has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_request(request)
          unless json_msg = message_from_request(request)
            error 'Received request with no message: ?', format_request(request)
            return [400, TYPE_TEXT, ['Bad request']]
          end
    Severity: Minor
    Found in faye-1.1.2/lib/faye/adapters/rack_adapter.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

    Method subscribe has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def subscribe(message, local = false, &callback)
          response     = make_response(message)
          client_id    = message['clientId']
          subscription = [message['subscription']].flatten
    
    
    Severity: Minor
    Found in faye-1.1.2/lib/faye/protocol/server.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

    Method unsubscribe has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        def unsubscribe(message, local = false, &callback)
          response     = make_response(message)
          client_id    = message['clientId']
          subscription = [message['subscription']].flatten
    
    
    Severity: Minor
    Found in faye-1.1.2/lib/faye/protocol/server.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 str has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function str(key, holder) {
    
    // Produce a string from holder[key].
    
            var i,          // The loop counter.
    Severity: Major
    Found in faye-1.1.2/lib/faye-browser.js - About 2 hrs to fix

      Method pipe_through_extensions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def pipe_through_extensions(stage, message, env, &callback)
            debug('Passing through ? extensions: ?', stage, message)
      
            return callback.call(message) unless @extensions
            extensions = @extensions.dup
      Severity: Minor
      Found in faye-1.1.2/lib/faye/protocol/extensible.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 connect has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def connect(message, local = false, &callback)
            response        = make_response(message)
            client_id       = message['clientId']
            connection_type = message['connectionType']
      
      
      Severity: Minor
      Found in faye-1.1.2/lib/faye/protocol/server.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 get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

            def get(dispatcher, allowed, disabled, &callback)
              endpoint = dispatcher.endpoint
      
              select = lambda do |(conn_type, klass), resume|
                conn_endpoint = dispatcher.endpoint_for(conn_type)
      Severity: Minor
      Found in faye-1.1.2/lib/faye/transport/transport.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 connect has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def connect
            @state ||= UNCONNECTED
            return unless @state == UNCONNECTED
            @state = CONNECTING
      
      
      Severity: Minor
      Found in faye-1.1.2/lib/faye/transport/web_socket.rb - About 2 hrs to fix

        Method call has a Cognitive Complexity of 15 (exceeds 5 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

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

          connect: function() {
            if (Faye.Transport.WebSocket._unloaded) return;
        
            this._state = this._state || this.UNCONNECTED;
            if (this._state !== this.UNCONNECTED) return;
        Severity: Minor
        Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

          Method create has a Cognitive Complexity of 14 (exceeds 5 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

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

          EventEmitter.prototype.emit = function(type) {
            // If there is no 'error' event listener then throw.
            if (type === 'error') {
              if (!this._events || !this._events.error ||
                  (isArray(this._events.error) && !this._events.error.length))
          Severity: Minor
          Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

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

              request: function(messages) {
                var xhrClass = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
                    xhr      = new xhrClass(),
                    id       = ++Faye.Transport.CORS._id,
                    headers  = this._dispatcher.headers,
            Severity: Minor
            Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

              Method handle_request has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def handle_request(request)
                    unless json_msg = message_from_request(request)
                      error 'Received request with no message: ?', format_request(request)
                      return [400, TYPE_TEXT, ['Bad request']]
                    end
              Severity: Minor
              Found in faye-1.1.2/lib/faye/adapters/rack_adapter.rb - About 1 hr to fix

                Function parse has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  parse: function(url) {
                    if (typeof url !== 'string') return url;
                    var uri = {}, parts, query, pairs, i, n, data;
                
                    var consume = function(name, pattern) {
                Severity: Minor
                Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix

                  Method subscribe has a Cognitive Complexity of 12 (exceeds 5 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

                  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 async_each has a Cognitive Complexity of 12 (exceeds 5 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

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

                          JSON.parse = function (text, reviver) {
                  
                  // The parse method takes a text and an optional reviver function, and returns
                  // a JavaScript value if the text is a valid JSON text.
                  
                  
                  Severity: Minor
                  Found in faye-1.1.2/lib/faye-browser.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language