Skip to content

Commit d174500

Browse files
authored
Update rubocop to 1.40.0 (#338)
- General bundle update. - Update the docs too.
1 parent af40822 commit d174500

16 files changed

+180
-39
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
55
gem "activesupport", require: false
66
gem "parser"
77
gem "pry", require: false
8-
gem "rubocop", "1.39.0", require: false
8+
gem "rubocop", "1.40.0", require: false
99
gem "rubocop-i18n", require: false
1010
gem "rubocop-graphql", require: false
1111
gem "rubocop-minitest", require: false

Gemfile.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ GEM
1212
diff-lcs (1.5.0)
1313
i18n (1.12.0)
1414
concurrent-ruby (~> 1.0)
15-
json (2.6.2)
15+
json (2.6.3)
1616
method_source (1.0.0)
1717
minitest (5.16.3)
1818
parallel (1.22.1)
19-
parser (3.1.2.1)
19+
parser (3.1.3.0)
2020
ast (~> 2.4.1)
2121
pry (0.14.1)
2222
coderay (~> 1.1)
2323
method_source (~> 1.0)
24-
rack (3.0.0)
24+
rack (3.0.2)
2525
rainbow (3.1.1)
2626
rake (13.0.6)
27-
regexp_parser (2.6.0)
27+
regexp_parser (2.6.1)
2828
rexml (3.2.5)
2929
rspec (3.12.0)
3030
rspec-core (~> 3.12.0)
@@ -35,11 +35,11 @@ GEM
3535
rspec-expectations (3.12.0)
3636
diff-lcs (>= 1.2.0, < 2.0)
3737
rspec-support (~> 3.12.0)
38-
rspec-mocks (3.12.0)
38+
rspec-mocks (3.12.1)
3939
diff-lcs (>= 1.2.0, < 2.0)
4040
rspec-support (~> 3.12.0)
4141
rspec-support (3.12.0)
42-
rubocop (1.39.0)
42+
rubocop (1.40.0)
4343
json (~> 2.3)
4444
parallel (~> 1.10)
4545
parser (>= 3.1.2.1)
@@ -49,24 +49,24 @@ GEM
4949
rubocop-ast (>= 1.23.0, < 2.0)
5050
ruby-progressbar (~> 1.7)
5151
unicode-display_width (>= 1.4.0, < 3.0)
52-
rubocop-ast (1.23.0)
52+
rubocop-ast (1.24.0)
5353
parser (>= 3.1.1.0)
5454
rubocop-graphql (0.18.0)
5555
rubocop (>= 0.87, < 2)
5656
rubocop-i18n (3.0.0)
5757
rubocop (~> 1.0)
58-
rubocop-minitest (0.23.2)
58+
rubocop-minitest (0.25.0)
5959
rubocop (>= 0.90, < 2.0)
60-
rubocop-performance (1.15.0)
60+
rubocop-performance (1.15.1)
6161
rubocop (>= 1.7.0, < 2.0)
6262
rubocop-ast (>= 0.4.0)
63-
rubocop-rails (2.17.2)
63+
rubocop-rails (2.17.3)
6464
activesupport (>= 4.2.0)
6565
rack (>= 1.1)
6666
rubocop (>= 1.33.0, < 2.0)
6767
rubocop-rake (0.6.0)
6868
rubocop (~> 1.0)
69-
rubocop-rspec (2.15.0)
69+
rubocop-rspec (2.16.0)
7070
rubocop (~> 1.33)
7171
rubocop-sequel (0.3.4)
7272
rubocop (~> 1.0)
@@ -77,7 +77,7 @@ GEM
7777
rubocop-thread_safety (0.4.4)
7878
rubocop (>= 0.53.0)
7979
ruby-progressbar (1.11.0)
80-
test-prof (1.0.11)
80+
test-prof (1.1.0)
8181
tzinfo (2.0.5)
8282
concurrent-ruby (~> 1.0)
8383
unicode-display_width (2.3.0)
@@ -91,7 +91,7 @@ DEPENDENCIES
9191
pry
9292
rake
9393
rspec
94-
rubocop (= 1.39.0)
94+
rubocop (= 1.40.0)
9595
rubocop-graphql
9696
rubocop-i18n
9797
rubocop-minitest

config/contents/lint/assignment_in_condition.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ By safe assignment we mean putting parentheses around
66
an assignment to indicate "I know I'm using an assignment
77
as a condition. It's not a mistake."
88

9+
### Safety:
10+
11+
This cop's autocorrection is unsafe because it assumes that
12+
the author meant to use an assignment result as a condition.
13+
914
### Example:
1015
# bad
1116
if some_var = true

config/contents/lint/deprecated_constants.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,25 @@ alternative value as `Alternative`. And you can set the deprecated version as
99
Alternative: 'alternative_value'
1010
DeprecatedVersion: 'deprecated_version'
1111

12-
By default, `NIL`, `TRUE`, `FALSE` and `Random::DEFAULT` are configured.
12+
By default, `NIL`, `TRUE`, `FALSE`, `Net::HTTPServerException, `Random::DEFAULT`,
13+
`Struct::Group`, and `Struct::Passwd` are configured.
1314

1415
### Example:
1516

1617
# bad
1718
NIL
1819
TRUE
1920
FALSE
21+
Net::HTTPServerException
2022
Random::DEFAULT # Return value of Ruby 2 is `Random` instance, Ruby 3.0 is `Random` class.
23+
Struct::Group
24+
Struct::Passwd
2125

2226
# good
2327
nil
2428
true
2529
false
30+
Net::HTTPClientException
2631
Random.new # `::DEFAULT` has been deprecated in Ruby 3, `.new` is compatible with Ruby 2.
32+
Etc::Group
33+
Etc::Passwd

config/contents/lint/interpolation_check.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ Checks for interpolation in a single quoted string.
22

33
### Safety:
44

5-
This cop is generally safe, but is marked as unsafe because
6-
it is possible to actually intentionally have text inside
7-
`#{...}` in a single quoted string.
5+
This cop's autocorrection is unsafe because although it always replaces single quotes as
6+
if it were miswritten double quotes, it is not always the case. For example,
7+
`'#{foo} bar'` would be replaced by `"#{foo} bar"`, so the replaced code would evaluate
8+
the expression `foo`.
89

910
### Example:
1011

config/contents/lint/void.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Checks for operators, variables, literals, and nonmutating
1+
Checks for operators, variables, literals, lambda, proc and nonmutating
22
methods used in void context.
33

44
### Example: CheckForMethodsWithNoSideEffects: false (default)

config/contents/metrics/block_length.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ Comment lines can optionally be ignored.
33
The maximum allowed length is configurable.
44
The cop can be configured to ignore blocks passed to certain methods.
55

6-
You can set literals you want to fold with `CountAsOne`.
7-
Available are: 'array', 'hash', and 'heredoc'. Each literal
6+
You can set constructs you want to fold with `CountAsOne`.
7+
Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct
88
will be counted as one line regardless of its actual size.
99

1010

1111
NOTE: The `ExcludedMethods` configuration is deprecated and only kept
1212
for backwards compatibility. Please use `AllowedMethods` and `AllowedPatterns`
1313
instead. By default, there are no methods to allowed.
1414

15-
### Example: CountAsOne: ['array', 'heredoc']
15+
### Example: CountAsOne: ['array', 'heredoc', 'method_call']
1616

1717
something do
1818
array = [ # +1
@@ -28,6 +28,11 @@ instead. By default, there are no methods to allowed.
2828
Heredoc
2929
content.
3030
HEREDOC
31-
end # 5 points
31+
32+
foo( # +1
33+
1,
34+
2
35+
)
36+
end # 6 points
3237

3338
NOTE: This cop does not apply for `Struct` definitions.

config/contents/metrics/class_length.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Checks if the length a class exceeds some maximum value.
22
Comment lines can optionally be ignored.
33
The maximum allowed length is configurable.
44

5-
You can set literals you want to fold with `CountAsOne`.
6-
Available are: 'array', 'hash', and 'heredoc'. Each literal
5+
You can set constructs you want to fold with `CountAsOne`.
6+
Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct
77
will be counted as one line regardless of its actual size.
88

9-
### Example: CountAsOne: ['array', 'heredoc']
9+
### Example: CountAsOne: ['array', 'heredoc', 'method_call']
1010

1111
class Foo
1212
ARRAY = [ # +1
@@ -22,7 +22,12 @@ will be counted as one line regardless of its actual size.
2222
Heredoc
2323
content.
2424
HEREDOC
25-
end # 5 points
25+
26+
foo( # +1
27+
1,
28+
2
29+
)
30+
end # 6 points
2631

2732

2833
NOTE: This cop also applies for `Struct` definitions.

config/contents/metrics/method_length.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ Checks if the length of a method exceeds some maximum value.
22
Comment lines can optionally be allowed.
33
The maximum allowed length is configurable.
44

5-
You can set literals you want to fold with `CountAsOne`.
6-
Available are: 'array', 'hash', and 'heredoc'. Each literal
5+
You can set constructs you want to fold with `CountAsOne`.
6+
Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct
77
will be counted as one line regardless of its actual size.
88

99
NOTE: The `ExcludedMethods` and `IgnoredMethods` configuration is
1010
deprecated and only kept for backwards compatibility.
1111
Please use `AllowedMethods` and `AllowedPatterns` instead.
1212
By default, there are no methods to allowed.
1313

14-
### Example: CountAsOne: ['array', 'heredoc']
14+
### Example: CountAsOne: ['array', 'heredoc', 'method_call']
1515

1616
def m
1717
array = [ # +1
@@ -27,4 +27,9 @@ By default, there are no methods to allowed.
2727
Heredoc
2828
content.
2929
HEREDOC
30-
end # 5 points
30+
31+
foo( # +1
32+
1,
33+
2
34+
)
35+
end # 6 points

config/contents/metrics/module_length.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ Checks if the length a module exceeds some maximum value.
22
Comment lines can optionally be ignored.
33
The maximum allowed length is configurable.
44

5-
You can set literals you want to fold with `CountAsOne`.
6-
Available are: 'array', 'hash', and 'heredoc'. Each literal
5+
You can set constructs you want to fold with `CountAsOne`.
6+
Available are: 'array', 'hash', 'heredoc', and 'method_call'. Each construct
77
will be counted as one line regardless of its actual size.
88

9-
### Example: CountAsOne: ['array', 'heredoc']
9+
### Example: CountAsOne: ['array', 'heredoc', 'method_call']
1010

1111
module M
1212
ARRAY = [ # +1
@@ -22,4 +22,9 @@ will be counted as one line regardless of its actual size.
2222
Heredoc
2323
content.
2424
HEREDOC
25-
end # 5 points
25+
26+
foo( # +1
27+
1,
28+
2
29+
)
30+
end # 6 points

0 commit comments

Comments
 (0)