Skip to content

Commit 7091222

Browse files
authored
Update rubocop to 1.33.0 (#327)
- General bundle update. - Update the docs too.
1 parent 94b03a3 commit 7091222

17 files changed

+184
-58
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.32.0", require: false
8+
gem "rubocop", "1.33.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: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ GEM
3939
diff-lcs (>= 1.2.0, < 2.0)
4040
rspec-support (~> 3.11.0)
4141
rspec-support (3.11.0)
42-
rubocop (1.32.0)
42+
rubocop (1.33.0)
4343
json (~> 2.3)
4444
parallel (~> 1.10)
4545
parser (>= 3.1.0.0)
@@ -49,13 +49,13 @@ GEM
4949
rubocop-ast (>= 1.19.1, < 2.0)
5050
ruby-progressbar (~> 1.7)
5151
unicode-display_width (>= 1.4.0, < 3.0)
52-
rubocop-ast (1.19.1)
52+
rubocop-ast (1.21.0)
5353
parser (>= 3.1.1.0)
54-
rubocop-graphql (0.14.4)
54+
rubocop-graphql (0.14.5)
5555
rubocop (>= 0.87, < 2)
5656
rubocop-i18n (3.0.0)
5757
rubocop (~> 1.0)
58-
rubocop-minitest (0.20.1)
58+
rubocop-minitest (0.21.0)
5959
rubocop (>= 0.90, < 2.0)
6060
rubocop-performance (1.14.3)
6161
rubocop (>= 1.7.0, < 2.0)
@@ -70,8 +70,8 @@ GEM
7070
rubocop (~> 1.31)
7171
rubocop-sequel (0.3.4)
7272
rubocop (~> 1.0)
73-
rubocop-shopify (2.8.0)
74-
rubocop (~> 1.31)
73+
rubocop-shopify (2.9.0)
74+
rubocop (~> 1.33)
7575
rubocop-sorbet (0.6.11)
7676
rubocop (>= 0.90.0)
7777
rubocop-thread_safety (0.4.4)
@@ -91,7 +91,7 @@ DEPENDENCIES
9191
pry
9292
rake
9393
rspec
94-
rubocop (= 1.32.0)
94+
rubocop (= 1.33.0)
9595
rubocop-graphql
9696
rubocop-i18n
9797
rubocop-minitest

config/contents/lint/ambiguous_block_association.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Checks for ambiguous block association with method
22
when param passed without parentheses.
33

4-
This cop can customize ignored methods with `IgnoredMethods`.
5-
By default, there are no methods to ignored.
4+
This cop can customize allowed methods with `AllowedMethods`.
5+
By default, there are no methods to allowed.
66

77
### Example:
88

@@ -25,12 +25,23 @@ By default, there are no methods to ignored.
2525
# Lambda arguments require no disambiguation
2626
foo = ->(bar) { bar.baz }
2727

28-
### Example: IgnoredMethods: [] (default)
28+
### Example: AllowedMethods: [] (default)
2929

3030
# bad
3131
expect { do_something }.to change { object.attribute }
3232

33-
### Example: IgnoredMethods: [change]
33+
### Example: AllowedMethods: [change]
3434

3535
# good
3636
expect { do_something }.to change { object.attribute }
37+
38+
### Example: AllowedPatterns: [] (default)
39+
40+
# bad
41+
expect { do_something }.to change { object.attribute }
42+
43+
### Example: AllowedPatterns: [/change/]
44+
45+
# good
46+
expect { do_something }.to change { object.attribute }
47+
expect { do_something }.to not_change { object.attribute }

config/contents/lint/debugger.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ Specific default groups can be disabled if necessary:
99

1010
```yaml
1111
Lint/Debugger:
12-
WebConsole: ~
12+
DebuggerMethods:
13+
WebConsole: ~
1314
```
1415
16+
You can also add your own methods by adding a new category:
17+
18+
```yaml
19+
Lint/Debugger:
20+
DebuggerMethods:
21+
MyDebugger:
22+
MyDebugger.debug_this
23+
```
1524
1625
### Example:
1726

config/contents/lint/empty_conditional_body.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Checks for the presence of `if`, `elsif` and `unless` branches without a body.
2+
3+
NOTE: empty `else` branches are handled by `Style/EmptyElse`.
4+
25
### Example:
36
# bad
47
if condition

config/contents/lint/number_conversion.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ always correct to raise if a value is not numeric.
1111
NOTE: Some values cannot be converted properly using one of the `Kernel`
1212
method (for instance, `Time` and `DateTime` values are allowed by this
1313
cop by default). Similarly, Rails' duration methods do not work well
14-
with `Integer()` and can be ignored with `IgnoredMethods`. By default,
15-
there are no methods to ignored.
14+
with `Integer()` and can be allowed with `AllowedMethods`. By default,
15+
there are no methods to allowed.
1616

1717
### Safety:
1818

@@ -42,12 +42,22 @@ input if it is not a standard class.
4242
foo.try { |i| Float(i) }
4343
bar.send { |i| Complex(i) }
4444

45-
### Example: IgnoredMethods: [] (default)
45+
### Example: AllowedMethods: [] (default)
4646

4747
# bad
4848
10.minutes.to_i
4949

50-
### Example: IgnoredMethods: [minutes]
50+
### Example: AllowedMethods: [minutes]
51+
52+
# good
53+
10.minutes.to_i
54+
55+
### Example: AllowedPatterns: [] (default)
56+
57+
# bad
58+
10.minutes.to_i
59+
60+
### Example: AllowedPatterns: [/min*/]
5161

5262
# good
5363
10.minutes.to_i

config/contents/metrics/abc_size.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ is meant to distinguish actual `attr_reader` from other methods.
2828
render 'pages/search/page'
2929
end
3030

31-
This cop also takes into account `IgnoredMethods` (defaults to `[]`)
31+
This cop also takes into account `AllowedMethods` (defaults to `[]`)
32+
And `AllowedPatterns` (defaults to `[]`)

config/contents/metrics/block_length.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ will be counted as one line regardless of its actual size.
99

1010

1111
NOTE: The `ExcludedMethods` configuration is deprecated and only kept
12-
for backwards compatibility. Please use `IgnoredMethods` instead.
13-
By default, there are no methods to ignored.
12+
for backwards compatibility. Please use `AllowedMethods` and `AllowedPatterns`
13+
instead. By default, there are no methods to allowed.
1414

1515
### Example: CountAsOne: ['array', 'heredoc']
1616

config/contents/metrics/method_length.md

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

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

9-
NOTE: The `ExcludedMethods` configuration is deprecated and only kept
10-
for backwards compatibility. Please use `IgnoredMethods` instead.
11-
By default, there are no methods to ignored.
9+
NOTE: The `ExcludedMethods` and `IgnoredMethods` configuration is
10+
deprecated and only kept for backwards compatibility.
11+
Please use `AllowedMethods` and `AllowedPatterns` instead.
12+
By default, there are no methods to allowed.
1213

1314
### Example: CountAsOne: ['array', 'heredoc']
1415

config/contents/naming/predicate_name.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
1-
Makes sure that predicates are named properly.
2-
`is_a?` method is allowed by default.
3-
These are customizable with `AllowedMethods` option.
1+
Checks that predicate methods names end with a question mark and
2+
do not start with a forbidden prefix.
3+
4+
A method is determined to be a predicate method if its name starts
5+
with one of the prefixes defined in the `NamePrefix` configuration.
6+
You can change what prefixes are considered by changing this option.
7+
Any method name that starts with one of these prefixes is required by
8+
the cop to end with a `?`. Other methods can be allowed by adding to
9+
the `AllowedMethods` configuration.
10+
11+
NOTE: The `is_a?` method is allowed by default.
12+
13+
If `ForbiddenPrefixes` is set, methods that start with the configured
14+
prefixes will not be allowed and will be removed by autocorrection.
15+
16+
In other words, if `ForbiddenPrefixes` is empty, a method named `is_foo`
17+
will register an offense only due to the lack of question mark (and will be
18+
autocorrected to `is_foo?`). If `ForbiddenPrefixes` contains `is_`,
19+
`is_foo` will register an offense both because the ? is missing and because of
20+
the `is_` prefix, and will be corrected to `foo?`.
21+
22+
NOTE: `ForbiddenPrefixes` is only applied to prefixes in `NamePrefix`;
23+
a prefix in the former but not the latter will not be considered by
24+
this cop.
425

526
### Example:
627
# bad

0 commit comments

Comments
 (0)