lib/celluloid_pubsub/web_server.rb
Class WebServer
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class WebServer < Reel::Server::HTTP
include CelluloidPubsub::BaseActor
# The hostname on which the webserver runs on by default
HOST = '0.0.0.0'
Avoid comparing a variable with multiple items in a conditional, use Array#include?
instead. Open
Open
if url == path || url == '/?'
reactor.async.work(socket, Actor.current)
else
log_debug "Received invalid WebSocket request for: #{url}"
socket.close
- Read upRead up
- Exclude checks
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
Open
require_relative './reactor'
- Read upRead up
- Exclude checks
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