Skip to content

Commit f9f2f02

Browse files
committed
Upgraded to Rubocop 0.73.0.
1 parent 0f12c33 commit f9f2f02

File tree

11 files changed

+26
-7
lines changed

11 files changed

+26
-7
lines changed

.rubocop_todo.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2019-03-23 14:16:02 -0400 using RuboCop version 0.58.2.
3+
# on 2019-07-29 10:07:11 -0400 using RuboCop version 0.73.0.
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
@@ -9,13 +9,21 @@
99
# Offense count: 3
1010
# Cop supports --auto-correct.
1111
# Configuration parameters: EnforcedStyle.
12-
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
12+
# SupportedStyles: squiggly, active_support, powerpack, unindent
1313
Layout/IndentHeredoc:
1414
Exclude:
1515
- 'lib/slack-ruby-bot-server/info.rb'
1616
- 'sample_apps/sample_app_activerecord/commands/help.rb'
1717
- 'sample_apps/sample_app_mongoid/commands/help.rb'
1818

19+
# Offense count: 2
20+
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
21+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
22+
Naming/FileName:
23+
Exclude:
24+
- 'lib/slack-ruby-bot-server.rb'
25+
- 'lib/slack-ruby-bot-server/ext/slack-ruby-bot.rb'
26+
1927
# Offense count: 3
2028
# Configuration parameters: Blacklist.
2129
# Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
@@ -27,7 +35,7 @@ Naming/HeredocDelimiterNaming:
2735

2836
# Offense count: 1
2937
# Cop supports --auto-correct.
30-
# Configuration parameters: EnforcedStyle.
38+
# Configuration parameters: EnforcedStyle, Autocorrect.
3139
# SupportedStyles: module_function, extend_self
3240
Style/ModuleFunction:
3341
Exclude:

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ when 'activerecord' then
1111
gem 'otr-activerecord', '~> 1.2.1'
1212
gem 'cursor_pagination' # rubocop:disable Bundler/OrderedGems
1313
gem 'pg'
14-
when nil then
14+
when nil
1515
warn "Missing ENV['DATABASE_ADAPTER']."
1616
else
1717
warn "Invalid ENV['DATABASE_ADAPTER']: #{ENV['DATABASE_ADAPTER']}."
@@ -31,7 +31,7 @@ group :development, :test do
3131
gem 'rack-test'
3232
gem 'rake'
3333
gem 'rspec'
34-
gem 'rubocop', '0.58.2'
34+
gem 'rubocop', '0.73.0'
3535
gem 'selenium-webdriver', '~> 3.4.4'
3636
gem 'vcr'
3737
gem 'webmock'

lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class TeamsEndpoint < Grape::API
6060
bot_user_id: bot_user_id
6161
)
6262
raise "Team #{team.name} is already registered." if team.active?
63+
6364
team.activate!(token)
6465
else
6566
team = Team.create!(

lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module CursorHelpers
1111
if SlackRubyBotServer::Config.mongoid?
1212
def paginate_by_cursor(coll, _options)
1313
raise 'Both cursor and offset parameters are present, these are mutually exclusive.' if params.key?(:offset) && params.key?(:cursor)
14+
1415
results = { results: [], next: nil }
1516
coll = coll.skip(params[:offset].to_i) if params.key?(:offset)
1617
size = (params[:size] || 10).to_i
@@ -26,6 +27,7 @@ def paginate_by_cursor(coll, _options)
2627
elsif SlackRubyBotServer::Config.activerecord?
2728
def paginate_by_cursor(coll, options)
2829
raise 'Both cursor and offset parameters are present, these are mutually exclusive.' if params.key?(:offset) && params.key?(:cursor)
30+
2931
results = { results: [], next: nil }
3032
size = (params[:size] || 10).to_i
3133
results[:total_count] = coll.count(:all) if params[:total_count]

lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module SortHelpers
77
def sort_order(options = {})
88
params[:sort] = options[:default_sort_order] unless params[:sort]
99
return [] unless params[:sort]
10+
1011
sort_order = params[:sort].to_s
1112
unless options[:default_sort_order] == sort_order
1213
supported_sort_orders = route_sort

lib/slack-ruby-bot-server/api/presenters/status_presenter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def ping
2323
raise 'Unsupported database driver.'
2424
end
2525
return unless team
26+
2627
team.ping!
2728
end
2829

lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ module SlackRubyBotServer
66
module DatabaseAdapter
77
def self.check!
88
rc = Mongoid.default_client.command(ping: 1)
9-
return if rc && rc.ok?
9+
return if rc&.ok?
10+
1011
raise rc.documents.first['error'] || 'Unexpected error.'
1112
rescue StandardError => e
1213
warn "Error connecting to MongoDB: #{e.message}"

lib/slack-ruby-bot-server/server.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def initialize(attrs = {})
88
attrs = attrs.dup
99
@team = attrs.delete(:team)
1010
raise 'Missing team' unless @team
11+
1112
attrs[:token] = @team.token
1213
super(attrs)
1314
open!

lib/slack-ruby-bot-server/service.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def restart!(team, server, wait = 1)
4949
def stop!(team)
5050
logger.info "Stopping team #{team}."
5151
run_callbacks :stopping, team
52-
team.server.stop! if team.server
52+
team.server&.stop!
5353
run_callbacks :stopped, team
5454
rescue StandardError => e
5555
run_callbacks :error, team, e
@@ -106,6 +106,7 @@ def start_server!(team, server, wait = 1)
106106
def run_callbacks(type, team = nil, error = nil, options = {})
107107
callbacks = @callbacks[type.to_s]
108108
return false unless callbacks
109+
109110
callbacks.each do |c|
110111
c.call team, error, options
111112
end

spec/api/endpoints/root_endpoint_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
links.each_pair do |_key, h|
1717
href = h['href']
1818
next if href.include?('{') # templated link
19+
1920
get href.gsub('http://example.org', '')
2021
expect(last_response.status).to eq 200
2122
expect(JSON.parse(last_response.body)).to_not eq({})

0 commit comments

Comments
 (0)