Skip to content

Commit 5560369

Browse files
Upgrade rubocop to v1.47 (#165)
* chore: upgrade rubocop to the latest(1.47.0) * chore: set target ruby version for rubocop chore(ci): correct lint workflow name, use checkout v3 docs: add changelog entry * fix: rubocop complaints * Added support for Ruby 3.2.x. * fix: lock rubocop target ruby version to 2.6 --------- Co-authored-by: Daniel (dB.) Doubrovkine <[email protected]>
1 parent e56f02d commit 5560369

File tree

6 files changed

+134
-23
lines changed

6 files changed

+134
-23
lines changed

.github/workflows/rubocop.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
2-
name: test
2+
name: lint
33
on: [push, pull_request]
44
jobs:
55
lint:
66
name: RuboCop
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
9+
- uses: actions/checkout@v3
1010
- name: Set up Ruby
1111
uses: ruby/setup-ruby@v1
1212
with:
13-
ruby-version: 2.7
13+
ruby-version: '3.1'
1414
bundler-cache: true
1515
- name: Run RuboCop
1616
run: bundle exec rubocop

.rubocop.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
AllCops:
2+
SuggestExtensions: false
3+
TargetRubyVersion: 2.6
4+
15
Metrics:
26
Enabled: false
37

@@ -12,4 +16,3 @@ Style/FrozenStringLiteralComment:
1216
Enabled: false
1317

1418
inherit_from: .rubocop_todo.yml
15-

.rubocop_todo.yml

Lines changed: 121 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,173 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2020-11-16 09:56:54 -0500 using RuboCop version 0.81.0.
3+
# on 2023-03-02 20:56:34 UTC using RuboCop version 1.47.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
77
# versions of RuboCop, may require this file to be generated again.
88

99
# Offense count: 1
10-
# Cop supports --auto-correct.
11-
# Configuration parameters: EnforcedStyle.
12-
# SupportedStyles: squiggly, active_support, powerpack, unindent
10+
# Configuration parameters: Severity, Include.
11+
# Include: **/*.gemspec
12+
Gemspec/RequiredRubyVersion:
13+
Exclude:
14+
- 'slack-ruby-bot-server.gemspec'
15+
16+
# Offense count: 1
17+
# This cop supports safe autocorrection (--autocorrect).
1318
Layout/HeredocIndentation:
1419
Exclude:
1520
- 'lib/slack-ruby-bot-server/info.rb'
1621

1722
# Offense count: 1
23+
# This cop supports safe autocorrection (--autocorrect).
24+
Layout/RescueEnsureAlignment:
25+
Exclude:
26+
- 'lib/slack-ruby-bot-server/models/team/methods.rb'
27+
28+
# Offense count: 1
29+
# This cop supports safe autocorrection (--autocorrect).
1830
Lint/AmbiguousOperator:
1931
Exclude:
2032
- 'spec/slack-ruby-bot-server/service_spec.rb'
2133

22-
# Offense count: 2
23-
# Cop supports --auto-correct.
24-
Lint/NonDeterministicRequireOrder:
34+
# Offense count: 1
35+
# Configuration parameters: AllowedMethods.
36+
# AllowedMethods: enums
37+
Lint/ConstantDefinitionInBlock:
2538
Exclude:
26-
- 'spec/spec_helper.rb'
39+
- 'lib/slack-ruby-bot-server/models/team/methods.rb'
2740

2841
# Offense count: 1
29-
# Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
42+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
43+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
3044
# 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
3145
Naming/FileName:
3246
Exclude:
3347
- 'lib/slack-ruby-bot-server.rb'
3448

3549
# Offense count: 1
3650
# Configuration parameters: ForbiddenDelimiters.
37-
# ForbiddenDelimiters: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
51+
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
3852
Naming/HeredocDelimiterNaming:
3953
Exclude:
4054
- 'lib/slack-ruby-bot-server/info.rb'
4155

4256
# Offense count: 3
4357
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
44-
# AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
58+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
4559
Naming/MethodParameterName:
4660
Exclude:
4761
- 'lib/slack-ruby-bot-server/models/team/activerecord.rb'
4862
- 'lib/slack-ruby-bot-server/models/team/mongoid.rb'
4963
- 'lib/slack-ruby-bot-server/service.rb'
5064

65+
# Offense count: 5
66+
# This cop supports safe autocorrection (--autocorrect).
67+
# Configuration parameters: EnforcedStyle.
68+
# SupportedStyles: separated, grouped
69+
Style/AccessorGrouping:
70+
Exclude:
71+
- 'lib/slack-ruby-bot-server/config.rb'
72+
73+
# Offense count: 3
74+
# This cop supports unsafe autocorrection (--autocorrect-all).
75+
Style/GlobalStdStream:
76+
Exclude:
77+
- 'spec/database_adapters/activerecord/activerecord.rb'
78+
- 'tasks/db.rake'
79+
80+
# Offense count: 18
81+
# This cop supports safe autocorrection (--autocorrect).
82+
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
83+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
84+
# SupportedShorthandSyntax: always, never, either, consistent
85+
Style/HashSyntax:
86+
Exclude:
87+
- 'lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb'
88+
- 'lib/slack-ruby-bot-server/models/team/methods.rb'
89+
90+
# Offense count: 1
91+
# This cop supports unsafe autocorrection (--autocorrect-all).
92+
Style/HashTransformKeys:
93+
Exclude:
94+
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
95+
96+
# Offense count: 1
97+
# This cop supports unsafe autocorrection (--autocorrect-all).
98+
Style/HashTransformValues:
99+
Exclude:
100+
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'
101+
51102
# Offense count: 1
52-
# Cop supports --auto-correct.
103+
# This cop supports unsafe autocorrection (--autocorrect-all).
53104
# Configuration parameters: EnforcedStyle, Autocorrect.
54105
# SupportedStyles: module_function, extend_self, forbidden
55106
Style/ModuleFunction:
56107
Exclude:
57108
- 'lib/slack-ruby-bot-server/config.rb'
58109

110+
# Offense count: 2
111+
# This cop supports safe autocorrection (--autocorrect).
112+
Style/MultilineWhenThen:
113+
Exclude:
114+
- 'Gemfile'
115+
59116
# Offense count: 1
60-
# Cop supports --auto-correct.
61-
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
117+
# This cop supports unsafe autocorrection (--autocorrect-all).
118+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
62119
# SupportedStyles: predicate, comparison
63120
Style/NumericPredicate:
64121
Exclude:
65122
- 'spec/**/*'
66123
- 'lib/slack-ruby-bot-server/service.rb'
124+
125+
# Offense count: 1
126+
# This cop supports safe autocorrection (--autocorrect).
127+
Style/RedundantAssignment:
128+
Exclude:
129+
- 'lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb'
130+
131+
# Offense count: 3
132+
# This cop supports safe autocorrection (--autocorrect).
133+
Style/RedundantBegin:
134+
Exclude:
135+
- 'lib/slack-ruby-bot-server/models/team/activerecord.rb'
136+
- 'lib/slack-ruby-bot-server/models/team/mongoid.rb'
137+
- 'lib/slack-ruby-bot-server/service.rb'
138+
139+
# Offense count: 2
140+
# This cop supports safe autocorrection (--autocorrect).
141+
Style/RedundantFileExtensionInRequire:
142+
Exclude:
143+
- 'lib/slack-ruby-bot-server/config/database_adapters/activerecord.rb'
144+
- 'lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb'
145+
146+
# Offense count: 6
147+
# This cop supports safe autocorrection (--autocorrect).
148+
Style/RedundantRegexpEscape:
149+
Exclude:
150+
- 'Rakefile'
151+
- 'lib/slack-ruby-bot-server/api/middleware.rb'
152+
- 'spec/support/api/endpoints/it_behaves_like_a_cursor_api.rb'
153+
154+
# Offense count: 1
155+
# This cop supports unsafe autocorrection (--autocorrect-all).
156+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
157+
# AllowedMethods: present?, blank?, presence, try, try!
158+
Style/SafeNavigation:
159+
Exclude:
160+
- 'lib/slack-ruby-bot-server/api/endpoints/teams_endpoint.rb'
161+
162+
# Offense count: 1
163+
# This cop supports unsafe autocorrection (--autocorrect-all).
164+
Style/SlicingWithRange:
165+
Exclude:
166+
- 'lib/slack-ruby-bot-server/api/helpers/sort_helpers.rb'
167+
168+
# Offense count: 1
169+
# This cop supports unsafe autocorrection (--autocorrect-all).
170+
# Configuration parameters: Mode.
171+
Style/StringConcatenation:
172+
Exclude:
173+
- 'lib/slack-ruby-bot-server/api/helpers/error_helpers.rb'

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
### 2.1.0 (Next)
44

55
* [#163](https://github.com/slack-ruby/slack-ruby-bot-server/pull/163): Updated releasing documentation - [@crazyoptimist](https://github.com/crazyoptimist).
6-
* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Added support for Rails 6.1 and 7.0 - [@maths22](https://github.com/maths22).
7-
* [#168](https://github.com/slack-ruby/slack-ruby-bot-server/pull/168): Added support for Ruby 3.2.1 - [@dblock](https://github.com/dblock).
6+
* [#164](https://github.com/slack-ruby/slack-ruby-bot-server/pull/164): Added support for ActiveRecord 6.1 and 7.0 - [@maths22](https://github.com/maths22).
7+
* [#165](https://github.com/slack-ruby/slack-ruby-bot-server/pull/165): Upgraded Rubocop to v1.47 - [@crazyoptimist](https://github.com/crazyoptimist).
88
* [#167](https://github.com/slack-ruby/slack-ruby-bot-server/pull/167): Added `once_and_every` timer - [@dblock](https://github.com/dblock).
9+
* [#168](https://github.com/slack-ruby/slack-ruby-bot-server/pull/168): Added support for Ruby 3.2.1 - [@dblock](https://github.com/dblock).
910
* Your contribution here.
1011

1112
#### 2.0.1 (2023/02/20)

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ group :development, :test do
3333
gem 'rack-test'
3434
gem 'rake'
3535
gem 'rspec'
36-
gem 'rubocop', '0.81.0'
36+
gem 'rubocop', '1.47'
3737
gem 'selenium-webdriver', '~> 4.1.0'
3838
gem 'vcr'
3939
gem 'webmock'

spec/spec_helper.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
require 'rack/test'
99
require 'slack-ruby-bot-server/rspec'
1010

11-
Dir[File.join(__dir__, 'support', '**/*.rb')].each do |file|
11+
Dir[File.join(__dir__, 'support', '**/*.rb')].sort.each do |file|
1212
require file
1313
end
1414

1515
SlackRubyBotServer::Service.logger.level = Logger::WARN
1616

17-
Dir[File.join(__dir__, 'database_adapters', SlackRubyBotServer::Config.database_adapter.to_s, '**/*.rb')].each do |file|
17+
Dir[File.join(__dir__, 'database_adapters', SlackRubyBotServer::Config.database_adapter.to_s, '**/*.rb')].sort.each do |file|
1818
require file
1919
end

0 commit comments

Comments
 (0)