Skip to content

Commit 5f7b21b

Browse files
committed
Update rubocop to 1.71, rubocop-rspec to 3.4
This also lets us drop the Ruby 3.0 requirement for rubocop on CI, since we can now use rubocop on all released Ruby versions. Further, turn off some of the newly introduced cops that seem to add unnecessary noise, and opt in to new cops by default (this avoids a warning, and seems fine since we lock the rubocop version). Also, drop inline disabling of the "Lint/EmptyWhen" lint, which is no longer needed.
1 parent 479d42e commit 5f7b21b

File tree

5 files changed

+65
-35
lines changed

5 files changed

+65
-35
lines changed

Diff for: .github/workflows/ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,3 @@ jobs:
2828
run: bundle exec rake test
2929
- name: RuboCop
3030
run: bundle exec rake lint
31-
if: matrix.ruby == '3.0'

Diff for: .rubocop.yml

+36-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
require: rubocop-rspec
22

33
AllCops:
4+
NewCops: enable
45
Exclude:
56
- ext/pg_query/extconf.rb
67
- vendor/**/*
@@ -9,46 +10,59 @@ AllCops:
910
- lib/pg_query/json_field_names.rb
1011
- Rakefile
1112

12-
Layout/AlignHash:
13+
Layout/HashAlignment:
1314
Exclude:
1415
- spec/**/*
1516

16-
Style/WordArray:
17+
Layout/SpaceAroundOperators:
1718
Exclude:
1819
- spec/**/*
1920

20-
Style/StringLiterals:
21+
Layout/SpaceInsideHashLiteralBraces:
2122
Exclude:
2223
- spec/**/*
2324

24-
Layout/SpaceAroundOperators:
25+
Style/WordArray:
2526
Exclude:
2627
- spec/**/*
2728

28-
Layout/SpaceInsideHashLiteralBraces:
29+
Style/StringLiterals:
2930
Exclude:
3031
- spec/**/*
3132

32-
Performance/RegexpMatch:
33-
Exclude:
34-
- ext/pg_query/extconf.rb
33+
Layout/LineLength:
34+
Enabled: false
35+
36+
Layout/EmptyLineAfterGuardClause:
37+
Enabled: false
38+
39+
Style/FormatStringToken:
40+
Enabled: false
41+
42+
Style/StringConcatenation:
43+
Enabled: false
44+
45+
Style/IfUnlessModifier:
46+
Enabled: false
3547

3648
Style/FrozenStringLiteralComment:
3749
Enabled: false
3850

3951
Style/SafeNavigation:
4052
Enabled: false
4153

42-
Documentation:
54+
Style/Documentation:
4355
Enabled: false
4456

45-
LineLength:
57+
# extend self preserves private methods,
58+
# module_function buggily removes them.
59+
Style/ModuleFunction:
4660
Enabled: false
4761

48-
MethodLength:
62+
Metrics/MethodLength:
4963
Enabled: false
5064

51-
ClassLength:
65+
Metrics/ClassLength:
5266
Enabled: false
5367

5468
Metrics/AbcSize:
@@ -75,9 +89,16 @@ RSpec/NestedGroups:
7589
RSpec/DescribedClass:
7690
Enabled: false
7791

78-
# extend self preserves private methods,
79-
# module_function buggily removes them.
80-
Style/ModuleFunction:
92+
RSpec/ContextWording:
93+
Enabled: false
94+
95+
RSpec/MatchArray:
96+
Enabled: false
97+
98+
RSpec/NamedSubject:
99+
Enabled: false
100+
101+
RSpec/SpecFilePathFormat:
81102
Enabled: false
82103

83104
Lint/ImplicitStringConcatenation:

Diff for: Gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ gemspec
44

55
gem 'rake-compiler', '~> 0'
66
gem 'rspec', '~> 3.0'
7-
gem 'rubocop', '0.49.1'
8-
gem 'rubocop-rspec', '1.15.1'
7+
gem 'rubocop', '~> 1.71'
8+
gem 'rubocop-rspec', '~> 3.4'
99
gem 'simplecov', '~> 0'

Diff for: Gemfile.lock

