Skip to content

Commit 39b5890

Browse files
committed
Update rubocop to 1.55.1 and ruby to 3.2.2
Ruby 2 is EOL, and can have trouble installnig on modern systems. - Updated ruby in .ruby-version and Dockerfile. - No need to install an old version of bundler in Dockerfile. - Removed the standard gem (see #357). - General bundle update. - Updated docs.
1 parent 95784bc commit 39b5890

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+465
-134
lines changed

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.6
1+
3.2.2

Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM ruby:2.7-alpine3.11
1+
FROM ruby:3.2-alpine3.18
22

3-
LABEL name="Ruby-2.7" \
3+
LABEL name="Ruby-3.2" \
44
version="1.0"
55

66
WORKDIR /usr/src/app
@@ -10,7 +10,6 @@ RUN adduser -u 9000 -D app
1010
COPY Gemfile Gemfile.lock /usr/src/app/
1111

1212
RUN apk add --update build-base git && \
13-
gem install bundler -v 2.0.2 && \
1413
bundle install --quiet -j 4 && \
1514
chown -R app:app /usr/local/bundle && \
1615
rm -fr ~/.gem ~/.bundle ~/.wh..gem && \

Gemfile

+1-2
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.50.2", require: false
8+
gem "rubocop", "1.55.1", require: false
99
gem "rubocop-i18n", require: false
1010
gem "rubocop-graphql", require: false
1111
gem "rubocop-minitest", require: false
@@ -17,7 +17,6 @@ gem "rubocop-sequel", require: false
1717
gem "rubocop-shopify", require: false
1818
gem "rubocop-sorbet", require: false
1919
gem "rubocop-thread_safety", require: false
20-
gem "standard", ">= 1.0", require: false
2120
gem "test-prof", require: false
2221

2322
group :test do

Gemfile.lock

+26-36
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
activesupport (7.0.4.3)
4+
activesupport (7.0.6)
55
concurrent-ruby (~> 1.0, >= 1.0.2)
66
i18n (>= 1.6, < 2)
77
minitest (>= 5.1)
@@ -10,24 +10,25 @@ GEM
1010
coderay (1.1.3)
1111
concurrent-ruby (1.2.2)
1212
diff-lcs (1.5.0)
13-
i18n (1.13.0)
13+
i18n (1.14.1)
1414
concurrent-ruby (~> 1.0)
1515
json (2.6.3)
1616
language_server-protocol (3.17.0.3)
17-
lint_roller (1.0.0)
1817
method_source (1.0.0)
19-
minitest (5.18.0)
18+
minitest (5.19.0)
2019
parallel (1.23.0)
21-
parser (3.2.2.1)
20+
parser (3.2.2.3)
2221
ast (~> 2.4.1)
22+
racc
2323
pry (0.14.2)
2424
coderay (~> 1.1)
2525
method_source (~> 1.0)
26-
rack (3.0.7)
26+
racc (1.7.1)
27+
rack (3.0.8)
2728
rainbow (3.1.1)
2829
rake (13.0.6)
29-
regexp_parser (2.8.0)
30-
rexml (3.2.5)
30+
regexp_parser (2.8.1)
31+
rexml (3.2.6)
3132
rspec (3.12.0)
3233
rspec-core (~> 3.12.0)
3334
rspec-expectations (~> 3.12.0)
@@ -37,66 +38,56 @@ GEM
3738
rspec-expectations (3.12.3)
3839
diff-lcs (>= 1.2.0, < 2.0)
3940
rspec-support (~> 3.12.0)
40-
rspec-mocks (3.12.5)
41+
rspec-mocks (3.12.6)
4142
diff-lcs (>= 1.2.0, < 2.0)
4243
rspec-support (~> 3.12.0)
43-
rspec-support (3.12.0)
44-
rubocop (1.50.2)
44+
rspec-support (3.12.1)
45+
rubocop (1.55.1)
4546
json (~> 2.3)
47+
language_server-protocol (>= 3.17.0)
4648
parallel (~> 1.10)
47-
parser (>= 3.2.0.0)
49+
parser (>= 3.2.2.3)
4850
rainbow (>= 2.2.2, < 4.0)
4951
regexp_parser (>= 1.8, < 3.0)
5052
rexml (>= 3.2.5, < 4.0)
51-
rubocop-ast (>= 1.28.0, < 2.0)
53+
rubocop-ast (>= 1.28.1, < 2.0)
5254
ruby-progressbar (~> 1.7)
5355
unicode-display_width (>= 2.4.0, < 3.0)
54-
rubocop-ast (1.28.1)
56+
rubocop-ast (1.29.0)
5557
parser (>= 3.2.1.0)
5658
rubocop-capybara (2.18.0)
5759
rubocop (~> 1.41)
58-
rubocop-factory_bot (2.22.0)
60+
rubocop-factory_bot (2.23.1)
5961
rubocop (~> 1.33)
60-
rubocop-graphql (1.1.1)
62+
rubocop-graphql (1.3.0)
6163
rubocop (>= 0.87, < 2)
6264
rubocop-i18n (3.0.0)
6365
rubocop (~> 1.0)
6466
rubocop-minitest (0.31.0)
6567
rubocop (>= 1.39, < 2.0)
66-
rubocop-performance (1.16.0)
68+
rubocop-performance (1.18.0)
6769
rubocop (>= 1.7.0, < 2.0)
6870
rubocop-ast (>= 0.4.0)
69-
rubocop-rails (2.19.1)
71+
rubocop-rails (2.20.2)
7072
activesupport (>= 4.2.0)
7173
rack (>= 1.1)
7274
rubocop (>= 1.33.0, < 2.0)
7375
rubocop-rake (0.6.0)
7476
rubocop (~> 1.0)
75-
rubocop-rspec (2.22.0)
77+
rubocop-rspec (2.23.0)
7678
rubocop (~> 1.33)
7779
rubocop-capybara (~> 2.17)
7880
rubocop-factory_bot (~> 2.22)
7981
rubocop-sequel (0.3.4)
8082
rubocop (~> 1.0)
81-
rubocop-shopify (2.13.0)
82-
rubocop (~> 1.50)
83+
rubocop-shopify (2.14.0)
84+
rubocop (~> 1.51)
8385
rubocop-sorbet (0.7.0)
8486
rubocop (>= 0.90.0)
8587
rubocop-thread_safety (0.5.1)
8688
rubocop (>= 0.90.0)
8789
ruby-progressbar (1.13.0)
88-
standard (1.28.2)
89-
language_server-protocol (~> 3.17.0.2)
90-
lint_roller (~> 1.0)
91-
rubocop (~> 1.50.2)
92-
standard-custom (~> 1.0.0)
93-
standard-performance (~> 1.0.1)
94-
standard-custom (1.0.0)
95-
lint_roller (~> 1.0)
96-
standard-performance (1.0.1)
97-
lint_roller (~> 1.0)
98-
rubocop-performance (~> 1.16.0)
99-
test-prof (1.2.1)
90+
test-prof (1.2.2)
10091
tzinfo (2.0.6)
10192
concurrent-ruby (~> 1.0)
10293
unicode-display_width (2.4.2)
@@ -110,7 +101,7 @@ DEPENDENCIES
110101
pry
111102
rake
112103
rspec
113-
rubocop (= 1.50.2)
104+
rubocop (= 1.55.1)
114105
rubocop-graphql
115106
rubocop-i18n
116107
rubocop-minitest
@@ -122,8 +113,7 @@ DEPENDENCIES
122113
rubocop-shopify
123114
rubocop-sorbet
124115
rubocop-thread_safety
125-
standard (>= 1.0)
126116
test-prof
127117

128118
BUNDLED WITH
129-
2.1.4
119+
2.4.10

config/contents/bundler/ordered_gems.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ Gems should be alphabetically sorted within groups.
1414

1515
gem 'rspec'
1616

17-
# good only if TreatCommentsAsGroupSeparators is true
17+
### Example: TreatCommentsAsGroupSeparators: true (default)
18+
# good
19+
# For code quality
20+
gem 'rubocop'
21+
# For tests
22+
gem 'rspec'
23+
24+
### Example: TreatCommentsAsGroupSeparators: false
25+
# bad
1826
# For code quality
1927
gem 'rubocop'
2028
# For tests

config/contents/gemspec/ordered_dependencies.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ Dependencies in the gemspec should be alphabetically sorted.
4040

4141
spec.add_runtime_dependency 'rspec'
4242

43-
# good only if TreatCommentsAsGroupSeparators is true
43+
### Example: TreatCommentsAsGroupSeparators: true (default)
44+
# good
45+
# For code quality
46+
spec.add_dependency 'rubocop'
47+
# For tests
48+
spec.add_dependency 'rspec'
49+
50+
### Example: TreatCommentsAsGroupSeparators: false
51+
# bad
4452
# For code quality
4553
spec.add_dependency 'rubocop'
4654
# For tests

config/contents/layout/class_structure.md

+8
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ automatically.
6161
- extend
6262
```
6363
64+
### Safety:
65+
66+
Autocorrection is unsafe because class methods and module inclusion
67+
can behave differently, based on which methods or constants have
68+
already been defined.
69+
70+
Constants will only be moved when they are assigned with literals.
71+
6472
### Example:
6573
# bad
6674
# Expect extend be before constant

config/contents/layout/closing_heredoc_indentation.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Checks the indentation of here document closings.
32

43
### Example:

config/contents/layout/space_around_method_call_operator.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Checks method call operators to not have spaces around them.
1414
foo &. bar
1515
foo &. bar&. buzz
1616
RuboCop:: Cop
17-
RuboCop:: Cop:: Cop
17+
RuboCop:: Cop:: Base
1818
:: RuboCop::Cop
1919

2020
# good
@@ -26,5 +26,5 @@ Checks method call operators to not have spaces around them.
2626
foo&.bar
2727
foo&.bar&.buzz
2828
RuboCop::Cop
29-
RuboCop::Cop::Cop
29+
RuboCop::Cop::Base
3030
::RuboCop::Cop

config/contents/lint/duplicate_hash_key.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Checks for duplicated keys in hash literals.
2+
This cop considers both primitive types and constants for the hash keys.
23

34
This cop mirrors a warning in Ruby 2.2.
45

config/contents/lint/erb_new_arguments.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
2-
This cop emulates the following Ruby warnings in Ruby 2.6.
1+
Emulates the following Ruby warnings in Ruby 2.6.
32

43
```console
5-
% cat example.rb
4+
$ cat example.rb
65
ERB.new('hi', nil, '-', '@output_buffer')
7-
% ruby -rerb example.rb
6+
$ ruby -rerb example.rb
87
example.rb:1: warning: Passing safe_level with the 2nd argument of ERB.new is
98
deprecated. Do not use it, and specify other arguments as keyword arguments.
109
example.rb:1: warning: Passing trim_mode with the 3rd argument of ERB.new is

config/contents/lint/identity_comparison.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Prefer `equal?` over `==` when comparing `object_id`.
32

43
`Object#equal?` is provided to compare objects for identity, and in contrast

config/contents/lint/incompatible_io_select_with_fiber_scheduler.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
Checks for `IO.select` that is incompatible with Fiber Scheduler since Ruby 3.0.
12

2-
This cop checks for `IO.select` that is incompatible with Fiber Scheduler since Ruby 3.0.
3+
When an array of IO objects waiting for an exception (the third argument of `IO.select`)
4+
is used as an argument, there is no alternative API, so offenses are not registered.
35

46
NOTE: When the method is successful the return value of `IO.select` is `[[IO]]`,
57
and the return value of `io.wait_readable` and `io.wait_writable` are `self`.

config/contents/lint/lambda_without_literal_block.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Checks uses of lambda without a literal block.
22
It emulates the following warning in Ruby 3.0:
33

4-
% ruby -vwe 'lambda(&proc {})'
4+
$ ruby -vwe 'lambda(&proc {})'
55
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
66
-e:1: warning: lambda without a literal block is deprecated; use the proc without
77
lambda instead

config/contents/lint/missing_super.md

+25
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ because in some cases it makes sense to overtake what is considered a
66
missing method. In other cases, the theoretical ideal handling could be
77
challenging or verbose for no actual gain.
88

9+
Autocorrection is not supported because the position of `super` cannot be
10+
determined automatically.
11+
12+
`Object` and `BasicObject` are allowed by this cop because of their
13+
stateless nature. However, sometimes you might want to allow other parent
14+
classes from this cop, for example in the case of an abstract class that is
15+
not meant to be called with `super`. In those cases, you can use the
16+
`AllowedParentClasses` option to specify which classes should be allowed
17+
*in addition to* `Object` and `BasicObject`.
18+
919
### Example:
1020
# bad
1121
class Employee < Person
@@ -51,3 +61,18 @@ challenging or verbose for no actual gain.
5161
do_something
5262
end
5363
end
64+
65+
# good
66+
class ClassWithNoParent
67+
def initialize
68+
do_something
69+
end
70+
end
71+
72+
### Example: AllowedParentClasses: [MyAbstractClass]
73+
# good
74+
class MyConcreteClass < MyAbstractClass
75+
def initialize
76+
do_something
77+
end
78+
end
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Checks for mixed-case character ranges since they include likely unintended characters.
2+
3+
Offenses are registered for regexp character classes like `/[A-z]/`
4+
as well as range objects like `('A'..'z')`.
5+
6+
NOTE: Range objects cannot be autocorrected.
7+
8+
### Safety:
9+
10+
The cop autocorrects regexp character classes
11+
by replacing one character range with two: `A-z` becomes `A-Za-z`.
12+
In most cases this is probably what was originally intended
13+
but it changes the regexp to no longer match symbols it used to include.
14+
For this reason, this cop's autocorrect is unsafe (it will
15+
change the behavior of the code).
16+
17+
### Example:
18+
19+
# bad
20+
r = /[A-z]/
21+
22+
# good
23+
r = /[A-Za-z]/

config/contents/lint/numbered_parameter_assignment.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Checks for uses of numbered parameter assignment.
22
It emulates the following warning in Ruby 2.7:
33

4-
% ruby -ve '_1 = :value'
4+
$ ruby -ve '_1 = :value'
55
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
66
-e:1: warning: `_1' is reserved for numbered parameter; consider another name
77

88
Assigning to a numbered parameter (from `_1` to `_9`) causes an error in Ruby 3.0.
99

10-
% ruby -ve '_1 = :value'
10+
$ ruby -ve '_1 = :value'
1111
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
1212
-e:1: _1 is reserved for numbered parameter
1313

config/contents/lint/ordered_magic_comments.md

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Checks the proper ordering of magic comments and whether
32
a magic comment is not placed before a shebang.
43

0 commit comments

Comments
 (0)