Skip to content

Commit 5e8cd2a

Browse files
ericproulxdblock
andauthored
Update rubocop to 1.41.0 (#2288)
* Update rubocop to 1.40.0 * Update rubocop_todo * Rotate Danger token. * Preparing for release, 1.7.0. * Preparing for next development iteration, 1.7.1. * rubocop 1.41.0 * Drop support to ruby 2.5 Update actions/checkout to v3 * Add drop support in CHANGELOG.md * Rerun rubocop --auto-gen-config * Split CHANGELOG lines. * Attempt to trigger on all pull_request. * Increase fetch depth. Co-authored-by: Daniel (dB.) Doubrovkine <dblock@dblock.org>
1 parent 095c6e8 commit 5e8cd2a

19 files changed

+153
-57
lines changed

.github/workflows/danger.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
---
22
name: danger
3-
on:
4-
pull_request:
5-
types: [opened, reopened, edited, synchronize]
3+
4+
on: pull_request
5+
66
jobs:
77
danger:
88
runs-on: ubuntu-20.04
99
steps:
10-
- uses: actions/checkout@v1
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 100
1113
- name: Set up Ruby
1214
uses: ruby/setup-ruby@v1
1315
with:

.github/workflows/edge.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
2424

2525
steps:
26-
- uses: actions/checkout@v2
26+
- uses: actions/checkout@v3
2727

2828
- name: Set up Ruby
2929
uses: ruby/setup-ruby@v1

.github/workflows/test.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
name: RuboCop
1313
runs-on: ubuntu-20.04
1414
steps:
15-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1616
- name: Set up Ruby
1717
uses: ruby/setup-ruby@v1
1818
with:
@@ -25,7 +25,6 @@ jobs:
2525
fail-fast: false
2626
matrix:
2727
ruby:
28-
- 2.5
2928
- 2.6
3029
- 2.7
3130
- "3.0"
@@ -61,7 +60,7 @@ jobs:
6160
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
6261

6362
steps:
64-
- uses: actions/checkout@v2
63+
- uses: actions/checkout@v3
6564

6665
- name: Set up Ruby
6766
uses: ruby/setup-ruby@v1

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AllCops:
22
NewCops: enable
3-
TargetRubyVersion: 2.5
3+
TargetRubyVersion: 2.6
44
SuggestExtensions: false
55
Exclude:
66
- vendor/**/*

.rubocop_todo.yml

+128-35
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2022-01-02 10:41:35 UTC using RuboCop version 1.23.0.
3+
# on 2022-12-21 16:30:41 UTC using RuboCop version 1.41.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: Include.
10+
# This cop supports safe autocorrection (--autocorrect).
11+
# Configuration parameters: Severity, Include.
12+
# Include: **/*.gemspec
13+
Gemspec/DeprecatedAttributeAssignment:
14+
Exclude:
15+
- 'grape.gemspec'
16+
17+
# Offense count: 1
18+
# This cop supports safe autocorrection (--autocorrect).
19+
# Configuration parameters: Severity, Include.
1220
# Include: **/*.gemspec
1321
Gemspec/RequireMFA:
1422
Exclude:
1523
- 'grape.gemspec'
1624

1725
# Offense count: 1
18-
# Configuration parameters: IgnoredMethods.
26+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
1927
Lint/AmbiguousBlockAssociation:
2028
Exclude:
2129
- 'spec/grape/dsl/routing_spec.rb'
@@ -47,40 +55,39 @@ Lint/EmptyClass:
4755
- 'spec/grape/entity_spec.rb'
4856
- 'spec/grape/middleware/stack_spec.rb'
4957

50-
# Offense count: 7
58+
# Offense count: 6
5159
Lint/MissingSuper:
5260
Exclude:
5361
- 'lib/grape/api/instance.rb'
54-
- 'lib/grape/exceptions/base.rb'
5562
- 'lib/grape/exceptions/validation_array_errors.rb'
5663
- 'lib/grape/namespace.rb'
5764
- 'lib/grape/path.rb'
5865
- 'lib/grape/router/pattern.rb'
5966
- 'lib/grape/validations/validators/base.rb'
6067

61-
# Offense count: 43
62-
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
68+
# Offense count: 41
69+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
6370
Metrics/AbcSize:
6471
Max: 43
6572

66-
# Offense count: 6
67-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
68-
# IgnoredMethods: refine
73+
# Offense count: 1
74+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods, inherit_mode.
75+
# AllowedMethods: refine
6976
Metrics/BlockLength:
70-
Max: 182
77+
Max: 27
7178

7279
# Offense count: 9
7380
# Configuration parameters: CountComments, CountAsOne.
7481
Metrics/ClassLength:
75-
Max: 298
82+
Max: 295
7683

77-
# Offense count: 30
78-
# Configuration parameters: IgnoredMethods.
84+
# Offense count: 28
85+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
7986
Metrics/CyclomaticComplexity:
8087
Max: 15
8188

8289
# Offense count: 68
83-
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
90+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
8491
Metrics/MethodLength:
8592
Max: 32
8693

@@ -94,8 +101,8 @@ Metrics/ModuleLength:
94101
Metrics/ParameterLists:
95102
MaxOptionalParameters: 4
96103

97-
# Offense count: 27
98-
# Configuration parameters: IgnoredMethods.
104+
# Offense count: 25
105+
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
99106
Metrics/PerceivedComplexity:
100107
Max: 15
101108

@@ -111,7 +118,7 @@ Naming/MemoizedInstanceVariableName:
111118

112119
# Offense count: 5
113120
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
114-
# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
121+
# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
115122
Naming/MethodParameterName:
116123
Exclude:
117124
- 'lib/grape/endpoint.rb'
@@ -120,7 +127,7 @@ Naming/MethodParameterName:
120127
- 'spec/grape/api_spec.rb'
121128

122129
# Offense count: 18
123-
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers.
130+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
124131
# SupportedStyles: snake_case, normalcase, non_integer
125132
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339
126133
Naming/VariableNumber:
@@ -147,8 +154,18 @@ RSpec/AnyInstance:
147154
- 'spec/grape/api_spec.rb'
148155
- 'spec/grape/middleware/base_spec.rb'
149156

150-
# Offense count: 332
151-
# Configuration parameters: Prefixes.
157+
# Offense count: 5
158+
# This cop supports safe autocorrection (--autocorrect).
159+
# Configuration parameters: EnforcedStyle.
160+
# SupportedStyles: be_a, be_kind_of
161+
RSpec/ClassCheck:
162+
Exclude:
163+
- 'spec/grape/api_spec.rb'
164+
- 'spec/grape/endpoint_spec.rb'
165+
- 'spec/grape/middleware/base_spec.rb'
166+
167+
# Offense count: 345
168+
# Configuration parameters: Prefixes, AllowedPatterns.
152169
# Prefixes: when, with, without
153170
RSpec/ContextWording:
154171
Enabled: false
@@ -167,19 +184,29 @@ RSpec/DescribeClass:
167184
- 'spec/grape/validations/instance_behaivour_spec.rb'
168185

169186
# Offense count: 3
187+
# This cop supports unsafe autocorrection (--autocorrect-all).
170188
RSpec/EmptyExampleGroup:
171189
Exclude:
172190
- 'spec/grape/api_spec.rb'
173191
- 'spec/grape/dsl/configuration_spec.rb'
174192
- 'spec/grape/validations/attributes_iterator_spec.rb'
175193

176-
# Offense count: 499
194+
# Offense count: 507
177195
# Configuration parameters: CountAsOne.
178196
RSpec/ExampleLength:
179197
Max: 57
180198

199+
# Offense count: 2
200+
# This cop supports safe autocorrection (--autocorrect).
201+
# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples.
202+
# DisallowedExamples: works
203+
RSpec/ExampleWording:
204+
Exclude:
205+
- 'spec/grape/integration/global_namespace_function_spec.rb'
206+
- 'spec/grape/validations_spec.rb'
207+
181208
# Offense count: 7
182-
# Cop supports --auto-correct.
209+
# This cop supports safe autocorrection (--autocorrect).
183210
RSpec/ExpectActual:
184211
Exclude:
185212
- 'spec/routing/**/*'
@@ -192,7 +219,7 @@ RSpec/ExpectInHook:
192219
- 'spec/grape/api_spec.rb'
193220
- 'spec/grape/validations/validators/values_spec.rb'
194221

195-
# Offense count: 41
222+
# Offense count: 43
196223
# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
197224
# Include: **/*_spec*rb*, **/spec/**/*
198225
RSpec/FilePath:
@@ -233,7 +260,7 @@ RSpec/MessageChain:
233260
Exclude:
234261
- 'spec/grape/middleware/formatter_spec.rb'
235262

236-
# Offense count: 135
263+
# Offense count: 138
237264
# Configuration parameters: .
238265
# SupportedStyles: have_received, receive
239266
RSpec/MessageSpies:
@@ -244,24 +271,42 @@ RSpec/MissingExampleGroupArgument:
244271
Exclude:
245272
- 'spec/grape/middleware/exception_spec.rb'
246273

247-
# Offense count: 755
274+
# Offense count: 766
248275
RSpec/MultipleExpectations:
249276
Max: 16
250277

251-
# Offense count: 32
278+
# Offense count: 38
252279
# Configuration parameters: AllowSubject.
253280
RSpec/MultipleMemoizedHelpers:
254281
Max: 10
255282

256-
# Offense count: 2116
257-
# Configuration parameters: IgnoreSharedExamples.
283+
# Offense count: 2145
284+
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
285+
# SupportedStyles: always, named_only
258286
RSpec/NamedSubject:
259287
Enabled: false
260288

261-
# Offense count: 161
289+
# Offense count: 171
290+
# Configuration parameters: AllowedGroups.
262291
RSpec/NestedGroups:
263292
Max: 6
264293

294+
# Offense count: 18
295+
# Configuration parameters: AllowedPatterns.
296+
# AllowedPatterns: ^expect_, ^assert_
297+
RSpec/NoExpectationExample:
298+
Exclude:
299+
- 'spec/grape/api_remount_spec.rb'
300+
- 'spec/grape/api_spec.rb'
301+
- 'spec/grape/entity_spec.rb'
302+
- 'spec/grape/validations_spec.rb'
303+
304+
# Offense count: 6
305+
# This cop supports unsafe autocorrection (--autocorrect-all).
306+
RSpec/Rails/HaveHttpStatus:
307+
Exclude:
308+
- 'spec/grape/api_spec.rb'
309+
265310
# Offense count: 12
266311
RSpec/RepeatedDescription:
267312
Exclude:
@@ -343,11 +388,28 @@ Style/CombinableLoops:
343388
- 'spec/grape/endpoint_spec.rb'
344389

345390
# Offense count: 2
346-
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, IgnoredMethods.
391+
# This cop supports safe autocorrection (--autocorrect).
392+
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns, IgnoredMethods.
347393
# SupportedStyles: annotated, template, unannotated
348394
Style/FormatStringToken:
349395
EnforcedStyle: template
350396

397+
# Offense count: 1
398+
# This cop supports safe autocorrection (--autocorrect).
399+
# Configuration parameters: EnforcedStyle, DirectiveCapitalization, ValueCapitalization.
400+
# SupportedStyles: snake_case, kebab_case
401+
# SupportedCapitalizations: lowercase, uppercase
402+
Style/MagicCommentFormat:
403+
Exclude:
404+
- 'lib/grape/util/cache.rb'
405+
406+
# Offense count: 3
407+
# This cop supports unsafe autocorrection (--autocorrect-all).
408+
Style/MapToHash:
409+
Exclude:
410+
- 'lib/grape/dsl/request_response.rb'
411+
- 'spec/grape/endpoint_spec.rb'
412+
351413
# Offense count: 12
352414
# Configuration parameters: AllowedMethods.
353415
# AllowedMethods: respond_to_missing?
@@ -365,9 +427,40 @@ Style/OptionalBooleanParameter:
365427
- 'lib/grape/validations/types/primitive_coercer.rb'
366428
- 'lib/grape/validations/types/set_coercer.rb'
367429

368-
# Offense count: 144
369-
# Cop supports --auto-correct.
370-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
430+
# Offense count: 28
431+
# This cop supports safe autocorrection (--autocorrect).
432+
Style/RedundantConstantBase:
433+
Exclude:
434+
- 'spec/grape/api/invalid_format_spec.rb'
435+
- 'spec/grape/api_spec.rb'
436+
- 'spec/grape/dsl/logger_spec.rb'
437+
- 'spec/grape/endpoint/declared_spec.rb'
438+
- 'spec/grape/endpoint_spec.rb'
439+
- 'spec/grape/middleware/formatter_spec.rb'
440+
- 'spec/grape/validations/validators/coerce_spec.rb'
441+
- 'spec/grape/validations/validators/default_spec.rb'
442+
- 'spec/integration/multi_json/json_spec.rb'
443+
- 'spec/integration/multi_xml/xml_spec.rb'
444+
445+
# Offense count: 2
446+
# This cop supports unsafe autocorrection (--autocorrect-all).
447+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
448+
# AllowedMethods: present?, blank?, presence, try, try!
449+
Style/SafeNavigation:
450+
Exclude:
451+
- 'lib/grape/endpoint.rb'
452+
453+
# Offense count: 3
454+
# This cop supports unsafe autocorrection (--autocorrect-all).
455+
Style/SlicingWithRange:
456+
Exclude:
457+
- 'lib/grape/dsl/inside_route.rb'
458+
- 'lib/grape/request.rb'
459+
- 'lib/grape/router/attribute_translator.rb'
460+
461+
# Offense count: 168
462+
# This cop supports safe autocorrection (--autocorrect).
463+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
371464
# URISchemes: http, https
372465
Layout/LineLength:
373466
Max: 215

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#### Features
44

5+
* [#2288](https://github.com/ruby-grape/grape/pull/2288): Droped support for Ruby 2.5 - [@ericproulx](https://github.com/ericproulx).
6+
* [#2288](https://github.com/ruby-grape/grape/pull/2288): Updated rubocop to 1.41.0 - [@ericproulx](https://github.com/ericproulx).
57
* Your contribution here.
68

79
#### Fixes

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ group :development, :test do
1010
gem 'bundler'
1111
gem 'hashie'
1212
gem 'rake'
13-
gem 'rubocop', '1.25.1'
13+
gem 'rubocop', '1.41.0'
1414
gem 'rubocop-ast'
1515
gem 'rubocop-performance', require: false
1616
gem 'rubocop-rspec', require: false

gemfiles/multi_json.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ group :development, :test do
1010
gem 'bundler'
1111
gem 'hashie'
1212
gem 'rake'
13-
gem 'rubocop', '1.25.1'
13+
gem 'rubocop', '1.41.0'
1414
gem 'rubocop-ast'
1515
gem 'rubocop-performance', require: false
1616
gem 'rubocop-rspec', require: false

0 commit comments

Comments
 (0)