+24-14
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,18 @@ GEM
1414
google-protobuf (4.29.3)
1515
bigdecimal
1616
rake (>= 13)
17+
json (2.9.1)
18+
language_server-protocol (3.17.0.4)
1719
parallel (1.26.3)
18-
parser (2.7.2.0)
20+
parser (3.3.7.0)
1921
ast (~> 2.4.1)
20-
powerpack (0.1.3)
21-
rainbow (2.2.2)
22-
rake
22+
racc
23+
racc (1.8.1)
24+
rainbow (3.1.1)
2325
rake (13.2.1)
2426
rake-compiler (0.9.9)
2527
rake
28+
regexp_parser (2.10.0)
2629
rspec (3.13.0)
2730
rspec-core (~> 3.13.0)
2831
rspec-expectations (~> 3.13.0)
@@ -36,23 +39,30 @@ GEM
3639
diff-lcs (>= 1.2.0, < 2.0)
3740
rspec-support (~> 3.13.0)
3841
rspec-support (3.13.2)
39-
rubocop (0.49.1)
42+
rubocop (1.71.2)
43+
json (~> 2.3)
44+
language_server-protocol (>= 3.17.0)
4045
parallel (~> 1.10)
41-
parser (>= 2.3.3.1, < 3.0)
42-
powerpack (~> 0.1)
43-
rainbow (>= 1.99.1, < 3.0)
46+
parser (>= 3.3.0.2)
47+
rainbow (>= 2.2.2, < 4.0)
48+
regexp_parser (>= 2.9.3, < 3.0)
49+
rubocop-ast (>= 1.38.0, < 2.0)
4450
ruby-progressbar (~> 1.7)
45-
unicode-display_width (~> 1.0, >= 1.0.1)
46-
rubocop-rspec (1.15.1)
47-
rubocop (>= 0.42.0)
51+
unicode-display_width (>= 2.4.0, < 4.0)
52+
rubocop-ast (1.38.0)
53+
parser (>= 3.3.1.0)
54+
rubocop-rspec (3.4.0)
55+
rubocop (~> 1.61)
4856
ruby-progressbar (1.13.0)
4957
simplecov (0.22.0)
5058
docile (~> 1.1)
5159
simplecov-html (~> 0.11)
5260
simplecov_json_formatter (~> 0.1)
5361
simplecov-html (0.13.1)
5462
simplecov_json_formatter (0.1.4)
55-
unicode-display_width (1.8.0)
63+
unicode-display_width (3.1.4)
64+
unicode-emoji (~> 4.0, >= 4.0.4)
65+
unicode-emoji (4.0.4)
5666

5767
PLATFORMS
5868
ruby
@@ -61,8 +71,8 @@ DEPENDENCIES
6171
pg_query!
6272
rake-compiler (~> 0)
6373
rspec (~> 3.0)
64-
rubocop (= 0.49.1)
65-
rubocop-rspec (= 1.15.1)
74+
rubocop (~> 1.71)
75+
rubocop-rspec (~> 3.4)
6676
simplecov (~> 0)
6777

6878
BUNDLED WITH

Diff for: lib/pg_query/parse.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def load_objects! # rubocop:disable Metrics/CyclomaticComplexity
174174
# The following statement types are DDL (changing table structure)
175175
when :alter_table_stmt
176176
case statement.alter_table_stmt.objtype
177-
when :OBJECT_INDEX # Index # rubocop:disable Lint/EmptyWhen
177+
when :OBJECT_INDEX # Index
178178
# ignore `ALTER INDEX index_name`
179179
else
180180
from_clause_items << { item: PgQuery::Node.new(range_var: statement.alter_table_stmt.relation), type: :ddl }
@@ -228,11 +228,11 @@ def load_objects! # rubocop:disable Metrics/CyclomaticComplexity
228228
when :grant_stmt
229229
objects = statement.grant_stmt.objects
230230
case statement.grant_stmt.objtype
231-
when :OBJECT_COLUMN # Column # rubocop:disable Lint/EmptyWhen
231+
when :OBJECT_COLUMN # Column
232232
# FIXME
233233
when :OBJECT_TABLE # Table
234234
from_clause_items += objects.map { |o| { item: o, type: :ddl } }
235-
when :OBJECT_SEQUENCE # Sequence # rubocop:disable Lint/EmptyWhen
235+
when :OBJECT_SEQUENCE # Sequence
236236
# FIXME
237237
end
238238
when :lock_stmt

0 commit comments

Comments
 (0)