File tree Expand file tree Collapse file tree 5 files changed +22
-18
lines changed
Expand file tree Collapse file tree 5 files changed +22
-18
lines changed Original file line number Diff line number Diff line change 11# This configuration was generated by
22# `rubocop --auto-gen-config`
3- # on 2019-04-06 18:44:21 -0400 using RuboCop version 0.61.1.
3+ # on 2019-04-07 11:03:29 -0400 using RuboCop version 0.61.1.
44# The point is for the user to remove these configuration records
55# one by one as the offenses are removed from the code base.
66# Note that changes in the inspected code, or installation of new
77# versions of RuboCop, may require this file to be generated again.
88
9+ # Offense count: 2
10+ # Configuration parameters: AllowSafeAssignment.
11+ Lint/AssignmentInCondition :
12+ Exclude :
13+ - ' lib/slack/real_time/concurrency/async.rb'
14+ - ' lib/slack/real_time/socket.rb'
15+
916# Offense count: 4
1017Lint/HandleExceptions :
1118 Exclude :
@@ -45,10 +52,11 @@ Style/AccessModifierDeclarations:
4552Style/GlobalVars :
4653 Enabled : false
4754
48- # Offense count: 2
55+ # Offense count: 3
4956# Configuration parameters: MinBodyLength.
5057Style/GuardClause :
5158 Exclude :
59+ - ' lib/slack/real_time/socket.rb'
5260 - ' lib/slack/real_time/stores/store.rb'
5361 - ' lib/slack/web/faraday/response/raise_error.rb'
5462
Original file line number Diff line number Diff line change @@ -105,31 +105,29 @@ def run_loop
105105 end
106106
107107 # Ensure the server is running, and ping the remote server if no other messages were sent.
108- def keep_alive
108+ def keep_alive?
109109 # We can't ping the remote server if we aren't connected.
110- return false if @socket . nil? or !@socket . connected?
110+ return false if @socket . nil? || !@socket . connected?
111111
112112 time_since_last_message = @socket . time_since_last_message
113113
114114 # If the server responded within the specified time, we are okay:
115115 return true if time_since_last_message < websocket_ping
116116
117117 # If the server has not responded for a while:
118- if time_since_last_message > ( websocket_ping * 2 )
119- return false
120- end
118+ return false if time_since_last_message > ( websocket_ping * 2 )
121119
122120 # Kick off the next ping message:
123- self . ping
121+ ping
124122
125- return true
123+ true
126124 end
127125
128126 # Check if the remote server is responsive, and if not, restart the connection.
129127 def run_ping!
130- unless self . keep_alive
131- restart_async
132- end
128+ return if keep_alive?
129+
130+ restart_async
133131 end
134132
135133 def run_ping?
Original file line number Diff line number Diff line change @@ -41,9 +41,7 @@ def start_reactor(client)
4141 end
4242
4343 while @restart
44- if @client_task
45- @client_task . stop
46- end
44+ @client_task . stop if @client_task
4745
4846 @client_task = task . async do |subtask |
4947 subtask . annotate 'client run-loop'
@@ -57,7 +55,7 @@ def start_reactor(client)
5755 end
5856 end
5957
60- def restart_async ( client , new_url )
58+ def restart_async ( _client , new_url )
6159 @url = new_url
6260 @last_message_at = current_time
6361
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ def start
3636 logger . debug "connection.on :open, data=#{ data } "
3737 queue . push :opened
3838 end
39-
39+
4040 yield driver if block_given?
4141 end
4242 end
Original file line number Diff line number Diff line change 1616
1717RSpec . configure do |config |
1818 # Enable flags like --only-failures and --next-failure
19- config . example_status_persistence_file_path = " .rspec_status"
19+ config . example_status_persistence_file_path = ' .rspec_status'
2020end
You can’t perform that action at this time.
0 commit comments