Skip to content

Commit 184193c

Browse files
authored
Update rubocop to 1.31.0 (#318)
- General bundle update. - Update the docs too. - Update Ruby to the latest 2.7.x version. - Add a gemset to improve local development.
1 parent edafbf3 commit 184193c

14 files changed

+166
-20
lines changed

.ruby-gemset

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
codeclimate-rubocop

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.2
1+
2.7.6

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.30.1", require: false
9+
gem "rubocop", "1.31.0", require: false
1010
gem "rubocop-i18n", require: false
1111
gem "rubocop-graphql", require: false
1212
gem "rubocop-minitest", require: false

Gemfile.lock

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ GEM
1313
i18n (1.10.0)
1414
concurrent-ruby (~> 1.0)
1515
method_source (1.0.0)
16-
minitest (5.15.0)
16+
minitest (5.16.1)
1717
mry (0.78.0.0)
1818
rubocop (>= 0.41.0)
1919
parallel (1.22.1)
@@ -40,7 +40,7 @@ GEM
4040
diff-lcs (>= 1.2.0, < 2.0)
4141
rspec-support (~> 3.11.0)
4242
rspec-support (3.11.0)
43-
rubocop (1.30.1)
43+
rubocop (1.31.0)
4444
parallel (~> 1.10)
4545
parser (>= 3.1.0.0)
4646
rainbow (>= 2.2.2, < 4.0)
@@ -51,36 +51,36 @@ GEM
5151
unicode-display_width (>= 1.4.0, < 3.0)
5252
rubocop-ast (1.18.0)
5353
parser (>= 3.1.1.0)
54-
rubocop-graphql (0.14.3)
54+
rubocop-graphql (0.14.4)
5555
rubocop (>= 0.87, < 2)
5656
rubocop-i18n (3.0.0)
5757
rubocop (~> 1.0)
58-
rubocop-minitest (0.20.0)
58+
rubocop-minitest (0.20.1)
5959
rubocop (>= 0.90, < 2.0)
60-
rubocop-performance (1.14.1)
60+
rubocop-performance (1.14.2)
6161
rubocop (>= 1.7.0, < 2.0)
6262
rubocop-ast (>= 0.4.0)
63-
rubocop-rails (2.14.2)
63+
rubocop-rails (2.15.1)
6464
activesupport (>= 4.2.0)
6565
rack (>= 1.1)
6666
rubocop (>= 1.7.0, < 2.0)
6767
rubocop-rake (0.6.0)
6868
rubocop (~> 1.0)
6969
rubocop-rspec (2.11.1)
7070
rubocop (~> 1.19)
71-
rubocop-sequel (0.3.3)
71+
rubocop-sequel (0.3.4)
7272
rubocop (~> 1.0)
73-
rubocop-shopify (2.7.0)
73+
rubocop-shopify (2.7.1)
7474
rubocop (~> 1.30)
75-
rubocop-sorbet (0.6.8)
75+
rubocop-sorbet (0.6.10)
7676
rubocop (>= 0.90.0)
7777
rubocop-thread_safety (0.4.4)
7878
rubocop (>= 0.53.0)
7979
ruby-progressbar (1.11.0)
8080
test-prof (1.0.9)
8181
tzinfo (2.0.4)
8282
concurrent-ruby (~> 1.0)
83-
unicode-display_width (2.1.0)
83+
unicode-display_width (2.2.0)
8484

8585
PLATFORMS
8686
ruby
@@ -92,7 +92,7 @@ DEPENDENCIES
9292
pry
9393
rake
9494
rspec
95-
rubocop (= 1.30.1)
95+
rubocop (= 1.31.0)
9696
rubocop-graphql
9797
rubocop-i18n
9898
rubocop-minitest

config/contents/gemspec/deprecated_attribute_assignment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Checks that deprecated attribute attributes are not set in a gemspec file.
2-
Removing `test_files` allows the user to receive smaller packed gems.
2+
Removing deprecated attributes allows the user to receive smaller packed gems.
33

44
### Example:
55

config/contents/layout/first_hash_element_indentation.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ styles are 'consistent' and 'align_braces'. Here are examples:
2727
and_in_a_method_call({
2828
no: :difference
2929
})
30+
takes_multi_pairs_hash(x: {
31+
a: 1,
32+
b: 2
33+
},
34+
y: {
35+
c: 1,
36+
d: 2
37+
})
3038

3139
# good
3240
special_inside_parentheses
@@ -36,6 +44,14 @@ styles are 'consistent' and 'align_braces'. Here are examples:
3644
but_in_a_method_call({
3745
its_like: :this
3846
})
47+
takes_multi_pairs_hash(x: {
48+
a: 1,
49+
b: 2
50+
},
51+
y: {
52+
c: 1,
53+
d: 2
54+
})
3955

4056
### Example: EnforcedStyle: consistent
4157
# The `consistent` style enforces that the first key in a hash
@@ -59,6 +75,7 @@ styles are 'consistent' and 'align_braces'. Here are examples:
5975
no: :difference
6076
})
6177

