Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit 071692f

Browse files
petergoldsteinpirj
authored andcommitted
Update to a version of Rubocop that is compatible with Ruby 2.4-3.1
1 parent 8f3ad13 commit 071692f

File tree

8 files changed

+1096
-77
lines changed

8 files changed

+1096
-77
lines changed

.rubocop.yml

+11-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
inherit_from:
22
- .rubocop_rspec_base.yml
3+
- .rubocop_todo.yml
34

45
AllCops:
56
Exclude:
@@ -10,21 +11,21 @@ AllCops:
1011
Metrics/ClassLength:
1112
Max: 330
1213

13-
Encoding:
14-
Exclude:
15-
- lib/rspec/core/formatters/exception_presenter.rb
14+
# This can be addressed once Ruby 1.8 support is removed.
15+
Style/Encoding:
16+
Enabled: false
1617

1718
# This should go down over time.
1819
Metrics/AbcSize:
19-
Max: 40
20+
Max: 283
2021

2122
# This should go down over time.
22-
Metrics/LineLength:
23-
Max: 130
23+
Layout/LineLength:
24+
Max: 172
2425

2526
# This should go down over time.
2627
Metrics/MethodLength:
27-
Max: 39
28+
Max: 134
2829

2930
# This should go down over time.
3031
Metrics/CyclomaticComplexity:
@@ -33,7 +34,7 @@ Metrics/CyclomaticComplexity:
3334
Metrics/PerceivedComplexity:
3435
Max: 15
3536

36-
Lint/HandleExceptions:
37+
Lint/SuppressedException:
3738
Exclude:
3839
- lib/rspec/core/example.rb
3940
- lib/rspec/core/mocking_adapters/mocha.rb
@@ -89,22 +90,11 @@ Style/RaiseArgs:
8990
- lib/rspec/core/hooks.rb
9091
- lib/rspec/core/option_parser.rb
9192
- lib/rspec/core/pending.rb
92-
93-
Performance/RedundantBlockCall:
94-
Exclude:
95-
- lib/rspec/core/rake_task.rb
93+
- spec/rspec/core/formatters/base_text_formatter_spec.rb
9694

9795
Lint/IneffectiveAccessModifier:
9896
Exclude:
9997
- lib/rspec/core/memoized_helpers.rb # Fixing this file was too much of a diff
10098

101-
Performance/Caller:
102-
Exclude:
103-
# The suggested fix for this cop only works on more recent rubies. The
104-
# speed up can be substantial (previous optimization work I've done on
105-
# RSpec involved caller optimization) but I haven't benchmarked this
106-
# particular case to see if it's worth introducing version branching.
107-
- 'lib/rspec/core/example_group.rb'
108-
10999
Metrics/BlockLength:
110-
Max: 193
100+
Max: 2373

.rubocop_rspec_base.yml

+45-38
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,73 @@
44
# This file contains defaults for RSpec projects. Individual projects
55
# can customize by inheriting this file and overriding particular settings.
66

7-
AccessModifierIndentation:
7+
Layout/AccessModifierIndentation:
88
Enabled: false
99

1010
# "Use alias_method instead of alias"
1111
# We're fine with `alias`.
12-
Alias:
12+
Style/Alias:
1313
Enabled: false
1414

15-
AlignParameters:
16-
EnforcedStyle: with_first_parameter
17-
1815
# "Avoid the use of the case equality operator ==="
1916
# We prefer using `Class#===` over `Object#is_a?` because `Class#===`
2017
# is less likely to be monkey patched than `is_a?` on a user object.
21-
CaseEquality:
18+
Style/CaseEquality:
2219
Enabled: false
2320

2421
# Warns when the class is excessively long.
25-
ClassLength:
22+
Metrics/ClassLength:
2623
Max: 100
2724

28-
CollectionMethods:
25+
Style/CollectionMethods:
2926
PreferredMethods:
3027
reduce: 'inject'
3128

3229
# Over time we'd like to get this down, but this is what we're at now.
33-
CyclomaticComplexity:
30+
Metrics/CyclomaticComplexity:
3431
Max: 10
3532

3633
# We use YARD to enforce documentation. It works better than rubocop's
3734
# enforcement...rubocop complains about the places we re-open
3835
# `RSpec::Expectations` and `RSpec::Matchers` w/o having doc commments.
39-
Documentation:
36+
Style/Documentation:
4037
Enabled: false
4138

4239
# We still support 1.8.7 which requires trailing dots
43-
DotPosition:
40+
Layout/DotPosition:
4441
EnforcedStyle: trailing
4542

46-
DoubleNegation:
43+
Style/DoubleNegation:
4744
Enabled: false
4845

4946
# each_with_object is unavailable on 1.8.7 so we have to disable this one.
50-
EachWithObject:
47+
Style/EachWithObject:
5148
Enabled: false
5249

53-
FormatString:
50+
Style/FormatString:
5451
EnforcedStyle: percent
5552

