Skip to content

Commit 5155d7c

Browse files
committed
Rubocop auto-correct and comprehensive todo
1 parent 5a3a0cf commit 5155d7c

File tree

114 files changed

+629
-188
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+629
-188
lines changed

.rubocop.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1+
inherit_from: .rubocop_todo.yml
2+
3+
require:
4+
- rubocop-performance
5+
- rubocop-rspec
6+
17
AllCops:
8+
DisplayCopNames: true
29
Exclude:
10+
- bin/**/*
311
- vendor/**/*
412
- lib/slack/web/api/slack-api-ref/**/*
5-
6-
Metrics:
13+
- lib/slack/web/api/endpoints/* # Auto-generated
14+
- spec/slack/web/api/endpoints/* # Auto-generated
15+
Layout/EmptyLineAfterMagicComment:
716
Enabled: false
8-
17+
Metrics/BlockLength:
18+
Max: 150
19+
Metrics/ClassLength:
20+
Max: 250
921
Metrics/LineLength:
10-
Max: 512
11-
22+
Max: 100
1223
Style/Documentation:
1324
Enabled: false
14-
15-
Naming/MethodName:
16-
Enabled: false
17-
18-
Style/ModuleFunction:
19-
Enabled: false
20-
21-
inherit_from: .rubocop_todo.yml

.rubocop_todo.yml

Lines changed: 196 additions & 13 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-07-21 18:39:19 -0400 using RuboCop version 0.61.1.
3+
# on 2019-07-31 17:11:45 -0700 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
@@ -14,22 +14,50 @@ Lint/AssignmentInCondition:
1414
- 'lib/slack/real_time/socket.rb'
1515

1616
# Offense count: 5
17+
# Configuration parameters: AllowComments.
1718
Lint/HandleExceptions:
1819
Exclude:
1920
- 'lib/slack-ruby-client.rb'
2021
- 'lib/slack/real_time/concurrency/async.rb'
2122
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
2223
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
2324

25+
# Offense count: 9
26+
Metrics/AbcSize:
27+
Max: 39
28+
2429
# Offense count: 4
30+
# Configuration parameters: CountComments, ExcludedMethods.
31+
# ExcludedMethods: refine
32+
Metrics/BlockLength:
33+
Max: 504
34+
35+
# Offense count: 1
36+
Metrics/CyclomaticComplexity:
37+
Max: 9
38+
39+
# Offense count: 97
40+
# Cop supports --auto-correct.
41+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
42+
# URISchemes: http, https
43+
Metrics/LineLength:
44+
Max: 256
45+
46+
# Offense count: 11
47+
# Configuration parameters: CountComments, ExcludedMethods.
48+
Metrics/MethodLength:
49+
Max: 32
50+
51+
# Offense count: 1
52+
Metrics/PerceivedComplexity:
53+
Max: 9
54+
55+
# Offense count: 1
2556
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
2657
# 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
2758
Naming/FileName:
2859
Exclude:
29-
- 'bin/commands/chat_scheduledMessages.rb'
3060
- 'lib/slack-ruby-client.rb'
31-
- 'lib/slack/web/api/endpoints/chat_scheduledMessages.rb'
32-
- 'spec/slack/web/api/endpoints/chat_scheduledMessages_spec.rb'
3361

3462
# Offense count: 1
3563
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
@@ -38,6 +66,140 @@ Naming/MemoizedInstanceVariableName:
3866
Exclude:
3967
- 'lib/slack/logger.rb'
4068

69+
# Offense count: 1
70+
RSpec/AnyInstance:
71+
Exclude:
72+
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
73+
74+
# Offense count: 69
75+
# Configuration parameters: Prefixes.
76+
# Prefixes: when, with, without
77+
RSpec/ContextWording:
78+
Enabled: false
79+
80+
# Offense count: 1
81+
RSpec/DescribeClass:
82+
Exclude:
83+
- 'spec/integration/integration_spec.rb'
84+
85+
# Offense count: 5
86+
# Cop supports --auto-correct.
87+
RSpec/EmptyLineAfterExampleGroup:
88+
Exclude:
89+
- 'spec/slack/web/api/endpoints/custom_specs/auth_spec.rb'
90+
- 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
91+
92+
# Offense count: 8
93+
# Cop supports --auto-correct.
94+
RSpec/EmptyLineAfterFinalLet:
95+
Exclude:
96+
- 'spec/slack/web/api/endpoints/custom_specs/auth_spec.rb'
97+
- 'spec/slack/web/api/endpoints/custom_specs/channels_spec.rb'
98+
- 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
99+
- 'spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb'
100+
- 'spec/slack/web/api/endpoints/custom_specs/groups_spec.rb'
101+
- 'spec/slack/web/api/endpoints/custom_specs/users_spec.rb'
102+
103+
# Offense count: 55
104+
# Configuration parameters: Max.
105+
RSpec/ExampleLength:
106+
Enabled: false
107+
108+
# Offense count: 2
109+
RSpec/ExpectInHook:
110+
Exclude:
111+
- 'spec/slack/real_time/client_spec.rb'
112+
113+
# Offense count: 16
114+
# Configuration parameters: CustomTransform, IgnoreMethods.
115+
RSpec/FilePath:
116+
Enabled: false
117+
118+
# Offense count: 1
119+
# Cop supports --auto-correct.
120+
# Configuration parameters: EnforcedStyle.
121+
# SupportedStyles: implicit, each, example
122+
RSpec/HookArgument:
123+
Exclude:
124+
- 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
125+
126+
# Offense count: 13
127+
# Configuration parameters: AssignmentOnly.
128+
RSpec/InstanceVariable:
129+
Exclude:
130+
- 'spec/integration/integration_spec.rb'
131+
- 'spec/slack/real_time/client_spec.rb'
132+
- 'spec/slack/slack_spec.rb'
133+
134+
# Offense count: 68
135+
# Configuration parameters: .
136+
# SupportedStyles: have_received, receive
137+
RSpec/MessageSpies:
138+
EnforcedStyle: receive
139+
140+
# Offense count: 92
141+
# Configuration parameters: AggregateFailuresByDefault.
142+
RSpec/MultipleExpectations:
143+
Max: 5
144+
145+
# Offense count: 53
146+
# Configuration parameters: IgnoreSharedExamples.
147+
RSpec/NamedSubject:
148+
Exclude:
149+
- 'spec/slack/events/request_spec.rb'
150+
- 'spec/slack/messages/formatting_spec.rb'
151+
- 'spec/slack/web/api/mixins/channels_spec.rb'
152+
- 'spec/slack/web/api/mixins/groups_spec.rb'
153+
- 'spec/slack/web/api/mixins/users_spec.rb'
154+
- 'spec/slack/web/faraday/response/raise_error_spec.rb'
155+
156+
# Offense count: 32
157+
RSpec/NestedGroups:
158+
Max: 6
159+
160+
# Offense count: 15
161+
# Cop supports --auto-correct.
162+
# Configuration parameters: EnforcedStyle.
163+
# SupportedStyles: not_to, to_not
164+
RSpec/NotToNot:
165+
Exclude:
166+
- 'spec/slack/web/api/endpoints/custom_specs/auth_spec.rb'
167+
- 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
168+
- 'spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb'
169+
170+
# Offense count: 2
171+
RSpec/RepeatedDescription:
172+
Exclude:
173+
- 'spec/slack/web/api/endpoints/custom_specs/users_spec.rb'
174+
175+
# Offense count: 2
176+
RSpec/ScatteredLet:
177+
Exclude:
178+
- 'spec/integration/integration_spec.rb'
179+
180+
# Offense count: 4
181+
RSpec/ScatteredSetup:
182+
Exclude:
183+
- 'spec/integration/integration_spec.rb'
184+
185+
# Offense count: 3
186+
RSpec/SubjectStub:
187+
Exclude:
188+
- 'spec/slack/web/api/mixins/channels_spec.rb'
189+
- 'spec/slack/web/api/mixins/groups_spec.rb'
190+
- 'spec/slack/web/api/mixins/users_spec.rb'
191+
192+
# Offense count: 16
193+
# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
194+
RSpec/VerifiedDoubles:
195+
Exclude:
196+
- 'spec/slack/events/request_spec.rb'
197+
- 'spec/slack/real_time/client_spec.rb'
198+
- 'spec/slack/real_time/concurrency/celluloid_spec.rb'
199+
- 'spec/slack/real_time/concurrency/eventmachine_spec.rb'
200+
- 'spec/slack/web/faraday/response/raise_error_spec.rb'
201+
- 'spec/support/real_time/connected_client.rb'
202+
41203
# Offense count: 1
42204
Security/Open:
43205
Exclude:
@@ -51,25 +213,46 @@ Style/AccessModifierDeclarations:
51213
- 'lib/slack/real_time/concurrency/eventmachine.rb'
52214
- 'lib/slack/real_time/socket.rb'
53215

54-
# Offense count: 155
55-
# Configuration parameters: AllowedVariables.
56-
Style/GlobalVars:
57-
Enabled: false
216+
# Offense count: 6
217+
# Cop supports --auto-correct.
218+
# Configuration parameters: EnforcedStyle.
219+
# SupportedStyles: always, never
220+
Style/FrozenStringLiteralComment:
221+
Exclude:
222+
- 'spec/slack/web/api/endpoints/custom_specs/auth_spec.rb'
223+
- 'spec/slack/web/api/endpoints/custom_specs/channels_spec.rb'
224+
- 'spec/slack/web/api/endpoints/custom_specs/chat_spec.rb'
225+
- 'spec/slack/web/api/endpoints/custom_specs/dialog_spec.rb'
226+
- 'spec/slack/web/api/endpoints/custom_specs/groups_spec.rb'
227+
- 'spec/slack/web/api/endpoints/custom_specs/users_spec.rb'
58228

59-
# Offense count: 3
229+
# Offense count: 2
60230
# Configuration parameters: MinBodyLength.
61231
Style/GuardClause:
62232
Exclude:
63233
- 'lib/slack/real_time/socket.rb'
64-
- 'lib/slack/real_time/stores/store.rb'
65234
- 'lib/slack/web/faraday/response/raise_error.rb'
66235

67-
# Offense count: 1
68-
Style/MixinUsage:
236+
# Offense count: 3
237+
# Cop supports --auto-correct.
238+
# Configuration parameters: EnforcedStyle, Autocorrect.
239+
# SupportedStyles: module_function, extend_self
240+
Style/ModuleFunction:
69241
Exclude:
70-
- 'bin/slack'
242+
- 'lib/slack/config.rb'
243+
- 'lib/slack/events/config.rb'
244+
- 'lib/slack/web/config.rb'
71245

72246
# Offense count: 1
73247
Style/MultilineTernaryOperator:
74248
Exclude:
75249
- 'spec/support/real_time/connected_client.rb'
250+
251+
# Offense count: 1
252+
# Cop supports --auto-correct.
253+
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
254+
# SupportedStyles: predicate, comparison
255+
Style/NumericPredicate:
256+
Exclude:
257+
- 'spec/**/*'
258+
- 'lib/slack/real_time/client.rb'

Dangerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
# frozen_string_literal: true
12
danger.import_dangerfile(gem: 'slack-ruby-danger')
23
toc.check

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
source 'http://rubygems.org'
23

34
gemspec

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require 'rubygems'
23
require 'bundler'
34
require 'bundler/gem_tasks'

bin/slack

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env ruby
2-
32
require 'gli'
43
require 'slack-ruby-client'
54

examples/hi_real_time/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
source 'http://rubygems.org'
23

34
gem 'slack-ruby-client', path: '../..'

examples/hi_real_time/hi.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require 'slack-ruby-client'
23

34
Slack.configure do |config|
@@ -19,9 +20,9 @@
1920
client.typing channel: data.channel
2021

2122
case data.text
22-
when 'bot hi' then
23+
when 'bot hi'
2324
client.message channel: data.channel, text: "Hi <@#{data.user}>!"
24-
when /^bot/ then
25+
when /^bot/
2526
client.message channel: data.channel, text: "Sorry <@#{data.user}>, what?"
2627
end
2728
end

examples/hi_real_time_and_web/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
source 'http://rubygems.org'
23

34
gem 'slack-ruby-client', path: '../..'

examples/hi_real_time_and_web/hi.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require 'slack-ruby-client'
23

34
Slack.configure do |config|
@@ -14,9 +15,9 @@
1415
client.on :message do |data|
1516
puts data
1617
case data.text
17-
when 'bot hi' then
18+
when 'bot hi'
1819
client.web_client.chat_postMessage channel: data.channel, text: "Hi <@#{data.user}>!"
19-
when /^bot/ then
20+
when /^bot/
2021
client.web_client.chat_postMessage channel: data.channel, text: "Sorry <@#{data.user}>, what?"
2122
end
2223
end

0 commit comments

Comments
 (0)