rubocop-hixonrails 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +0 -3
- data/bin/enable_pending_cops +2 -0
- data/default.yml +394 -61
- data/lib/rubocop_hixonrails.rb +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cc26d43644d5db0875487cb504870fd0603897c2026ee8c7f40305eb1bd53ad
|
4
|
+
data.tar.gz: 1a3d12c3c489d1e83686a41ed34e228c14d98267fae32a20c291ab630243a50f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daf26426cf72234a118921e4c8afbc22fe7d24edcf6fa468e2f06f36719185b97e7fab632d203482a3943fa05076d3ae721c3ca24ad80e0011a8ef7e583c3b09
|
7
|
+
data.tar.gz: 0c9acc8704083ad34f857d83f0d90632e8053cfbfb8e3a343ba975009a01dad1df73d0de54eb31ad5a8d7f44cb348e77229906955e912547a8e69f8c1b86c7c0
|
data/.rubocop.yml
CHANGED
data/bin/enable_pending_cops
CHANGED
data/default.yml
CHANGED
@@ -8,15 +8,6 @@ inherit_mode:
|
|
8
8
|
merge:
|
9
9
|
- Exclude
|
10
10
|
AllCops:
|
11
|
-
RSpec:
|
12
|
-
Patterns:
|
13
|
-
- _spec.rb
|
14
|
-
- "(?:^|/)spec/"
|
15
|
-
RSpec/FactoryBot:
|
16
|
-
Patterns:
|
17
|
-
- spec/factories.rb
|
18
|
-
- spec/factories/**/*.rb
|
19
|
-
- features/support/factories/**/*.rb
|
20
11
|
Exclude:
|
21
12
|
- tmp/**/*
|
22
13
|
- vendor/**/*
|
@@ -56,26 +47,6 @@ Bundler/OrderedGems:
|
|
56
47
|
- "**/*.gemfile"
|
57
48
|
- "**/Gemfile"
|
58
49
|
- "**/gems.rb"
|
59
|
-
Capybara/CurrentPathExpectation:
|
60
|
-
Description: Checks that no expectations are set on Capybara's `current_path`.
|
61
|
-
Enabled: true
|
62
|
-
Capybara/FeatureMethods:
|
63
|
-
Description: Checks for consistent method usage in feature specs.
|
64
|
-
Enabled: true
|
65
|
-
EnabledMethods: []
|
66
|
-
Capybara/VisibilityMatcher:
|
67
|
-
Description: Checks for boolean visibility in capybara finders.
|
68
|
-
Enabled: true
|
69
|
-
FactoryBot/AttributeDefinedStatically:
|
70
|
-
Description: Always declare attribute values as blocks.
|
71
|
-
Enabled: true
|
72
|
-
FactoryBot/CreateList:
|
73
|
-
Description: Checks for create_list usage.
|
74
|
-
Enabled: true
|
75
|
-
EnforcedStyle: create_list
|
76
|
-
FactoryBot/FactoryClassName:
|
77
|
-
Description: Use string value when setting the class attribute explicitly.
|
78
|
-
Enabled: true
|
79
50
|
Gemspec/DuplicatedAssignment:
|
80
51
|
Description: An attribute assignment method calls should be listed only once in
|
81
52
|
a gemspec.
|
@@ -104,23 +75,30 @@ Layout/AccessModifierIndentation:
|
|
104
75
|
Description: Check indentation of private/protected visibility modifiers.
|
105
76
|
Enabled: true
|
106
77
|
EnforcedStyle: indent
|
107
|
-
IndentationWidth:
|
78
|
+
IndentationWidth:
|
108
79
|
Layout/ArgumentAlignment:
|
109
80
|
Description: Align the arguments of a method call if they span more than one line.
|
110
81
|
Enabled: true
|
111
82
|
EnforcedStyle: with_first_argument
|
112
|
-
IndentationWidth:
|
83
|
+
IndentationWidth:
|
113
84
|
Layout/ArrayAlignment:
|
114
85
|
Description: Align the elements of an array literal if they span more than one
|
115
86
|
line.
|
116
87
|
Enabled: true
|
117
88
|
EnforcedStyle: with_first_element
|
118
|
-
IndentationWidth:
|
89
|
+
IndentationWidth:
|
119
90
|
Layout/AssignmentIndentation:
|
120
91
|
Description: Checks the indentation of the first line of the right-hand-side of
|
121
92
|
a multi-line assignment.
|
122
93
|
Enabled: true
|
123
|
-
IndentationWidth:
|
94
|
+
IndentationWidth:
|
95
|
+
Layout/BeginEndAlignment:
|
96
|
+
Description: Align ends corresponding to begins correctly.
|
97
|
+
Enabled: true
|
98
|
+
EnforcedStyleAlignWith: start_of_line
|
99
|
+
SupportedStylesAlignWith:
|
100
|
+
- start_of_line
|
101
|
+
- begin
|
124
102
|
Layout/BlockAlignment:
|
125
103
|
Description: Align block ends correctly.
|
126
104
|
Enabled: true
|
@@ -137,11 +115,11 @@ Layout/CaseIndentation:
|
|
137
115
|
Enabled: true
|
138
116
|
EnforcedStyle: case
|
139
117
|
IndentOneStep: false
|
140
|
-
IndentationWidth:
|
118
|
+
IndentationWidth:
|
141
119
|
Layout/ClassStructure:
|
142
120
|
Description: Enforces a configured order of definitions within a class body.
|
143
|
-
Enabled: true
|
144
121
|
AutoCorrect: false
|
122
|
+
Enabled: true
|
145
123
|
Categories:
|
146
124
|
module_inclusion:
|
147
125
|
- extend
|
@@ -199,7 +177,6 @@ Layout/DefEndAlignment:
|
|
199
177
|
SupportedStylesAlignWith:
|
200
178
|
- start_of_line
|
201
179
|
- def
|
202
|
-
Severity: warning
|
203
180
|
Layout/DotPosition:
|
204
181
|
Description: Checks the position of the dot in multi-line method calls.
|
205
182
|
Enabled: true
|
@@ -226,6 +203,9 @@ Layout/EmptyLineAfterMultilineCondition:
|
|
226
203
|
Layout/EmptyLineBetweenDefs:
|
227
204
|
Description: Use empty lines between defs.
|
228
205
|
Enabled: true
|
206
|
+
EmptyLineBetweenMethodDefs: true
|
207
|
+
EmptyLineBetweenClassDefs: true
|
208
|
+
EmptyLineBetweenModuleDefs: true
|
229
209
|
AllowAdjacentOneLineDefs: false
|
230
210
|
NumberOfEmptyLines: 1
|
231
211
|
Layout/EmptyLines:
|
@@ -278,7 +258,6 @@ Layout/EndAlignment:
|
|
278
258
|
- keyword
|
279
259
|
- variable
|
280
260
|
- start_of_line
|
281
|
-
Severity: warning
|
282
261
|
Layout/EndOfLine:
|
283
262
|
Description: Use Unix-style line endings.
|
284
263
|
Enabled: true
|
@@ -293,12 +272,12 @@ Layout/FirstArgumentIndentation:
|
|
293
272
|
Description: Checks the indentation of the first argument in a method call.
|
294
273
|
Enabled: true
|
295
274
|
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
296
|
-
IndentationWidth:
|
275
|
+
IndentationWidth:
|
297
276
|
Layout/FirstArrayElementIndentation:
|
298
277
|
Description: Checks the indentation of the first element in an array literal.
|
299
278
|
Enabled: true
|
300
279
|
EnforcedStyle: special_inside_parentheses
|
301
|
-
IndentationWidth:
|
280
|
+
IndentationWidth:
|
302
281
|
Layout/FirstArrayElementLineBreak:
|
303
282
|
Description: Checks for a line break before the first element in a multi-line
|
304
283
|
array.
|
@@ -307,7 +286,7 @@ Layout/FirstHashElementIndentation:
|
|
307
286
|
Description: Checks the indentation of the first key in a hash literal.
|
308
287
|
Enabled: true
|
309
288
|
EnforcedStyle: special_inside_parentheses
|
310
|
-
IndentationWidth:
|
289
|
+
IndentationWidth:
|
311
290
|
Layout/FirstHashElementLineBreak:
|
312
291
|
Description: Checks for a line break before the first element in a multi-line
|
313
292
|
hash.
|
@@ -324,7 +303,7 @@ Layout/FirstParameterIndentation:
|
|
324
303
|
Description: Checks the indentation of the first parameter in a method definition.
|
325
304
|
Enabled: true
|
326
305
|
EnforcedStyle: consistent
|
327
|
-
IndentationWidth:
|
306
|
+
IndentationWidth:
|
328
307
|
Layout/HashAlignment:
|
329
308
|
Description: Align the elements of a hash literal if they span more than one line.
|
330
309
|
Enabled: true
|
@@ -361,7 +340,7 @@ Layout/IndentationConsistency:
|
|
361
340
|
Layout/IndentationStyle:
|
362
341
|
Description: Consistent indentation either with tabs only or spaces only.
|
363
342
|
Enabled: true
|
364
|
-
IndentationWidth:
|
343
|
+
IndentationWidth:
|
365
344
|
EnforcedStyle: spaces
|
366
345
|
Layout/IndentationWidth:
|
367
346
|
Description: Use 2 spaces for indentation.
|
@@ -438,7 +417,7 @@ Layout/MultilineMethodCallIndentation:
|
|
438
417
|
more than one line.
|
439
418
|
Enabled: true
|
440
419
|
EnforcedStyle: aligned
|
441
|
-
IndentationWidth:
|
420
|
+
IndentationWidth:
|
442
421
|
Layout/MultilineMethodDefinitionBraceLayout:
|
443
422
|
Description: Checks that the closing brace in a method definition is either on
|
444
423
|
the same line as the last method parameter, or a new line.
|
@@ -448,13 +427,13 @@ Layout/MultilineOperationIndentation:
|
|
448
427
|
Description: Checks indentation of binary operations that span more than one line.
|
449
428
|
Enabled: true
|
450
429
|
EnforcedStyle: aligned
|
451
|
-
IndentationWidth:
|
430
|
+
IndentationWidth:
|
452
431
|
Layout/ParameterAlignment:
|
453
432
|
Description: Align the parameters of a method definition if they span more than
|
454
433
|
one line.
|
455
434
|
Enabled: true
|
456
435
|
EnforcedStyle: with_first_parameter
|
457
|
-
IndentationWidth:
|
436
|
+
IndentationWidth:
|
458
437
|
Layout/RescueEnsureAlignment:
|
459
438
|
Description: Align rescues and ensures correctly.
|
460
439
|
Enabled: true
|
@@ -620,6 +599,11 @@ Lint/CircularArgumentReference:
|
|
620
599
|
Description: Default values in optional keyword arguments and optional ordinal
|
621
600
|
arguments should not refer back to the name of the argument.
|
622
601
|
Enabled: true
|
602
|
+
Lint/ConstantDefinitionInBlock:
|
603
|
+
Description: Do not define constants within a block.
|
604
|
+
Enabled: true
|
605
|
+
AllowedMethods:
|
606
|
+
- enums
|
623
607
|
Lint/ConstantResolution:
|
624
608
|
Description: Check that constants are fully qualified with `::`.
|
625
609
|
Enabled: false
|
@@ -628,6 +612,22 @@ Lint/ConstantResolution:
|
|
628
612
|
Lint/Debugger:
|
629
613
|
Description: Check for debugger calls.
|
630
614
|
Enabled: true
|
615
|
+
DebuggerReceivers:
|
616
|
+
- binding
|
617
|
+
- Kernel
|
618
|
+
- Pry
|
619
|
+
DebuggerMethods:
|
620
|
+
- debugger
|
621
|
+
- byebug
|
622
|
+
- remote_byebug
|
623
|
+
- pry
|
624
|
+
- remote_pry
|
625
|
+
- pry_remote
|
626
|
+
- console
|
627
|
+
- rescue
|
628
|
+
- save_and_open_page
|
629
|
+
- save_and_open_screenshot
|
630
|
+
- irb
|
631
631
|
Lint/DeprecatedClassMethods:
|
632
632
|
Description: Check for deprecated class method calls.
|
633
633
|
Enabled: true
|
@@ -638,6 +638,10 @@ Lint/DisjunctiveAssignmentInConstructor:
|
|
638
638
|
Description: In constructor, plain assignment is preferred over disjunctive.
|
639
639
|
Enabled: true
|
640
640
|
Safe: false
|
641
|
+
Lint/DuplicateBranch:
|
642
|
+
Description: Checks that there are no repeated bodies within `if/unless`, `case-when`
|
643
|
+
and `rescue` constructs.
|
644
|
+
Enabled: true
|
641
645
|
Lint/DuplicateCaseCondition:
|
642
646
|
Description: Do not repeat values in case conditionals.
|
643
647
|
Enabled: true
|
@@ -650,6 +654,9 @@ Lint/DuplicateHashKey:
|
|
650
654
|
Lint/DuplicateMethods:
|
651
655
|
Description: Check for duplicate method definitions.
|
652
656
|
Enabled: true
|
657
|
+
Lint/DuplicateRegexpCharacterClassElement:
|
658
|
+
Description: Checks for duplicate elements in Regexp character classes.
|
659
|
+
Enabled: true
|
653
660
|
Lint/DuplicateRequire:
|
654
661
|
Description: Check for duplicate `require`s and `require_relative`s.
|
655
662
|
Enabled: true
|
@@ -662,6 +669,15 @@ Lint/EachWithObjectArgument:
|
|
662
669
|
Lint/ElseLayout:
|
663
670
|
Description: Check for odd code arrangement in an else block.
|
664
671
|
Enabled: true
|
672
|
+
Lint/EmptyBlock:
|
673
|
+
Description: This cop checks for blocks without a body.
|
674
|
+
Enabled: true
|
675
|
+
AllowComments: true
|
676
|
+
AllowEmptyLambdas: true
|
677
|
+
Lint/EmptyClass:
|
678
|
+
Description: Checks for classes and metaclasses without a body.
|
679
|
+
Enabled: true
|
680
|
+
AllowComments: false
|
665
681
|
Lint/EmptyConditionalBody:
|
666
682
|
Description: This cop checks for the presence of `if`, `elsif` and `unless` branches
|
667
683
|
without a body.
|
@@ -702,10 +718,18 @@ Lint/FloatOutOfRange:
|
|
702
718
|
Lint/FormatParameterMismatch:
|
703
719
|
Description: The number of parameters to format/sprint must match the fields.
|
704
720
|
Enabled: true
|
721
|
+
Lint/HashCompareByIdentity:
|
722
|
+
Description: Prefer using `Hash#compare_by_identity` than using `object_id` for
|
723
|
+
keys.
|
724
|
+
Enabled: true
|
725
|
+
Safe: false
|
705
726
|
Lint/HeredocMethodCallPosition:
|
706
727
|
Description: Checks for the ordering of a method call where the receiver of the
|
707
728
|
call is a HEREDOC.
|
708
729
|
Enabled: false
|
730
|
+
Lint/IdentityComparison:
|
731
|
+
Description: Prefer `equal?` over `==` when comparing `object_id`.
|
732
|
+
Enabled: true
|
709
733
|
Lint/ImplicitStringConcatenation:
|
710
734
|
Description: Checks for adjacent string literals on the same line, which could
|
711
735
|
better be represented as a single string literal.
|
@@ -732,6 +756,7 @@ Lint/Loop:
|
|
732
756
|
Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
|
733
757
|
for post-loop tests.
|
734
758
|
Enabled: true
|
759
|
+
Safe: false
|
735
760
|
Lint/MissingCopEnableDirective:
|
736
761
|
Description: Checks for a `# rubocop:enable` after `# rubocop:disable`.
|
737
762
|
Enabled: true
|
@@ -746,6 +771,7 @@ Lint/MixedRegexpCaptureTypes:
|
|
746
771
|
Lint/MultipleComparison:
|
747
772
|
Description: Use `&&` operator to compare multiple values.
|
748
773
|
Enabled: true
|
774
|
+
AllowMethodComparison: true
|
749
775
|
Lint/NestedMethodDefinition:
|
750
776
|
Description: Do not use nested method definitions.
|
751
777
|
Enabled: true
|
@@ -756,6 +782,9 @@ Lint/NextWithoutAccumulator:
|
|
756
782
|
Description: Do not omit the accumulator when calling `next` in a `reduce`/`inject`
|
757
783
|
block.
|
758
784
|
Enabled: true
|
785
|
+
Lint/NoReturnInBeginEndBlocks:
|
786
|
+
Description: Do not `return` inside `begin..end` blocks in assignment contexts.
|
787
|
+
Enabled: true
|
759
788
|
Lint/NonDeterministicRequireOrder:
|
760
789
|
Description: Always sort arrays returned by Dir.glob when requiring files.
|
761
790
|
Enabled: true
|
@@ -767,6 +796,10 @@ Lint/NumberConversion:
|
|
767
796
|
Description: Checks unsafe usage of number conversion methods.
|
768
797
|
Enabled: true
|
769
798
|
SafeAutoCorrect: false
|
799
|
+
IgnoredMethods: []
|
800
|
+
IgnoredClasses:
|
801
|
+
- Time
|
802
|
+
- DateTime
|
770
803
|
Lint/OrderedMagicComments:
|
771
804
|
Description: Checks the proper ordering of magic comments and whether a magic
|
772
805
|
comment is not placed before a shebang.
|
@@ -807,6 +840,17 @@ Lint/RedundantCopEnableDirective:
|
|
807
840
|
Lint/RedundantRequireStatement:
|
808
841
|
Description: Checks for unnecessary `require` statement.
|
809
842
|
Enabled: true
|
843
|
+
Lint/RedundantSafeNavigation:
|
844
|
+
Description: Checks for redundant safe navigation calls.
|
845
|
+
Enabled: true
|
846
|
+
AllowedMethods:
|
847
|
+
- instance_of?
|
848
|
+
- kind_of?
|
849
|
+
- is_a?
|
850
|
+
- eql?
|
851
|
+
- respond_to?
|
852
|
+
- equal?
|
853
|
+
Safe: false
|
810
854
|
Lint/RedundantSplatExpansion:
|
811
855
|
Description: Checks for splat unnecessarily being called on literals.
|
812
856
|
Enabled: true
|
@@ -888,6 +932,10 @@ Lint/SuppressedException:
|
|
888
932
|
Lint/Syntax:
|
889
933
|
Description: Checks syntax error.
|
890
934
|
Enabled: true
|
935
|
+
Lint/ToEnumArguments:
|
936
|
+
Description: This cop ensures that `to_enum`/`enum_for`, called for the current
|
937
|
+
method, has correct arguments.
|
938
|
+
Enabled: true
|
891
939
|
Lint/ToJSON:
|
892
940
|
Description: 'Ensure #to_json includes an optional argument.'
|
893
941
|
Enabled: true
|
@@ -901,9 +949,29 @@ Lint/UnderscorePrefixedVariableName:
|
|
901
949
|
Description: Do not use prefix `_` for a variable that is used.
|
902
950
|
Enabled: true
|
903
951
|
AllowKeywordBlockArguments: false
|
952
|
+
Lint/UnexpectedBlockArity:
|
953
|
+
Description: Looks for blocks that have fewer arguments that the calling method
|
954
|
+
expects.
|
955
|
+
Enabled: true
|
956
|
+
Safe: false
|
957
|
+
Methods:
|
958
|
+
chunk_while: 2
|
959
|
+
each_with_index: 2
|
960
|
+
each_with_object: 2
|
961
|
+
inject: 2
|
962
|
+
max: 2
|
963
|
+
min: 2
|
964
|
+
minmax: 2
|
965
|
+
reduce: 2
|
966
|
+
slice_when: 2
|
967
|
+
sort: 2
|
904
968
|
Lint/UnifiedInteger:
|
905
969
|
Description: Use Integer instead of Fixnum or Bignum.
|
906
970
|
Enabled: true
|
971
|
+
Lint/UnmodifiedReduceAccumulator:
|
972
|
+
Description: Checks for `reduce` or `inject` blocks that do not update the accumulator
|
973
|
+
each iteration.
|
974
|
+
Enabled: true
|
907
975
|
Lint/UnreachableCode:
|
908
976
|
Description: Unreachable code.
|
909
977
|
Enabled: true
|
@@ -950,6 +1018,11 @@ Lint/UselessMethodDefinition:
|
|
950
1018
|
Lint/UselessSetterCall:
|
951
1019
|
Description: Checks for useless setter call to a local variable.
|
952
1020
|
Enabled: true
|
1021
|
+
SafeAutoCorrect: false
|
1022
|
+
Safe: false
|
1023
|
+
Lint/UselessTimes:
|
1024
|
+
Description: Checks for useless `Integer#times` calls.
|
1025
|
+
Enabled: true
|
953
1026
|
Safe: false
|
954
1027
|
Lint/Void:
|
955
1028
|
Description: Possible use of operator/literal/variable in void context.
|
@@ -963,6 +1036,7 @@ Metrics/AbcSize:
|
|
963
1036
|
- https://en.wikipedia.org/wiki/ABC_Software_Metric
|
964
1037
|
Enabled: true
|
965
1038
|
IgnoredMethods: []
|
1039
|
+
CountRepeatedAttributes: true
|
966
1040
|
Max: 25
|
967
1041
|
Metrics/BlockLength:
|
968
1042
|
Description: Avoid long blocks with many lines.
|
@@ -970,7 +1044,7 @@ Metrics/BlockLength:
|
|
970
1044
|
CountComments: false
|
971
1045
|
Max: 25
|
972
1046
|
CountAsOne: []
|
973
|
-
|
1047
|
+
IgnoredMethods:
|
974
1048
|
- refine
|
975
1049
|
Exclude:
|
976
1050
|
- spec/**/*
|
@@ -992,12 +1066,12 @@ Metrics/CyclomaticComplexity:
|
|
992
1066
|
IgnoredMethods: []
|
993
1067
|
Max: 6
|
994
1068
|
Metrics/MethodLength:
|
995
|
-
Description: Avoid methods longer than
|
1069
|
+
Description: Avoid methods longer than 15 lines of code.
|
996
1070
|
Enabled: true
|
997
1071
|
CountComments: false
|
998
1072
|
Max: 15
|
999
1073
|
CountAsOne: []
|
1000
|
-
|
1074
|
+
IgnoredMethods: []
|
1001
1075
|
Metrics/ModuleLength:
|
1002
1076
|
Description: Avoid modules longer than 100 lines of code.
|
1003
1077
|
Enabled: true
|
@@ -1009,6 +1083,7 @@ Metrics/ParameterLists:
|
|
1009
1083
|
Enabled: true
|
1010
1084
|
Max: 5
|
1011
1085
|
CountKeywordArgs: true
|
1086
|
+
MaxOptionalParameters: 3
|
1012
1087
|
Metrics/PerceivedComplexity:
|
1013
1088
|
Description: A complexity metric geared towards measuring complexity for a human
|
1014
1089
|
reader.
|
@@ -1051,7 +1126,7 @@ Naming/FileName:
|
|
1051
1126
|
Exclude: []
|
1052
1127
|
ExpectMatchingDefinition: false
|
1053
1128
|
CheckDefinitionPathHierarchy: true
|
1054
|
-
Regex:
|
1129
|
+
Regex:
|
1055
1130
|
IgnoreExecutableScripts: true
|
1056
1131
|
AllowedAcronyms:
|
1057
1132
|
- CLI
|
@@ -1166,11 +1241,25 @@ Naming/VariableNumber:
|
|
1166
1241
|
Description: Use the configured style when numbering variables.
|
1167
1242
|
Enabled: true
|
1168
1243
|
EnforcedStyle: normalcase
|
1244
|
+
CheckMethodNames: true
|
1245
|
+
CheckSymbols: true
|
1246
|
+
AllowedIdentifiers:
|
1247
|
+
- capture3
|
1248
|
+
- iso8601
|
1249
|
+
- rfc1123_date
|
1250
|
+
- rfc822
|
1251
|
+
- rfc2822
|
1252
|
+
- rfc3339
|
1169
1253
|
Performance/AncestorsInclude:
|
1170
1254
|
Description: Use `A <= B` instead of `A.ancestors.include?(B)`.
|
1171
1255
|
Reference: https://github.com/JuanitoFatas/fast-ruby#ancestorsinclude-vs--code
|
1172
1256
|
Enabled: true
|
1173
1257
|
Safe: false
|
1258
|
+
Performance/ArraySemiInfiniteRangeSlice:
|
1259
|
+
Description: Identifies places where slicing arrays with semi-infinite ranges
|
1260
|
+
can be replaced by `Array#take` and `Array#drop`.
|
1261
|
+
Enabled: true
|
1262
|
+
Safe: false
|
1174
1263
|
Performance/BigDecimalWithNumericArgument:
|
1175
1264
|
Description: Convert numeric argument to string before passing to BigDecimal.
|
1176
1265
|
Enabled: true
|
@@ -1178,6 +1267,9 @@ Performance/BindCall:
|
|
1178
1267
|
Description: Use `bind_call(obj, args, ...)` instead of `bind(obj).call(args,
|
1179
1268
|
...)`.
|
1180
1269
|
Enabled: true
|
1270
|
+
Performance/BlockGivenWithExplicitBlock:
|
1271
|
+
Description: Check block argument explicitly instead of using `block_given?`.
|
1272
|
+
Enabled: true
|
1181
1273
|
Performance/Caller:
|
1182
1274
|
Description: Use `caller(n..n)` instead of `caller`.
|
1183
1275
|
Enabled: true
|
@@ -1198,9 +1290,16 @@ Performance/ChainArrayAllocation:
|
|
1198
1290
|
an existing array.
|
1199
1291
|
Reference: https://twitter.com/schneems/status/1034123879978029057
|
1200
1292
|
Enabled: false
|
1293
|
+
Performance/CollectionLiteralInLoop:
|
1294
|
+
Description: Extract Array and Hash literals outside of loops into local variables or constants.
|
1295
|
+
Enabled: true
|
1296
|
+
MinSize: 1
|
1201
1297
|
Performance/CompareWithBlock:
|
1202
1298
|
Description: Use `sort_by(&:foo)` instead of `sort { |a, b| a.foo <=> b.foo }`.
|
1203
1299
|
Enabled: true
|
1300
|
+
Performance/ConstantRegexp:
|
1301
|
+
Description: Finds regular expressions with dynamic components that are all constants.
|
1302
|
+
Enabled: true
|
1204
1303
|
Performance/Count:
|
1205
1304
|
Description: Use `count` instead of `{select,find_all,filter,reject}...{size,count,length}`.
|
1206
1305
|
SafeAutoCorrect: false
|
@@ -1250,9 +1349,13 @@ Performance/IoReadlines:
|
|
1250
1349
|
Description: Use `IO.each_line` (`IO#each_line`) instead of `IO.readlines` (`IO#readlines`).
|
1251
1350
|
Reference: https://docs.gitlab.com/ee/development/performance.html#reading-from-files-and-other-data-sources
|
1252
1351
|
Enabled: false
|
1352
|
+
Performance/MethodObjectAsBlock:
|
1353
|
+
Description: Use block explicitly instead of block-passing a method object.
|
1354
|
+
Reference: https://github.com/JuanitoFatas/fast-ruby#normal-way-to-apply-method-vs-method-code
|
1355
|
+
Enabled: true
|
1253
1356
|
Performance/OpenStruct:
|
1254
1357
|
Description: Use `Struct` instead of `OpenStruct`.
|
1255
|
-
Enabled:
|
1358
|
+
Enabled: true
|
1256
1359
|
Safe: false
|
1257
1360
|
Performance/RangeInclude:
|
1258
1361
|
Description: Use `Range#cover?` instead of `Range#include?` (or `Range#member?`).
|
@@ -1321,6 +1424,10 @@ Performance/StringReplacement:
|
|
1321
1424
|
of characters. Use `delete` instead of `gsub` when you are deleting characters.
|
1322
1425
|
Reference: https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code
|
1323
1426
|
Enabled: true
|
1427
|
+
Performance/Sum:
|
1428
|
+
Description: 'Use `sum` instead of a custom array summation.'
|
1429
|
+
Reference: https://blog.bigbinary.com/2016/11/02/ruby-2-4-introduces-enumerable-sum.html
|
1430
|
+
Enabled: true
|
1324
1431
|
Performance/TimesMap:
|
1325
1432
|
Description: Checks for .times.map calls.
|
1326
1433
|
AutoCorrect: false
|
@@ -1329,9 +1436,91 @@ Performance/TimesMap:
|
|
1329
1436
|
Performance/UnfreezeString:
|
1330
1437
|
Description: Use unary plus to get an unfrozen string literal.
|
1331
1438
|
Enabled: true
|
1439
|
+
SafeAutoCorrect: false
|
1332
1440
|
Performance/UriDefaultParser:
|
1333
1441
|
Description: Use `URI::DEFAULT_PARSER` instead of `URI::Parser.new`.
|
1334
1442
|
Enabled: true
|
1443
|
+
RSpec:
|
1444
|
+
Include:
|
1445
|
+
- "**/*_spec.rb"
|
1446
|
+
- "**/spec/**/*"
|
1447
|
+
Language:
|
1448
|
+
ExampleGroups:
|
1449
|
+
Regular:
|
1450
|
+
- describe
|
1451
|
+
- context
|
1452
|
+
- feature
|
1453
|
+
- example_group
|
1454
|
+
Skipped:
|
1455
|
+
- xdescribe
|
1456
|
+
- xcontext
|
1457
|
+
- xfeature
|
1458
|
+
Focused:
|
1459
|
+
- fdescribe
|
1460
|
+
- fcontext
|
1461
|
+
- ffeature
|
1462
|
+
Examples:
|
1463
|
+
Regular:
|
1464
|
+
- it
|
1465
|
+
- specify
|
1466
|
+
- example
|
1467
|
+
- scenario
|
1468
|
+
- its
|
1469
|
+
Focused:
|
1470
|
+
- fit
|
1471
|
+
- fspecify
|
1472
|
+
- fexample
|
1473
|
+
- fscenario
|
1474
|
+
- focus
|
1475
|
+
Skipped:
|
1476
|
+
- xit
|
1477
|
+
- xspecify
|
1478
|
+
- xexample
|
1479
|
+
- xscenario
|
1480
|
+
- skip
|
1481
|
+
Pending:
|
1482
|
+
- pending
|
1483
|
+
Expectations:
|
1484
|
+
- expect
|
1485
|
+
- is_expected
|
1486
|
+
- expect_any_instance_of
|
1487
|
+
Helpers:
|
1488
|
+
- let
|
1489
|
+
- let!
|
1490
|
+
Hooks:
|
1491
|
+
- prepend_before
|
1492
|
+
- before
|
1493
|
+
- append_before
|
1494
|
+
- around
|
1495
|
+
- prepend_after
|
1496
|
+
- after
|
1497
|
+
- append_after
|
1498
|
+
HookScopes:
|
1499
|
+
- each
|
1500
|
+
- example
|
1501
|
+
- context
|
1502
|
+
- all
|
1503
|
+
- suite
|
1504
|
+
Includes:
|
1505
|
+
Examples:
|
1506
|
+
- it_behaves_like
|
1507
|
+
- it_should_behave_like
|
1508
|
+
- include_examples
|
1509
|
+
Context:
|
1510
|
+
- include_context
|
1511
|
+
Runners:
|
1512
|
+
- to
|
1513
|
+
- to_not
|
1514
|
+
- not_to
|
1515
|
+
SharedGroups:
|
1516
|
+
Examples:
|
1517
|
+
- shared_examples
|
1518
|
+
- shared_examples_for
|
1519
|
+
Context:
|
1520
|
+
- shared_context
|
1521
|
+
Subjects:
|
1522
|
+
- subject
|
1523
|
+
- subject!
|
1335
1524
|
RSpec/AlignLeftLetBrace:
|
1336
1525
|
Description: Checks that left braces for adjacent single line lets are aligned.
|
1337
1526
|
Enabled: false
|
@@ -1357,6 +1546,16 @@ RSpec/BeforeAfterAll:
|
|
1357
1546
|
- spec/spec_helper.rb
|
1358
1547
|
- spec/rails_helper.rb
|
1359
1548
|
- spec/support/**/*.rb
|
1549
|
+
RSpec/Capybara/CurrentPathExpectation:
|
1550
|
+
Description: Checks that no expectations are set on Capybara's `current_path`.
|
1551
|
+
Enabled: true
|
1552
|
+
RSpec/Capybara/FeatureMethods:
|
1553
|
+
Description: Checks for consistent method usage in feature specs.
|
1554
|
+
Enabled: true
|
1555
|
+
EnabledMethods: []
|
1556
|
+
RSpec/Capybara/VisibilityMatcher:
|
1557
|
+
Description: Checks for boolean visibility in capybara finders.
|
1558
|
+
Enabled: true
|
1360
1559
|
RSpec/ContextMethod:
|
1361
1560
|
Description: "`context` should not be used for specifying methods."
|
1362
1561
|
Enabled: true
|
@@ -1370,6 +1569,21 @@ RSpec/ContextWording:
|
|
1370
1569
|
RSpec/DescribeClass:
|
1371
1570
|
Description: Check that the first argument to the top-level describe is a constant.
|
1372
1571
|
Enabled: true
|
1572
|
+
IgnoredMetadata:
|
1573
|
+
type:
|
1574
|
+
- channel
|
1575
|
+
- controller
|
1576
|
+
- helper
|
1577
|
+
- job
|
1578
|
+
- mailer
|
1579
|
+
- model
|
1580
|
+
- request
|
1581
|
+
- routing
|
1582
|
+
- view
|
1583
|
+
- feature
|
1584
|
+
- system
|
1585
|
+
- mailbox
|
1586
|
+
- aruba
|
1373
1587
|
RSpec/DescribeMethod:
|
1374
1588
|
Description: Checks that the second argument to `describe` specifies a method.
|
1375
1589
|
Enabled: true
|
@@ -1384,7 +1598,7 @@ RSpec/DescribedClass:
|
|
1384
1598
|
SafeAutoCorrect: false
|
1385
1599
|
RSpec/DescribedClassModuleWrapping:
|
1386
1600
|
Description: Avoid opening modules and defining specs within them.
|
1387
|
-
Enabled:
|
1601
|
+
Enabled: true
|
1388
1602
|
RSpec/Dialect:
|
1389
1603
|
Description: This cop enforces custom RSpec dialects.
|
1390
1604
|
Enabled: false
|
@@ -1392,7 +1606,6 @@ RSpec/Dialect:
|
|
1392
1606
|
RSpec/EmptyExampleGroup:
|
1393
1607
|
Description: Checks if an example group does not include any tests.
|
1394
1608
|
Enabled: true
|
1395
|
-
CustomIncludeMethods: []
|
1396
1609
|
RSpec/EmptyHook:
|
1397
1610
|
Description: Checks for empty before and after hooks.
|
1398
1611
|
Enabled: true
|
@@ -1417,9 +1630,9 @@ RSpec/ExampleLength:
|
|
1417
1630
|
Enabled: true
|
1418
1631
|
Max: 5
|
1419
1632
|
Exclude:
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1633
|
+
- spec/requests/**/*
|
1634
|
+
- spec/features/**/*
|
1635
|
+
- spec/routing/**/*
|
1423
1636
|
RSpec/ExampleWithoutDescription:
|
1424
1637
|
Description: Checks for examples without a description.
|
1425
1638
|
Enabled: true
|
@@ -1448,9 +1661,36 @@ RSpec/ExpectInHook:
|
|
1448
1661
|
RSpec/ExpectOutput:
|
1449
1662
|
Description: Checks for opportunities to use `expect { ... }.to output`.
|
1450
1663
|
Enabled: true
|
1664
|
+
RSpec/FactoryBot/AttributeDefinedStatically:
|
1665
|
+
Description: Always declare attribute values as blocks.
|
1666
|
+
Enabled: true
|
1667
|
+
Include:
|
1668
|
+
- spec/factories.rb
|
1669
|
+
- spec/factories/**/*.rb
|
1670
|
+
- features/support/factories/**/*.rb
|
1671
|
+
RSpec/FactoryBot/CreateList:
|
1672
|
+
Description: Checks for create_list usage.
|
1673
|
+
Enabled: true
|
1674
|
+
Include:
|
1675
|
+
- "**/*_spec.rb"
|
1676
|
+
- "**/spec/**/*"
|
1677
|
+
- spec/factories.rb
|
1678
|
+
- spec/factories/**/*.rb
|
1679
|
+
- features/support/factories/**/*.rb
|
1680
|
+
EnforcedStyle: create_list
|
1681
|
+
RSpec/FactoryBot/FactoryClassName:
|
1682
|
+
Description: Use string value when setting the class attribute explicitly.
|
1683
|
+
Enabled: true
|
1684
|
+
Include:
|
1685
|
+
- spec/factories.rb
|
1686
|
+
- spec/factories/**/*.rb
|
1687
|
+
- features/support/factories/**/*.rb
|
1451
1688
|
RSpec/FilePath:
|
1452
1689
|
Description: Checks that spec file paths are consistent and well-formed.
|
1453
1690
|
Enabled: true
|
1691
|
+
Include:
|
1692
|
+
- "**/*_spec*rb*"
|
1693
|
+
- "**/spec/**/*"
|
1454
1694
|
CustomTransform:
|
1455
1695
|
RuboCop: rubocop
|
1456
1696
|
RSpec: rspec
|
@@ -1484,9 +1724,6 @@ RSpec/InstanceVariable:
|
|
1484
1724
|
Description: Checks for instance variable usage in specs.
|
1485
1725
|
Enabled: true
|
1486
1726
|
AssignmentOnly: false
|
1487
|
-
RSpec/InvalidPredicateMatcher:
|
1488
|
-
Description: Checks invalid usage for predicate matcher.
|
1489
|
-
Enabled: true
|
1490
1727
|
RSpec/ItBehavesLike:
|
1491
1728
|
Description: Checks that only one `it_behaves_like` style is used.
|
1492
1729
|
Enabled: true
|
@@ -1560,6 +1797,10 @@ RSpec/PredicateMatcher:
|
|
1560
1797
|
EnforcedStyle: inflected
|
1561
1798
|
AllowedExplicitMatchers: []
|
1562
1799
|
SafeAutoCorrect: false
|
1800
|
+
RSpec/Rails/HttpStatus:
|
1801
|
+
Description: Enforces use of symbolic or numeric value to describe HTTP status.
|
1802
|
+
Enabled: true
|
1803
|
+
EnforcedStyle: symbolic
|
1563
1804
|
RSpec/ReceiveCounts:
|
1564
1805
|
Description: Check for `once` and `twice` receive counts matchers usage.
|
1565
1806
|
Enabled: true
|
@@ -1647,6 +1888,12 @@ Rails/ActiveSupportAliases:
|
|
1647
1888
|
Description: 'Avoid ActiveSupport aliases of standard ruby methods: `String#starts_with?`,
|
1648
1889
|
`String#ends_with?`, `Array#append`, `Array#prepend`.'
|
1649
1890
|
Enabled: true
|
1891
|
+
Rails/AfterCommitOverride:
|
1892
|
+
Description: >-
|
1893
|
+
This cop enforces that there is only one call to `after_commit`
|
1894
|
+
(and its aliases - `after_create_commit`, `after_update_commit`,
|
1895
|
+
and `after_destroy_commit`) with the same callback name per model.
|
1896
|
+
Enabled: true
|
1650
1897
|
Rails/ApplicationController:
|
1651
1898
|
Description: Check that controllers subclass ApplicationController.
|
1652
1899
|
Enabled: true
|
@@ -1659,11 +1906,19 @@ Rails/ApplicationMailer:
|
|
1659
1906
|
Rails/ApplicationRecord:
|
1660
1907
|
Description: Check that models subclass ApplicationRecord.
|
1661
1908
|
Enabled: true
|
1909
|
+
Rails/ArelStar:
|
1910
|
+
Description: Enforces `Arel.star` instead of `"*"` for expanded columns.
|
1911
|
+
Enabled: true
|
1662
1912
|
Rails/AssertNot:
|
1663
1913
|
Description: Use `assert_not` instead of `assert !`.
|
1664
1914
|
Enabled: true
|
1665
1915
|
Include:
|
1666
1916
|
- "**/test/**/*"
|
1917
|
+
Rails/AttributeDefaultBlockValue:
|
1918
|
+
Description: Pass method call in block for attribute option `default`.
|
1919
|
+
Enabled: true
|
1920
|
+
Include:
|
1921
|
+
- models/**/*
|
1667
1922
|
Rails/BelongsTo:
|
1668
1923
|
Description: 'Use `optional: true` instead of `required: false` for `belongs_to`
|
1669
1924
|
relations.'
|
@@ -1677,7 +1932,7 @@ Rails/Blank:
|
|
1677
1932
|
Rails/BulkChangeTable:
|
1678
1933
|
Description: Check whether alter queries are combinable.
|
1679
1934
|
Enabled: true
|
1680
|
-
Database:
|
1935
|
+
Database:
|
1681
1936
|
SupportedDatabases:
|
1682
1937
|
- mysql
|
1683
1938
|
- postgresql
|
@@ -1692,7 +1947,7 @@ Rails/ContentTag:
|
|
1692
1947
|
Rails/CreateTableWithTimestamps:
|
1693
1948
|
Description: Checks the migration for which timestamps are not included when creating
|
1694
1949
|
a new table.
|
1695
|
-
Enabled:
|
1950
|
+
Enabled: false
|
1696
1951
|
Include:
|
1697
1952
|
- db/migrate/*.rb
|
1698
1953
|
Rails/Date:
|
@@ -1762,6 +2017,11 @@ Rails/FindEach:
|
|
1762
2017
|
Enabled: true
|
1763
2018
|
Include:
|
1764
2019
|
- app/models/**/*.rb
|
2020
|
+
IgnoredMethods:
|
2021
|
+
- order
|
2022
|
+
- limit
|
2023
|
+
- select
|
2024
|
+
- lock
|
1765
2025
|
Rails/HasAndBelongsToMany:
|
1766
2026
|
Description: Prefer has_many :through to has_and_belongs_to_many.
|
1767
2027
|
Enabled: true
|
@@ -1841,6 +2101,7 @@ Rails/MatchRoute:
|
|
1841
2101
|
Rails/NegateInclude:
|
1842
2102
|
Description: Prefer `collection.exclude?(obj)` over `!collection.include?(obj)`.
|
1843
2103
|
Enabled: true
|
2104
|
+
Safe: false
|
1844
2105
|
Rails/NotNullColumn:
|
1845
2106
|
Description: Do not add a NOT NULL column without a default value.
|
1846
2107
|
Enabled: true
|
@@ -1992,6 +2253,11 @@ Rails/SkipsModelValidations:
|
|
1992
2253
|
AllowedMethods: []
|
1993
2254
|
Exclude:
|
1994
2255
|
- "**/*_spec.rb"
|
2256
|
+
Rails/SquishedSQLHeredocs:
|
2257
|
+
Description: 'Checks SQL heredocs to use `.squish`.'
|
2258
|
+
StyleGuide: 'https://rails.rubystyle.guide/#squished-heredocs'
|
2259
|
+
Enabled: true
|
2260
|
+
SafeAutoCorrect: false
|
1995
2261
|
Rails/TimeZone:
|
1996
2262
|
Description: Checks the correct usage of time zone aware methods.
|
1997
2263
|
Reference: http://danilenko.org/2012/7/6/rails_timezones
|
@@ -2020,9 +2286,18 @@ Rails/Validation:
|
|
2020
2286
|
Enabled: true
|
2021
2287
|
Include:
|
2022
2288
|
- app/models/**/*.rb
|
2289
|
+
Rails/WhereEquals:
|
2290
|
+
Description: Pass conditions to `where` as a hash instead of manually constructing
|
2291
|
+
SQL.
|
2292
|
+
Enabled: true
|
2023
2293
|
Rails/WhereExists:
|
2024
2294
|
Description: Prefer `exists?(...)` over `where(...).exists?`.
|
2025
2295
|
Enabled: true
|
2296
|
+
EnforcedStyle: exists
|
2297
|
+
Rails/WhereNot:
|
2298
|
+
Description: 'Use `where.not(...)` instead of manually constructing negated SQL in `where`.'
|
2299
|
+
StyleGuide: 'https://rails.rubystyle.guide/#hash-conditions'
|
2300
|
+
Enabled: true
|
2026
2301
|
Rake:
|
2027
2302
|
Enabled: true
|
2028
2303
|
Include:
|
@@ -2087,6 +2362,10 @@ Style/AndOr:
|
|
2087
2362
|
EnforcedStyle: conditionals
|
2088
2363
|
Include:
|
2089
2364
|
- app/controllers/**/*_controller.rb
|
2365
|
+
Style/ArgumentsForwarding:
|
2366
|
+
Description: Use arguments forwarding.
|
2367
|
+
Enabled: true
|
2368
|
+
AllowOnlyRestArgument: true
|
2090
2369
|
Style/ArrayCoercion:
|
2091
2370
|
Description: Use Array() instead of explicit Array check or [*var], when dealing
|
2092
2371
|
with a variable you want to treat as an Array, but you're not certain it's
|
@@ -2169,6 +2448,14 @@ Style/ClassCheck:
|
|
2169
2448
|
Description: Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
|
2170
2449
|
Enabled: true
|
2171
2450
|
EnforcedStyle: is_a?
|
2451
|
+
Style/ClassEqualityComparison:
|
2452
|
+
Description: Enforces the use of `Object#instance_of?` instead of class comparison
|
2453
|
+
for equality.
|
2454
|
+
Enabled: true
|
2455
|
+
IgnoredMethods:
|
2456
|
+
- "=="
|
2457
|
+
- equal?
|
2458
|
+
- eql?
|
2172
2459
|
Style/ClassMethods:
|
2173
2460
|
Description: Use self when defining module/class methods.
|
2174
2461
|
Enabled: true
|
@@ -2180,6 +2467,11 @@ Style/ClassMethodsDefinitions:
|
|
2180
2467
|
Style/ClassVars:
|
2181
2468
|
Description: Avoid the use of class variables.
|
2182
2469
|
Enabled: true
|
2470
|
+
Style/CollectionCompact:
|
2471
|
+
Description: Use `{Array,Hash}#{compact,compact!}` instead of custom logic to
|
2472
|
+
reject nils.
|
2473
|
+
Enabled: true
|
2474
|
+
Safe: false
|
2183
2475
|
Style/CollectionMethods:
|
2184
2476
|
Description: Preferred collection methods.
|
2185
2477
|
Enabled: true
|
@@ -2238,6 +2530,7 @@ Style/Copyright:
|
|
2238
2530
|
Style/DateTime:
|
2239
2531
|
Description: Use Time over DateTime.
|
2240
2532
|
Enabled: true
|
2533
|
+
SafeAutoCorrect: false
|
2241
2534
|
AllowCoercion: false
|
2242
2535
|
Style/DefWithParentheses:
|
2243
2536
|
Description: Use def with parentheses when there are arguments.
|
@@ -2249,6 +2542,10 @@ Style/Dir:
|
|
2249
2542
|
Style/DisableCopsWithinSourceCodeDirective:
|
2250
2543
|
Description: Forbids disabling/enabling cops within source code.
|
2251
2544
|
Enabled: false
|
2545
|
+
Style/DocumentDynamicEvalDefinition:
|
2546
|
+
Description: When using `class_eval` (or other `eval`) with string interpolation,
|
2547
|
+
add a comment block showing its appearance if interpolated.
|
2548
|
+
Enabled: true
|
2252
2549
|
Style/Documentation:
|
2253
2550
|
Description: Document classes and non-namespace modules.
|
2254
2551
|
Enabled: false
|
@@ -2340,6 +2637,7 @@ Style/FormatStringToken:
|
|
2340
2637
|
Description: Use a consistent style for format string tokens.
|
2341
2638
|
Enabled: true
|
2342
2639
|
EnforcedStyle: annotated
|
2640
|
+
MaxUnannotatedPlaceholdersAllowed: 1
|
2343
2641
|
Style/FrozenStringLiteralComment:
|
2344
2642
|
Description: Add the frozen_string_literal comment to the top of files to help
|
2345
2643
|
transition to frozen string literals by default.
|
@@ -2349,6 +2647,7 @@ Style/FrozenStringLiteralComment:
|
|
2349
2647
|
Style/GlobalStdStream:
|
2350
2648
|
Description: Enforces the use of `$stdout/$stderr/$stdin` instead of `STDOUT/STDERR/STDIN`.
|
2351
2649
|
Enabled: true
|
2650
|
+
SafeAutoCorrect: false
|
2352
2651
|
Style/GlobalVars:
|
2353
2652
|
Description: Do not introduce global variables.
|
2354
2653
|
Reference: https://www.zenspider.com/ruby/quickref.html
|
@@ -2410,8 +2709,8 @@ Style/ImplicitRuntimeError:
|
|
2410
2709
|
Enabled: true
|
2411
2710
|
Style/InfiniteLoop:
|
2412
2711
|
Description: Use Kernel#loop for infinite loops.
|
2712
|
+
Safe: false
|
2413
2713
|
Enabled: true
|
2414
|
-
SafeAutoCorrect: true
|
2415
2714
|
Style/InlineComment:
|
2416
2715
|
Description: Avoid trailing inline comments.
|
2417
2716
|
Enabled: true
|
@@ -2435,6 +2734,11 @@ Style/IpAddresses:
|
|
2435
2734
|
Enabled: true
|
2436
2735
|
AllowedAddresses:
|
2437
2736
|
- "::"
|
2737
|
+
Exclude:
|
2738
|
+
- "**/*.gemfile"
|
2739
|
+
- "**/Gemfile"
|
2740
|
+
- "**/gems.rb"
|
2741
|
+
- "**/*.gemspec"
|
2438
2742
|
Style/KeywordParametersOrder:
|
2439
2743
|
Description: Enforces that optional keyword parameters are placed at the end of
|
2440
2744
|
the parameters list.
|
@@ -2550,6 +2854,11 @@ Style/NegatedIf:
|
|
2550
2854
|
Description: Favor unless over if for negative conditions (or control flow or).
|
2551
2855
|
Enabled: true
|
2552
2856
|
EnforcedStyle: both
|
2857
|
+
Style/NegatedIfElseCondition:
|
2858
|
+
Description: This cop checks for uses of `if-else` and ternary operators with
|
2859
|
+
a negated condition which can be simplified by inverting condition and swapping
|
2860
|
+
branches.
|
2861
|
+
Enabled: true
|
2553
2862
|
Style/NegatedUnless:
|
2554
2863
|
Description: Favor if over unless for negative conditions.
|
2555
2864
|
Enabled: true
|
@@ -2594,6 +2903,9 @@ Style/NilComparison:
|
|
2594
2903
|
Description: Prefer x.nil? to x == nil.
|
2595
2904
|
Enabled: true
|
2596
2905
|
EnforcedStyle: predicate
|
2906
|
+
Style/NilLambda:
|
2907
|
+
Description: Prefer `-> {}` to `-> { nil }`.
|
2908
|
+
Enabled: true
|
2597
2909
|
Style/NonNilCheck:
|
2598
2910
|
Description: Checks for redundant nil checks.
|
2599
2911
|
Enabled: true
|
@@ -2646,6 +2958,8 @@ Style/OptionalBooleanParameter:
|
|
2646
2958
|
Description: Use keyword arguments when defining method with boolean argument.
|
2647
2959
|
Enabled: true
|
2648
2960
|
Safe: false
|
2961
|
+
AllowedMethods:
|
2962
|
+
- respond_to_missing?
|
2649
2963
|
Style/OrAssignment:
|
2650
2964
|
Description: Recommend usage of double pipe equals (||=) where applicable.
|
2651
2965
|
Enabled: true
|
@@ -2687,10 +3001,20 @@ Style/RaiseArgs:
|
|
2687
3001
|
Description: Checks the arguments passed to raise/fail.
|
2688
3002
|
Enabled: true
|
2689
3003
|
EnforcedStyle: exploded
|
3004
|
+
AllowedCompactTypes: []
|
2690
3005
|
Style/RandomWithOffset:
|
2691
3006
|
Description: Prefer to use ranges when generating random numbers instead of integers
|
2692
3007
|
with offsets.
|
2693
3008
|
Enabled: true
|
3009
|
+
Style/RedundantArgument:
|
3010
|
+
Description: Check for a redundant argument passed to certain methods.
|
3011
|
+
Enabled: true
|
3012
|
+
Safe: false
|
3013
|
+
Methods:
|
3014
|
+
join: ''
|
3015
|
+
split: " "
|
3016
|
+
chomp: "\n"
|
3017
|
+
chomp!: "\n"
|
2694
3018
|
Style/RedundantAssignment:
|
2695
3019
|
Description: Checks for redundant assignment before returning.
|
2696
3020
|
Enabled: true
|
@@ -2785,6 +3109,7 @@ Style/SafeNavigation:
|
|
2785
3109
|
- presence
|
2786
3110
|
- try
|
2787
3111
|
- try!
|
3112
|
+
SafeAutoCorrect: false
|
2788
3113
|
Style/Sample:
|
2789
3114
|
Description: Use `sample` instead of `shuffle.first`, `shuffle.last`, and `shuffle[Integer]`.
|
2790
3115
|
Reference: https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code
|
@@ -2838,6 +3163,10 @@ Style/StabbyLambdaParentheses:
|
|
2838
3163
|
Description: Check for the usage of parentheses around stabby lambda arguments.
|
2839
3164
|
Enabled: true
|
2840
3165
|
EnforcedStyle: require_parentheses
|
3166
|
+
Style/StaticClass:
|
3167
|
+
Description: Prefer modules to classes with only class methods.
|
3168
|
+
Enabled: false
|
3169
|
+
Safe: false
|
2841
3170
|
Style/StderrPuts:
|
2842
3171
|
Description: Use `warn` instead of `$stderr.puts`.
|
2843
3172
|
Enabled: true
|
@@ -2871,6 +3200,10 @@ Style/Strip:
|
|
2871
3200
|
Style/StructInheritance:
|
2872
3201
|
Description: Checks for inheritance from Struct.new.
|
2873
3202
|
Enabled: true
|
3203
|
+
Style/SwapValues:
|
3204
|
+
Description: This cop enforces the use of shorthand-style swapping of 2 variables.
|
3205
|
+
Enabled: true
|
3206
|
+
SafeAutoCorrect: false
|
2874
3207
|
Style/SymbolArray:
|
2875
3208
|
Description: Use %i or %I for arrays of symbols.
|
2876
3209
|
Enabled: true
|
data/lib/rubocop_hixonrails.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-hixonrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hix on Rails
|
@@ -17,42 +17,42 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 1.6.1
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 1.6.1
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rubocop-performance
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.9.1
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: 1.9.1
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rubocop-rails
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 2.
|
48
|
+
version: 2.9.0
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 2.
|
55
|
+
version: 2.9.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rubocop-rake
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 2.0.1
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 2.0.1
|
84
84
|
description: |2
|
85
85
|
RuboCop configuration with the following extensions:
|
86
86
|
- rubocop-rails,
|