Skip to content

Commit 8f04181

Browse files
authored
Updated channel and documentation to Rubocop v1.9.1 (#273)
Bumps the 'rubocop' dependency to v1.9.1, updates the scraped documentation, and fixes the config-upgrader spec by adding the new cops to the config-upgrader fixture.
1 parent 33f7627 commit 8f04181

19 files changed

+181
-17
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ gem "activesupport", require: false
66
gem "mry", require: false
77
gem "parser"
88
gem "pry", require: false
9-
gem "rubocop", "1.8.1", require: false
9+
gem "rubocop", "1.9.1", require: false
1010
gem "rubocop-i18n", require: false
1111
gem "rubocop-minitest", require: false
1212
gem "rubocop-performance", require: false

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ GEM
77
minitest (~> 5.1)
88
tzinfo (~> 1.1)
99
zeitwerk (~> 2.2, >= 2.2.2)
10-
ast (2.4.1)
10+
ast (2.4.2)
1111
coderay (1.1.3)
1212
concurrent-ruby (1.1.6)
1313
diff-lcs (1.4.4)
@@ -41,7 +41,7 @@ GEM
4141
diff-lcs (>= 1.2.0, < 2.0)
4242
rspec-support (~> 3.9.0)
4343
rspec-support (3.9.3)
44-
rubocop (1.8.1)
44+
rubocop (1.9.1)
4545
parallel (~> 1.10)
4646
parser (>= 3.0.0.0)
4747
rainbow (>= 2.2.2, < 4.0)
@@ -50,7 +50,7 @@ GEM
5050
rubocop-ast (>= 1.2.0, < 2.0)
5151
ruby-progressbar (~> 1.7)
5252
unicode-display_width (>= 1.4.0, < 3.0)
53-
rubocop-ast (1.4.0)
53+
rubocop-ast (1.4.1)
5454
parser (>= 2.7.1.5)
5555
rubocop-i18n (3.0.0)
5656
rubocop (~> 1.0)
@@ -91,7 +91,7 @@ DEPENDENCIES
9191
pry
9292
rake
9393
rspec
94-
rubocop (= 1.8.1)
94+
rubocop (= 1.9.1)
9595
rubocop-i18n
9696
rubocop-minitest
9797
rubocop-performance

config/contents/layout/first_argument_indentation.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
This cop checks the indentation of the first argument in a method call.
2-
Arguments after the first one are checked by Layout/ArgumentAlignment,
2+
Arguments after the first one are checked by `Layout/ArgumentAlignment`,
33
not by this cop.
44

55
For indenting the first parameter of method _definitions_, check out
6-
Layout/FirstParameterIndentation.
6+
`Layout/FirstParameterIndentation`.
7+
8+
This cop will respect `Layout/ArgumentAlignment` and will not work when
9+
`EnforcedStyle: with_fixed_indentation` is specified for `Layout/ArgumentAlignment`.
710

811
### Example:
912

config/contents/lint/number_conversion.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ with `Integer()` and can be ignored with `IgnoredMethods`.
2020
'10'.to_i
2121
'10.2'.to_f
2222
'10'.to_c
23+
['1', '2', '3'].map(&:to_i)
24+
foo.try(:to_f)
25+
bar.send(:to_c)
2326

2427
# good
2528

2629
Integer('10', 10)
2730
Float('10.2')
2831
Complex('10')
32+
['1', '2', '3'].map { |i| Integer(i, 10) }
33+
foo.try { |i| Float(i) }
34+
bar.send { |i| Complex(i) }
2935

3036
### Example: IgnoredMethods: [minutes]
3137

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
This cop checks for uses of numbered parameter assignment.
2+
It emulates the following warning in Ruby 2.7:
3+
4+
% ruby -ve '_1 = :value'
5+
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
6+
-e:1: warning: `_1' is reserved for numbered parameter; consider another name
7+
8+
Assiging to numbered parameter (from `_1` to `_9`) cause an error in Ruby 3.0.
9+
10+
% ruby -ve '_1 = :value'
11+
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
12+
-e:1: _1 is reserved for numbered parameter
13+
14+
NOTE: The parametered parameters are from `_1` to `_9`. This cop checks `_0`, and over `_10`
15+
as well to prevent confusion.
16+
17+
### Example:
18+
19+
# bad
20+
_1 = :value
21+
22+
# good
23+
non_numbered_parameter_name = :value
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
This cop checks for unintended or-assignment to a constant.
2+
3+
Constants should always be assigned in the same location. And its value
4+
should always be the same. If constants are assigned in multiple
5+
locations, the result may vary depending on the order of `require`.
6+
7+
Also, if you already have such an implementation, auto-correction may
8+
change the result.
9+
10+
### Example:
11+
12+
# bad
13+
CONST ||= 1
14+
15+
# good
16+
CONST = 1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
This cop checks for uses of literal strings converted to
2+
a symbol where a literal symbol could be used instead.
3+
4+
### Example:
5+
# bad
6+
'string'.to_sym
7+
:symbol.to_sym
8+
'underscored_string'.to_sym
9+
:'underscored_symbol'
10+
'hyphenated-string'.to_sym
11+
12+
# good
13+
:string
14+
:symbol
15+
:underscored_string
16+
:underscored_symbol
17+
:'hyphenated-string'

config/contents/lint/triple_quotes.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
This cop checks for "triple quotes" (strings delimted by any odd number
2+
of quotes greater than 1).
3+
4+
Ruby allows multiple strings to be implicitly concatenated by just
5+
being adjacent in a statement (ie. `"foo""bar" == "foobar"`). This sometimes
6+
gives the impression that there is something special about triple quotes, but
7+
in fact it is just extra unnecessary quotes and produces the same string. Each
8+
pair of quotes produces an additional concatenated empty string, so the result
9+
is still only the "actual" string within the delimiters.
10+
11+
NOTE: Although this cop is called triple quotes, the same behavior is present
12+
for strings delimited by 5, 7, etc. quotation marks.
13+
14+
### Example:
15+
# bad
16+
"""
17+
A string
18+
"""
19+
20+
# bad
21+
'''
22+
A string
23+
'''
24+
25+
# good
26+
"
27+
A string
28+
"
29+
30+
# good
31+
<<STRING
32+
A string
33+
STRING
34+
35+
# good (but not the same spacing as the bad case)
36+
'A string'

config/contents/naming/variable_number.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ Both are enabled by default.
8787
# good
8888
:some_sym_1
8989

90-
### Example: AllowedIdentifier: [capture3]
90+
### Example: AllowedIdentifiers: [capture3]
9191
# good
9292
expect(Open3).to receive(:capture3)

config/contents/style/ascii_comments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
This cop checks for non-ascii (non-English) characters
22
in comments. You could set an array of allowed non-ascii chars in
3-
AllowedChars attribute (empty by default).
3+
`AllowedChars` attribute (copyright notice "©" by default).
44

55
### Example:
66
# bad

0 commit comments

Comments
 (0)