bogdanRada/celluloid_pubsub

View on GitHub
lib/celluloid_pubsub/web_server.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Class WebServer has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class WebServer < Reel::Server::HTTP
    include CelluloidPubsub::BaseActor

    # The hostname on which the webserver runs on by default
    HOST = '0.0.0.0'
Severity: Minor
Found in lib/celluloid_pubsub/web_server.rb - About 2 hrs to fix

    Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
    Open

          if url == path || url == '/?'
            reactor.async.work(socket, Actor.current)
          else
            log_debug "Received invalid WebSocket request for: #{url}"
            socket.close
    Severity: Minor
    Found in lib/celluloid_pubsub/web_server.rb by rubocop

    This cop checks against comparing a variable with multiple items, where Array#include? could be used instead to avoid code repetition.

    Example:

    # bad
    a = 'a'
    foo if a == 'a' || a == 'b' || a == 'c'
    
    # good
    a = 'a'
    foo if ['a', 'b', 'c'].include?(a)

    Add an empty line after magic comments.
    Open

    require_relative './reactor'
    Severity: Minor
    Found in lib/celluloid_pubsub/web_server.rb by rubocop

    Checks for a newline after the final magic comment.

    Example:

    # good
    # frozen_string_literal: true
    
    # Some documentation for Person
    class Person
      # Some code
    end
    
    # bad
    # frozen_string_literal: true
    # Some documentation for Person
    class Person
      # Some code
    end

    There are no issues that match your filters.

    Category
    Status