Skip to content

Commit 7ce4af4

Browse files
committed
update RuboCop, configure new rules, and apply requested code style changes
1 parent 1c83568 commit 7ce4af4

File tree

4 files changed

+41
-11
lines changed

4 files changed

+41
-11
lines changed

.rubocop.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@ require:
33
- rubocop-rspec
44
AllCops:
55
TargetRubyVersion: 2.7
6-
Capybara:
7-
Enabled: false
8-
FactoryBot:
9-
Enabled: false
6+
Gemspec/AddRuntimeDependency:
7+
Enabled: true
108
Gemspec/DeprecatedAttributeAssignment:
119
Enabled: true
1210
Gemspec/DevelopmentDependencies:
@@ -93,6 +91,8 @@ Lint/DuplicateRequire:
9391
Enabled: true
9492
Lint/DuplicateRescueException:
9593
Enabled: true
94+
Lint/DuplicateSetElement:
95+
Enabled: true
9696
Lint/EmptyBlock:
9797
Enabled: true
9898
Lint/EmptyClass:
@@ -111,8 +111,12 @@ Lint/IdentityComparison:
111111
Enabled: true
112112
Lint/IncompatibleIoSelectWithFiberScheduler:
113113
Enabled: true
114+
Lint/ItWithoutArgumentsInBlock:
115+
Enabled: true
114116
Lint/LambdaWithoutLiteralBlock:
115117
Enabled: true
118+
Lint/LiteralAssignmentInCondition:
119+
Enabled: true
116120
Lint/MissingSuper:
117121
Enabled: true
118122
Lint/MixedCaseRange:
@@ -159,6 +163,8 @@ Lint/TrailingCommaInAttributeDeclaration:
159163
Enabled: true
160164
Lint/TripleQuotes:
161165
Enabled: true
166+
Lint/UnescapedBracketInRegexp:
167+
Enabled: true
162168
Lint/UnexpectedBlockArity:
163169
Enabled: true
164170
Lint/UnmodifiedReduceAccumulator:
@@ -169,6 +175,8 @@ Lint/UnusedMethodArgument:
169175
Enabled: true
170176
Lint/UselessMethodDefinition:
171177
Enabled: true
178+
Lint/UselessNumericOperation:
179+
Enabled: true
172180
Lint/UselessRescue:
173181
Enabled: true
174182
Lint/UselessRuby2Keywords:
@@ -254,7 +262,7 @@ RSpec/ExcessiveDocstringSpacing:
254262
Enabled: true
255263
RSpec/ExpectInHook:
256264
Enabled: true
257-
RSpec/FilePath:
265+
RSpec/SpecFilePathFormat:
258266
Enabled: false
259267
RSpec/IdenticalEqualityAssertion:
260268
Enabled: true
@@ -273,8 +281,6 @@ RSpec/Pending:
273281
Enabled: true
274282
RSpec/PendingWithoutReason:
275283
Enabled: true
276-
RSpec/Rails:
277-
Enabled: false
278284
RSpec/ReceiveMessages:
279285
Enabled: true
280286
RSpec/RedundantAround:
@@ -283,6 +289,8 @@ RSpec/SkipBlockInsideExample:
283289
Enabled: true
284290
RSpec/SortMetadata:
285291
Enabled: true
292+
RSpec/StringAsInstanceDoubleConstant:
293+
Enabled: true
286294
RSpec/SubjectDeclaration:
287295
Enabled: true
288296
RSpec/VerifiedDoubleReference:
@@ -301,6 +309,8 @@ Style/AccessorGrouping:
301309
Style/Alias:
302310
Enabled: true
303311
EnforcedStyle: prefer_alias
312+
Style/AmbiguousEndlessMethodDefinition:
313+
Enabled: true
304314
Style/ArgumentsForwarding:
305315
Enabled: true
306316
Style/ArrayCoercion:
@@ -313,6 +323,8 @@ Style/Attr:
313323
Enabled: true
314324
Style/BisectedAttrAccessor:
315325
Enabled: true
326+
Style/BitwisePredicate:
327+
Enabled: true
316328
Style/BlockComments:
317329
Enabled: true
318330
Style/BlockDelimiters:
@@ -329,6 +341,8 @@ Style/ClassVars:
329341
Enabled: false # reason: an important language feature
330342
Style/CollectionCompact:
331343
Enabled: true
344+
Style/CombinableDefined:
345+
Enabled: true
332346
Style/CombinableLoops:
333347
Enabled: true
334348
Style/CommandLiteral:
@@ -419,12 +433,16 @@ Style/InPatternThen:
419433
Enabled: true
420434
Style/InfiniteLoop:
421435
Enabled: false # reason: loop is measurably slower than while true
436+
Style/KeywordArgumentsMerging:
437+
Enabled: true
422438
Style/KeywordParametersOrder:
423439
Enabled: true
424440
Style/MagicCommentFormat:
425441
Enabled: true
426442
Style/MapCompactWithConditionalBlock:
427443
Enabled: true
444+
Style/MapIntoArray:
445+
Enabled: true
428446
Style/MapToHash:
429447
Enabled: false # reason: not supported in JRuby < 9.3
430448
Style/MapToSet:
@@ -513,6 +531,8 @@ Style/RedundantHeredocDelimiterQuotes:
513531
Enabled: false # reason: we want to be explicit about when no interpolation should be performed
514532
Style/RedundantInitialize:
515533
Enabled: true
534+
Style/RedundantInterpolationUnfreeze:
535+
Enabled: true
516536
Style/RedundantLineContinuation:
517537
Enabled: true
518538
Style/RedundantPercentQ:
@@ -544,10 +564,16 @@ Style/MissingRespondToMissing:
544564
Enabled: true
545565
Style/SafeNavigation:
546566
Enabled: true
567+
Style/SafeNavigationChainLength:
568+
Enabled: true
547569
Style/SelectByRegexp:
548570
Enabled: true
571+
Style/SendWithLiteralMethodName:
572+
Enabled: true
549573
Style/SingleArgumentDig:
550574
Enabled: true
575+
Style/SingleLineDoEndBlock:
576+
Enabled: true
551577
Style/SlicingWithRange:
552578
Enabled: false # reason: not supported in JRuby < 9.3
553579
Style/SoleNestedConditional:
@@ -561,6 +587,10 @@ Style/StringChars:
561587
Enabled: true
562588
Style/StringConcatenation:
563589
Enabled: false # reason: string concatenation can be faster
590+
Style/SuperArguments:
591+
Enabled: true
592+
Style/SuperWithArgsParentheses:
593+
Enabled: true
564594
Style/SwapValues:
565595
Enabled: true
566596
Style/SymbolArray:

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ group :coverage do
1010
end
1111

1212
group :lint do
13-
gem 'rubocop', '~> 1.55.0', require: false
13+
gem 'rubocop', '~> 1.68.0', require: false
1414
gem 'rubocop-rake', '~> 0.6.0', require: false
15-
gem 'rubocop-rspec', '~> 2.23.0', require: false
15+
gem 'rubocop-rspec', '~> 3.2.0', require: false
1616
end

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
RSpec.configure do
1717
def create_class super_class = Object, &block
1818
klass = Class.new super_class, &block
19-
Object.const_set %(AnonymousClass#{klass.object_id}).to_sym, klass
19+
Object.const_set :"AnonymousClass#{klass.object_id}", klass
2020
klass
2121
end
2222

spec/tabs_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@
482482
it 'should use anchor for tab ID if converter does not support id property on list item' do
483483
backend = nil
484484
create_class (Asciidoctor::Converter.for 'html5') do
485-
register_for (backend = %(#{object_id}html5).to_sym)
485+
register_for (backend = :"#{object_id}html5")
486486
def convert_ulist node
487487
super.gsub %r/<li id="[^"]+"/, '<li'
488488
end

0 commit comments

Comments
 (0)