78+
6279
### Example: EnforcedStyle: align_braces
6380
# The `align_brackets` style enforces that the opening and closing
6481
# braces are indented to the same position.
@@ -67,8 +84,24 @@ styles are 'consistent' and 'align_braces'. Here are examples:
6784
and_now_for_something = {
6885
completely: :different
6986
}
87+
takes_multi_pairs_hash(x: {
88+
a: 1,
89+
b: 2
90+
},
91+
y: {
92+
c: 1,
93+
d: 2
94+
})
7095

7196
# good
7297
and_now_for_something = {
7398
completely: :different
74-
}
99+
}
100+
takes_multi_pairs_hash(x: {
101+
a: 1,
102+
b: 2
103+
},
104+
y: {
105+
c: 1,
106+
d: 2
107+
})
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Checks that strings broken over multiple lines (by a backslash) contain
2+
trailing spaces instead of leading spaces.
3+
4+
### Example:
5+
# bad
6+
'this text contains a lot of' \
7+
' spaces'
8+
9+
# good
10+
'this text contains a lot of ' \
11+
'spaces'
12+
13+
# bad
14+
'this text is too' \
15+
' long'
16+
17+
# good
18+
'this text is too ' \
19+
'long'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Checks that the backslash of a line continuation is separated from
2+
preceding text by exactly one space (default) or zero spaces.
3+
4+
### Example: EnforcedStyle: space (default)
5+
# bad
6+
'a'\
7+
'b' \
8+
'c'
9+
10+
# good
11+
'a' \
12+
'b' \
13+
'c'
14+
15+
### Example: EnforcedStyle: no_space
16+
# bad
17+
'a' \
18+
'b' \
19+
'c'
20+
21+
# good
22+
'a'\
23+
'b'\
24+
'c'
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Checks for overwriting an exception with an exception result by use `rescue =>`.
2+
3+
You intended to write as `rescue StandardError`.
4+
However, you have written `rescue => StandardError`.
5+
In that case, the result of `rescue` will overwrite `StandardError`.
6+
7+
### Example:
8+
9+
# bad
10+
begin
11+
something
12+
rescue => StandardError
13+
end
14+
15+
# good
16+
begin
17+
something
18+
rescue StandardError
19+
end
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Checks for non-atomic file operation.
2+
And then replace it with a nearly equivalent and atomic method.
3+
4+
These can cause problems that are difficult to reproduce,
5+
especially in cases of frequent file operations in parallel,
6+
such as test runs with parallel_rspec.
7+
8+
For examples: creating a directory if there is none, has the following problems
9+
10+
An exception occurs when the directory didn't exist at the time of `exist?`,
11+
but someone else created it before `mkdir` was executed.
12+
13+
Subsequent processes are executed without the directory that should be there
14+
when the directory existed at the time of `exist?`,
15+
but someone else deleted it shortly afterwards.
16+
17+
### Safety:
18+
19+
This cop is unsafe, because autocorrection change to atomic processing.
20+
The atomic processing of the replacement destination is not guaranteed
21+
to be strictly equivalent to that before the replacement.
22+
23+
### Example:
24+
# bad
25+
unless FileTest.exist?(path)
26+
FileUtils.makedirs(path)
27+
end
28+
29+
if FileTest.exist?(path)
30+
FileUtils.remove(path)
31+
end
32+
33+
# good
34+
FileUtils.mkdir_p(path)
35+
36+
FileUtils.rm_rf(path)

0 commit comments

Comments
 (0)