websocket-rails/websocket-rails

View on GitHub

Showing 15 of 15 total issues

Class Configuration has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Configuration

    def user_identifier
      @user_identifier ||= :id
    end
Severity: Minor
Found in lib/websocket_rails/configuration.rb - About 4 hrs to fix

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

        class Base
    
          include Logging
    
          def self.accepts?(env)
    Severity: Minor
    Found in lib/websocket_rails/connection_adapters.rb - About 3 hrs to fix

      Class Synchronization has 23 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Synchronization
      
          def self.all_users
            singleton.all_users
          end
      Severity: Minor
      Found in lib/websocket_rails/synchronization.rb - About 2 hrs to fix

        Class BaseController has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class BaseController
        
            # We need process_action to be in a module loaded before AbstractController::Callbacks
            # to get inheritance properly
            module Metal
        Severity: Minor
        Found in lib/websocket_rails/base_controller.rb - About 2 hrs to fix

          Method synchronize! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def synchronize!
                unless @synchronizing
                  @server_token = generate_server_token
                  register_server(@server_token)
          
          
          Severity: Minor
          Found in lib/websocket_rails/synchronization.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 filter_channel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def filter_channel(event)
                actions = []
                actions << Fiber.new do
                  begin
                    log_event(event) do
          Severity: Minor
          Found in lib/websocket_rails/dispatcher.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(event_name, options={})
                case event_name
                when String
                  namespace   = event_name.split('.')
                  @name       = namespace.pop.to_sym
          Severity: Minor
          Found in lib/websocket_rails/event.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 schedule_dequeue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def schedule_dequeue
                    return unless @body_callback
                    EM.next_tick do
                      next unless c = @queue.shift
                      @body_callback.call(c)
          Severity: Minor
          Found in lib/websocket_rails/connection_adapters/http.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 synchronize! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def synchronize!
                unless @synchronizing
                  @server_token = generate_server_token
                  register_server(@server_token)
          
          
          Severity: Minor
          Found in lib/websocket_rails/synchronization.rb - About 1 hr to fix

            Method actual_for_spec_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.actual_for_spec_message(event, success)
                  if event.triggered?
                    if success.nil?
                      "triggered message #{actual_data_for_spec_message(event.data)}"
                    else
            Severity: Minor
            Found in lib/spec_helpers/matchers/trigger_matchers.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 each has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def each(&block)
                  if WebsocketRails.synchronize?
                    users_hash = Synchronization.all_users || return
                    users_hash.each do |identifier, user_json|
                      connection = remote_connection_from_json(identifier, user_json)
            Severity: Minor
            Found in lib/websocket_rails/user_manager.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 new_from_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.new_from_json(encoded_data, connection)
                  case encoded_data
                  when String
                    event_name, data = JSON.parse encoded_data
            
            
            Severity: Minor
            Found in lib/websocket_rails/event.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 routes_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def routes_for(event, event_namespace=nil, &block)
            
                    # Grab the first level namespace from the namespace array
                    # and remove it from the copy.
                    event_namespace = copy_event_namespace( event, event_namespace ) || return
            Severity: Minor
            Found in lib/websocket_rails/event_map.rb - About 35 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 verify_route has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def self.verify_route(event, target, non_exclusive)
            
                    raise ArgumentError, 'event must be of type SpecHelperEvent' unless event.is_a? WebsocketRails::SpecHelperEvent
                    target_class, target_method = WebsocketRails::TargetValidator.validate_target target
            
            
            Severity: Minor
            Found in lib/spec_helpers/matchers/route_matchers.rb - About 35 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 dispatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def dispatch(event)
                  return if event.is_invalid?
            
                  if event.is_channel?
                    filter_channel(event)
            Severity: Minor
            Found in lib/websocket_rails/dispatcher.rb - About 25 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