5653
# As long as we support ruby 1.8.7 we have to use hash rockets.
57-
HashSyntax:
54+
Style/HashSyntax:
5855
EnforcedStyle: hash_rockets
5956

6057
# We can't use the new lambda syntax, since we still support 1.8.7.
61-
Lambda:
58+
Style/Lambda:
6259
Enabled: false
6360

6461
# Over time we'd like to get this down, but this is what we're at now.
65-
LineLength:
62+
Layout/LineLength:
6663
Max: 100
6764

6865
# Over time we'd like to get this down, but this is what we're at now.
69-
MethodLength:
66+
Metrics/MethodLength:
7067
Max: 15
7168

7269
# Who cares what we call the argument for binary operator methods?
73-
BinaryOperatorParameterName:
70+
Naming/BinaryOperatorParameterName:
7471
Enabled: false
7572

76-
PercentLiteralDelimiters:
73+
Style/PercentLiteralDelimiters:
7774
PreferredDelimiters:
7875
'%': () # double-quoted string
7976
'%i': '[]' # array of symbols
@@ -87,41 +84,44 @@ PercentLiteralDelimiters:
8784

8885
# We have too many special cases where we allow generator methods or prefer a
8986
# prefixed predicate due to it's improved readability.
90-
PredicateName:
87+
Naming/PredicateName:
9188
Enabled: false
9289

9390
# On 1.8 `proc` is `lambda`, so we use `Proc.new` to ensure we get real procs on all supported versions.
9491
# http://batsov.com/articles/2014/02/04/the-elements-of-style-in-ruby-number-12-proc-vs-proc-dot-new/
95-
Proc:
92+
Style/Proc:
9693
Enabled: false
9794

9895
# Exceptions should be rescued with `Support::AllExceptionsExceptOnesWeMustNotRescue`
99-
RescueException:
96+
Lint/RescueException:
10097
Enabled: true
10198

10299
# We haven't adopted the `fail` to signal exceptions vs `raise` for re-raises convention.
103-
SignalException:
100+
Style/SignalException:
104101
Enabled: false
105102

106103
# We've tended to use no space, so it's less of a change to stick with that.
107-
SpaceAroundEqualsInParameterDefault:
104+
Layout/SpaceAroundEqualsInParameterDefault:
108105
EnforcedStyle: no_space
109106

110107
# We don't care about single vs double qoutes.
111-
StringLiterals:
108+
Style/StringLiterals:
112109
Enabled: false
113110

114111
# This rule favors constant names from the English standard library which we don't load.
115112
Style/SpecialGlobalVars:
116113
Enabled: false
117114

118-
Style/TrailingCommaInLiteral:
115+
Style/TrailingCommaInArrayLiteral:
116+
Enabled: false
117+
118+
Style/TrailingCommaInHashLiteral:
119119
Enabled: false
120120

121121
Style/TrailingCommaInArguments:
122122
Enabled: false
123123

124-
TrivialAccessors:
124+
Style/TrivialAccessors:
125125
AllowDSLWriters: true
126126
AllowPredicates: true
127127
ExactNameMatch: true
@@ -135,6 +135,15 @@ Layout/EmptyLineBetweenDefs:
135135
Layout/FirstParameterIndentation:
136136
Enabled: false
137137

138+
Layout/ParameterAlignment:
139+
EnforcedStyle: with_first_parameter
140+
141+
Layout/SpaceInsideBlockBraces:
142+
Enabled: false
143+
144+
Layout/SpaceInsideParens:
145+
Enabled: false
146+
138147
Naming/ConstantName:
139148
Enabled: false
140149

@@ -162,7 +171,10 @@ Style/IfUnlessModifier:
162171
Style/IfUnlessModifierOfIfUnless:
163172
Enabled: false
164173

165-
Style/MethodMissing:
174+
Lint/MissingSuper:
175+
Enabled: false
176+
177+
Style/MissingRespondToMissing:
166178
Enabled: false
167179

168180
Style/MixinUsage:
@@ -243,24 +255,19 @@ Style/StderrPuts:
243255
Style/TernaryParentheses:
244256
Enabled: false
245257

246-
# This could likely be enabled, but it had a false positive on rspec-mocks
247-
# (suggested change was not behaviour preserving) so I don't trust it.
248-
Performance/HashEachMethods:
249-
Enabled: false
250-
251258
Naming/HeredocDelimiterNaming:
252259
Enabled: false
253260

254-
Layout/EmptyLineAfterMagicComment:
261+
Layout/AssignmentIndentation:
255262
Enabled: false
256263

257-
Layout/IndentArray:
264+
Layout/EmptyLineAfterMagicComment:
258265
Enabled: false
259266

260-
Layout/IndentAssignment:
267+
Layout/FirstArrayElementIndentation:
261268
Enabled: false
262269

263-
Layout/IndentHeredoc:
270+
Layout/HeredocIndentation:
264271
Enabled: false
265272

266273
Layout/SpaceInsidePercentLiteralDelimiters:

0 commit comments

Comments
 (0)