Skip to content

Commit 7f81987

Browse files
committed
fix: rubocop config fixes
Fixes based on [failures](https://github.com/procore-oss/ruby-sdk/actions/runs/14200642357/job/39786502330?pr=81#step:6:5) There is also a warning when you run `COVERAGE=true bundle exec rake` about many new cops available. That's for another PR - [x] added .tool-versions (asdf) to gitignore Signed-off-by: jmeridth <[email protected]>
1 parent 5deeec2 commit 7f81987

File tree

2 files changed

+88
-87
lines changed

2 files changed

+88
-87
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.yardopts
22

3+
.tool-versions
4+
35
/.bundle/
46
/.yardoc
57
/Gemfile.lock

.rubocop.yml

Lines changed: 86 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require:
1+
plugins:
22
- rubocop-rails
33
- rubocop-performance
44

@@ -37,6 +37,13 @@ Style/AsciiComments:
3737
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
3838
Enabled: false
3939

40+
Style/Sample:
41+
Description: >-
42+
Use `sample` instead of `shuffle.first`,
43+
`shuffle.last`, and `shuffle[Fixnum]`.
44+
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
45+
Enabled: false
46+
4047
Naming/AsciiIdentifiers:
4148
Description: 'Use only ascii symbols in identifiers.'
4249
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
@@ -97,30 +104,29 @@ Style/ColonMethodCall:
97104

98105
Style/CommentAnnotation:
99106
Description: >-
100-
Checks formatting of special comments
101-
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
107+
Checks formatting of special comments
108+
(TODO, FIXME, OPTIMIZE, HACK, REVIEW).
102109
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
103110
Enabled: false
104111

105112
Metrics/AbcSize:
106113
Description: >-
107-
A calculated magnitude based on number of assignments,
108-
branches, and conditions.
114+
A calculated magnitude based on number of assignments,
115+
branches, and conditions.
109116
Enabled: false
110117

111118
Metrics/BlockLength:
112119
Enabled: false
113-
CountComments: true # count full line comments?
120+
CountComments: true # count full line comments?
114121
Max: 25
115-
ExcludedMethods: []
116122
Exclude:
117-
- "**/*.rake"
118-
- "spec/**/*"
123+
- '**/*.rake'
124+
- 'spec/**/*'
119125

120126
Metrics/CyclomaticComplexity:
121127
Description: >-
122-
A complexity metric that is strongly correlated to the number
123-
of test cases needed to validate a method.
128+
A complexity metric that is strongly correlated to the number
129+
of test cases needed to validate a method.
124130
Enabled: false
125131

126132
Rails/Delegate:
@@ -172,11 +178,6 @@ Style/FrozenStringLiteralComment:
172178
to help transition from Ruby 2.3.0 to Ruby 3.0.
173179
Enabled: false
174180

175-
Style/FlipFlop:
176-
Description: 'Checks for flip flops'
177-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
178-
Enabled: false
179-
180181
Style/FormatString:
181182
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
182183
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
@@ -195,8 +196,8 @@ Style/GuardClause:
195196

196197
Style/IfUnlessModifier:
197198
Description: >-
198-
Favor modifier if/unless usage when you have a
199-
single-line body.
199+
Favor modifier if/unless usage when you have a
200+
single-line body.
200201
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
201202
Enabled: false
202203

@@ -221,15 +222,10 @@ Style/LambdaCall:
221222

222223
Style/LineEndConcatenation:
223224
Description: >-
224-
Use \ instead of + or << to concatenate two string literals at
225-
line end.
225+
Use \ instead of + or << to concatenate two string literals at
226+
line end.
226227
Enabled: false
227228

228-
Metrics/LineLength:
229-
Description: 'Limit lines to 80 characters.'
230-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
231-
Max: 150
232-
233229
Metrics/MethodLength:
234230
Description: 'Avoid methods longer than 10 lines of code.'
235231
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
@@ -247,8 +243,8 @@ Style/MultilineBlockChain:
247243

248244
Style/NegatedIf:
249245
Description: >-
250-
Favor unless over if for negative conditions
251-
(or control flow or).
246+
Favor unless over if for negative conditions
247+
(or control flow or).
252248
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
253249
Enabled: false
254250

@@ -274,15 +270,15 @@ Style/Not:
274270

275271
Style/NumericLiterals:
276272
Description: >-
277-
Add underscores to large numeric literals to improve their
278-
readability.
273+
Add underscores to large numeric literals to improve their
274+
readability.
279275
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
280276
Enabled: false
281277

282278
Style/OneLineConditional:
283279
Description: >-
284-
Favor the ternary operator(?:) over
285-
if/then/else/end constructs.
280+
Favor the ternary operator(?:) over
281+
if/then/else/end constructs.
286282
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
287283
Enabled: false
288284

@@ -331,8 +327,8 @@ Style/RegexpLiteral:
331327

332328
Style/SelfAssignment:
333329
Description: >-
334-
Checks for places where self-assignment shorthand should have
335-
been used.
330+
Checks for places where self-assignment shorthand should have
331+
been used.
336332
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
337333
Enabled: false
338334

@@ -399,8 +395,8 @@ Style/TrivialAccessors:
399395

400396
Style/VariableInterpolation:
401397
Description: >-
402-
Don't interpolate global, instance and class variables
403-
directly in strings.
398+
Don't interpolate global, instance and class variables
399+
directly in strings.
404400
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
405401
Enabled: false
406402

@@ -411,8 +407,8 @@ Style/WhenThen:
411407

412408
Style/WhileUntilModifier:
413409
Description: >-
414-
Favor modifier while/until usage when you have a
415-
single-line body.
410+
Favor modifier while/until usage when you have a
411+
single-line body.
416412
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
417413
Enabled: false
418414

@@ -446,6 +442,13 @@ Layout/ParameterAlignment:
446442
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
447443
Enabled: false
448444

445+
Layout/ConditionPosition:
446+
Description: >-
447+
Checks for condition placed in a confusing position relative to
448+
the keyword.
449+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
450+
Enabled: false
451+
449452
Layout/DotPosition:
450453
Description: 'Checks the position of the dot in multi-line method calls.'
451454
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
@@ -455,17 +458,22 @@ Layout/ExtraSpacing:
455458
Description: 'Do not use unnecessary spacing.'
456459
Enabled: true
457460

461+
Layout/LineLength:
462+
Description: 'Limit lines to 80 characters.'
463+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
464+
Max: 150
465+
458466
Layout/MultilineOperationIndentation:
459467
Description: >-
460-
Checks indentation of binary operations that span more than
461-
one line.
468+
Checks indentation of binary operations that span more than
469+
one line.
462470
Enabled: true
463471
EnforcedStyle: indented
464472

465473
Layout/MultilineMethodCallIndentation:
466474
Description: >-
467-
Checks indentation of method calls with the dot operator
468-
that span more than one line.
475+
Checks indentation of method calls with the dot operator
476+
that span more than one line.
469477
Enabled: true
470478
EnforcedStyle: indented
471479

@@ -478,31 +486,24 @@ Layout/InitialIndentation:
478486

479487
Lint/AmbiguousOperator:
480488
Description: >-
481-
Checks for ambiguous operators in the first argument of a
482-
method invocation without parentheses.
489+
Checks for ambiguous operators in the first argument of a
490+
method invocation without parentheses.
483491
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
484492
Enabled: false
485493

486494
Lint/AmbiguousRegexpLiteral:
487495
Description: >-
488-
Checks for ambiguous regexp literals in the first argument of
489-
a method invocation without parenthesis.
496+
Checks for ambiguous regexp literals in the first argument of
497+
a method invocation without parenthesis.
490498
Enabled: false
491499

492500
Lint/AssignmentInCondition:
493-
Description: "Don't use assignment in conditions."
501+
Description: 'Don't use assignment in conditions.'
494502
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
495503
Enabled: false
496504

497505
Lint/CircularArgumentReference:
498-
Description: "Don't refer to the keyword argument in the default value."
499-
Enabled: false
500-
501-
Lint/ConditionPosition:
502-
Description: >-
503-
Checks for condition placed in a confusing position relative to
504-
the keyword.
505-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
506+
Description: 'Don't refer to the keyword argument in the default value.'
506507
Enabled: false
507508

508509
Lint/DeprecatedClassMethods:
@@ -521,12 +522,17 @@ Lint/ElseLayout:
521522
Description: 'Check for odd code arrangement in an else block.'
522523
Enabled: false
523524

525+
Lint/FlipFlop:
526+
Description: 'Checks for flip flops'
527+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
528+
Enabled: false
529+
524530
Lint/FormatParameterMismatch:
525531
Description: 'The number of parameters to format/sprint must match the fields.'
526532
Enabled: false
527533

528534
Lint/SuppressedException:
529-
Description: "Don't suppress exception."
535+
Description: 'Don't suppress exception.'
530536
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
531537
Enabled: false
532538

@@ -536,8 +542,8 @@ Lint/LiteralInInterpolation:
536542

537543
Lint/Loop:
538544
Description: >-
539-
Use Kernel#loop with break rather than begin/end/until or
540-
begin/end/while for post-loop tests.
545+
Use Kernel#loop with break rather than begin/end/until or
546+
begin/end/while for post-loop tests.
541547
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
542548
Enabled: false
543549

@@ -552,15 +558,15 @@ Lint/NonLocalExitFromIterator:
552558

553559
Lint/ParenthesesAsGroupedExpression:
554560
Description: >-
555-
Checks for method calls with a space before the opening
556-
parenthesis.
561+
Checks for method calls with a space before the opening
562+
parenthesis.
557563
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
558564
Enabled: false
559565

560566
Lint/RequireParentheses:
561567
Description: >-
562-
Use parentheses in the method call to avoid confusion
563-
about precedence.
568+
Use parentheses in the method call to avoid confusion
569+
about precedence.
564570
Enabled: false
565571

566572
Lint/UnderscorePrefixedVariableName:
@@ -575,29 +581,29 @@ Lint/Void:
575581

576582
Performance/CaseWhenSplat:
577583
Description: >-
578-
Place `when` conditions that use splat at the end
579-
of the list of `when` branches.
584+
Place `when` conditions that use splat at the end
585+
of the list of `when` branches.
580586
Enabled: false
581587

582588
Performance/Count:
583589
Description: >-
584-
Use `count` instead of `select...size`, `reject...size`,
585-
`select...count`, `reject...count`, `select...length`,
586-
and `reject...length`.
590+
Use `count` instead of `select...size`, `reject...size`,
591+
`select...count`, `reject...count`, `select...length`,
592+
and `reject...length`.
587593
Enabled: false
588594

589595
Performance/Detect:
590596
Description: >-
591-
Use `detect` instead of `select.first`, `find_all.first`,
592-
`select.last`, and `find_all.last`.
597+
Use `detect` instead of `select.first`, `find_all.first`,
598+
`select.last`, and `find_all.last`.
593599
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
594600
Enabled: false
595601

596602
Performance/FlatMap:
597603
Description: >-
598-
Use `Enumerable#flat_map`
599-
instead of `Enumerable#map...Array#flatten(1)`
600-
or `Enumberable#collect..Array#flatten(1)`
604+
Use `Enumerable#flat_map`
605+
instead of `Enumerable#map...Array#flatten(1)`
606+
or `Enumberable#collect..Array#flatten(1)`
601607
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
602608
Enabled: false
603609

@@ -606,25 +612,18 @@ Performance/ReverseEach:
606612
Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
607613
Enabled: false
608614

609-
Performance/Sample:
610-
Description: >-
611-
Use `sample` instead of `shuffle.first`,
612-
`shuffle.last`, and `shuffle[Fixnum]`.
613-
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
614-
Enabled: false
615-
616615
Performance/Size:
617616
Description: >-
618-
Use `size` instead of `count` for counting
619-
the number of elements in `Array` and `Hash`.
617+
Use `size` instead of `count` for counting
618+
the number of elements in `Array` and `Hash`.
620619
Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
621620
Enabled: false
622621

623622
Performance/StringReplacement:
624623
Description: >-
625-
Use `tr` instead of `gsub` when you are replacing the same
626-
number of characters. Use `delete` instead of `gsub` when
627-
you are deleting characters.
624+
Use `tr` instead of `gsub` when you are replacing the same
625+
number of characters. Use `delete` instead of `gsub` when
626+
you are deleting characters.
628627
Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
629628
Enabled: false
630629

@@ -636,8 +635,8 @@ Rails/ActionFilter:
636635

637636
Rails/Date:
638637
Description: >-
639-
Checks the correct usage of date aware methods,
640-
such as Date.today, Date.current etc.
638+
Checks the correct usage of date aware methods,
639+
such as Date.today, Date.current etc.
641640
Enabled: false
642641

643642
Rails/FindBy:
@@ -658,8 +657,8 @@ Rails/Output:
658657

659658
Rails/ReadWriteAttribute:
660659
Description: >-
661-
Checks for read_attribute(:attr) and
662-
write_attribute(:attr, val).
660+
Checks for read_attribute(:attr) and
661+
write_attribute(:attr, val).
663662
Enabled: false
664663

665664
Rails/ScopeArgs:

0 commit comments

Comments
 (0)