NexusSW/nio4r-websocket

View on GitHub

Showing 150 of 150 total issues

Method start has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def start
          WebSocket.logger.debug "Starting reactor" unless @reactor
          @reactor ||= Thread.start do
            Thread.current.abort_on_exception = true
            WebSocket.logger.info "Reactor started"
Severity: Minor
Found in lib/nio/websocket/reactor.rb - About 1 hr to fix

    Block has too many lines. [28/25]
    Open

              @reactor ||= Thread.start do
                Thread.current.abort_on_exception = true
                WebSocket.logger.info "Reactor started"
                begin
                  loop do
    Severity: Minor
    Found in lib/nio/websocket/reactor.rb by rubocop

    This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

    Method try_accept_nonblock has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def try_accept_nonblock(io)
            waiting = accept_nonblock io
            if [:r, :w].include? waiting
              # Only happens on server side ssl negotiation
              Reactor.queue_task do
    Severity: Minor
    Found in lib/nio/websocket.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

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

    require "rspec/core/rake_task"
    Severity: Minor
    Found in Rakefile by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

      spec.summary       = "websocket-driver implementation built over nio4r"
    Severity: Minor
    Found in nio4r-websocket.gemspec by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

      spec.bindir        = "exe"
    Severity: Minor
    Found in nio4r-websocket.gemspec by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

        vb.memory = "512"
    Severity: Minor
    Found in Vagrantfile by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Line is too long. [98/80]
    Open

          # Should raw traffic be logged through the logger?  Disabled by default for security reasons
    Severity: Minor
    Found in lib/nio/websocket.rb by rubocop

    Line is too long. [121/80]
    Open

          # Create and return a websocket client that communicates either over the given IO object (upgrades the connection),
    Severity: Minor
    Found in lib/nio/websocket.rb by rubocop

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

    require "nio/websocket/adapter/proxy"
    Severity: Minor
    Found in lib/nio/websocket.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Line is too long. [124/80]
    Open

            @monitor = Reactor.selector.register(inner, :rw) # This can block if this is the main thread and the reactor is busy
    Severity: Minor
    Found in lib/nio/websocket/raw_adapter.rb by rubocop

    Line is too long. [115/80]
    Open

              rescue Errno::ECONNRESET, EOFError, Errno::ECONNABORTED, IOError # rubocop:disable Lint/ShadowedException
    Severity: Minor
    Found in lib/nio/websocket/raw_adapter.rb by rubocop

    Script file console doesn't have execute permission.
    Open

    #!/usr/bin/env ruby
    Severity: Minor
    Found in bin/console by rubocop

    Missing top-level class documentation comment.
    Open

        class Reactor
    Severity: Minor
    Found in lib/nio/websocket/reactor.rb by rubocop

    This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

    The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

    Example:

    # bad
    class Person
      # ...
    end
    
    # good
    # Description/Explanation of Person class
    class Person
      # ...
    end

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

    require "nio/websocket/adapter"
    Severity: Minor
    Found in lib/nio/websocket/adapter/client.rb by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Line is too long. [105/80]
    Open

          # @option options [Hash] :ssl_context Hash from which to create the OpenSSL::SSL::SSLContext object
    Severity: Minor
    Found in lib/nio/websocket.rb by rubocop

    Missing top-level class documentation comment.
    Open

    class ::WebSocket::Driver
    Severity: Minor
    Found in lib/nio/websocket/adapter.rb by rubocop

    This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

    The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

    Example:

    # bad
    class Person
      # ...
    end
    
    # good
    # Description/Explanation of Person class
    class Person
      # ...
    end

    Prefer single-quoted strings when you don't need string interpolation or special symbols.
    Open

      spec.add_dependency "nio4r", ">= 1.2.1", "< 3.0" # Allow older nio4r, if possible, so as to not lock our ruby version to 2.2.2
    Severity: Minor
    Found in nio4r-websocket.gemspec by rubocop

    Checks if uses of quotes match the configured preference.

    Example: EnforcedStyle: single_quotes (default)

    # bad
    "No special symbols"
    "No string interpolation"
    "Just text"
    
    # good
    'No special symbols'
    'No string interpolation'
    'Just text'
    "Wait! What's #{this}!"

    Example: EnforcedStyle: double_quotes

    # bad
    'Just some text'
    'No special chars or interpolation'
    
    # good
    "Just some text"
    "No special chars or interpolation"
    "Every string in #{project} uses double_quotes"

    Line is too long. [94/80]
    Open

          # Returns the current logger, or creates one at level ERROR if one has not been assigned
    Severity: Minor
    Found in lib/nio/websocket.rb by rubocop

    Line is too long. [105/80]
    Open

          # @option options [Hash] :ssl_context Hash from which to create the OpenSSL::SSL::SSLContext object
    Severity: Minor
    Found in lib/nio/websocket.rb by rubocop
    Severity
    Category
    Status
    Source
    Language