simplycop 1.2.0 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb033be1d0c83f6ddf82d2d096aa89992caeb1e51f55b6966ecbc69b77f9462e
4
- data.tar.gz: 8e04105bcda67012c7c1e9ef83cd91e34ae7318a8e06e9ad24f0deb96f27831f
3
+ metadata.gz: 076036bcf8a50fab9721ef1a9bc81c58c1b37be20b72b6882fbbcd55505f7071
4
+ data.tar.gz: f246b21e0afd394b49dbafd4445c90734f6232488d7d1578a4e3b118dff9ef53
5
5
  SHA512:
6
- metadata.gz: e9f93c07d4fd1a18109ae5561aa9246578f16656c1fb95aeb188cf0b3a6d3702a7b5cc8e1680dac2ae1bc2474569dcd5eb84f33e8563dbad0fc7a574cc71e69a
7
- data.tar.gz: bc2f67423f8ff100f0f883b5dd4047ff1728f11e4ae709c0d1fa2d990ae0f75a8e380e47d7640a9a9353d9865e5c9efa78600e9e7e9d34cf04094557586cb666
6
+ metadata.gz: a19db9f0d33d7b4a376c3e54d3d08f58dad4c891f1349f5c4edb26e04e16b8b21aadf766fcaaef28d16fb113959d755676fa4e5b3fa7d04dc631b99cfffcb02c
7
+ data.tar.gz: 723b0bb560e8fb0a229b131abba0ee984bb84f6aeb21500fa3dc9d7d25157a0d457f430ada57a8c3737d24218e95e3873efc317a0140da62624aac2cc295fa6f
@@ -1,5 +1,6 @@
1
1
  require:
2
2
  - './lib/simplycop/custom_cops/timecop_without_block.rb'
3
+ - './lib/simplycop/custom_cops/dont_print_all_env.rb'
3
4
 
4
5
  AllCops:
5
6
  ExtraDetails: true
@@ -9,3 +10,8 @@ CustomCops/TimecopWithoutBlock:
9
10
  Details: >-
10
11
  Time in all tests is faked to be midday. Using `Timecop.return` rather than the block format will spoil that for all subsequent tests.
11
12
  `https://github.com/simplybusiness/chopin/pull/10607`
13
+
14
+ CustomCops/DontPrintAllEnv:
15
+ Enabled: true
16
+ Details: >-
17
+ This cop checks if someone accidentally print all environment variables as they may contain secrets.
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: bundler
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ time: "05:00"
8
+ open-pull-requests-limit: 99
9
+ labels:
10
+ - dependencies
11
+ - package-ecosystem: github-actions
12
+ directory: "/"
13
+ schedule:
14
+ interval: daily
15
+ time: "05:00"
16
+ open-pull-requests-limit: 99
17
+ labels:
18
+ - dependencies
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-18.04
12
12
 
13
13
  steps:
14
- - uses: simplybusiness/version-forget-me-not@v1
14
+ - uses: simplybusiness/version-forget-me-not@v2
15
15
  env:
16
16
  ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17
17
  VERSION_FILE_PATH: "lib/simplycop/version.rb"
@@ -18,436 +18,395 @@ AllCops:
18
18
  DisplayStyleGuide: true
19
19
  UseCache: true
20
20
  MaxFilesInCache: 5000
21
+ ExtraDetails: true
21
22
  # Adapted from: https://github.com/simplybusiness/how-we-roll/blob/master/development/RUBYSTYLEGUIDE.markdown
22
23
 
23
- Naming/VariableName:
24
+ Layout/EmptyLineAfterMultilineCondition:
24
25
  Enabled: true
25
- EnforcedStyle: snake_case
26
- SupportedStyles:
27
- - snake_case
28
- - camelCase
29
26
 
30
- Naming/FileName:
27
+ Layout/FirstArrayElementLineBreak:
31
28
  Enabled: true
32
29
 
33
- Layout/TrailingEmptyLines:
30
+ Layout/FirstMethodArgumentLineBreak:
34
31
  Enabled: true
35
- Severity: warning
36
32
 
37
- Layout/TrailingWhitespace:
33
+ Layout/FirstHashElementLineBreak:
38
34
  Enabled: true
39
- Severity: warning
40
35
 
41
- Lint/DuplicateMethods:
36
+ Layout/HeredocArgumentClosingParenthesis:
42
37
  Enabled: true
43
- Severity: warning
44
38
 
45
- Style/SpecialGlobalVars:
39
+ Layout/SpaceBeforeBrackets:
46
40
  Enabled: true
47
- Severity: warning
48
-
49
- Style/ColonMethodCall:
50
- Enabled: true
51
- Severity: warning
52
41
 
53
- Style/RedundantReturn:
54
- Enabled: true
55
- Severity: warning
42
+ ###### COPS REVIEWED ABOVE THIS LINE ######
56
43
 
57
- Style/NestedParenthesizedCalls:
44
+ Lint/AmbiguousAssignment:
58
45
  Enabled: true
59
46
 
60
- Layout/MultilineMethodCallIndentation:
61
- Enabled: true
47
+ Lint/AmbiguousBlockAssociation:
48
+ Exclude:
49
+ - spec/**/*
62
50
 
63
- Style/RedundantParentheses:
51
+ Lint/AmbiguousOperator:
64
52
  Enabled: true
65
53
 
66
- Style/RedundantInterpolation:
67
- Enabled: false
68
-
69
- Layout/AssignmentIndentation:
54
+ Lint/AmbiguousRegexpLiteral:
70
55
  Enabled: true
71
56
 
72
- Style/MutableConstant:
73
- Enabled: false
74
-
75
- Style/ZeroLengthPredicate:
57
+ Lint/BinaryOperatorWithIdenticalOperands:
76
58
  Enabled: true
77
59
 
78
- Style/ConditionalAssignment:
60
+ Lint/CircularArgumentReference:
79
61
  Enabled: true
80
62
 
81
- Style/NestedModifier:
63
+ Lint/ConstantDefinitionInBlock:
82
64
  Enabled: true
65
+ Exclude:
66
+ - spec/**/*.rb
83
67
 
84
- Style/IfInsideElse:
68
+ Lint/DeprecatedClassMethods:
85
69
  Enabled: true
86
70
 
87
- Lint/IneffectiveAccessModifier:
88
- Enabled: false
89
-
90
- Lint/ImplicitStringConcatenation:
71
+ Lint/DeprecatedConstants:
91
72
  Enabled: true
92
73
 
93
- Lint/UselessAssignment:
74
+ Lint/DeprecatedOpenSSLConstant:
94
75
  Enabled: true
95
- Severity: warning
96
76
 
97
- Lint/UnusedBlockArgument:
77
+ Lint/DuplicateBranch:
98
78
  Enabled: true
99
- Severity: warning
100
79
 
101
- Lint/UnderscorePrefixedVariableName:
80
+ Lint/DuplicateElsifCondition:
102
81
  Enabled: true
103
- Severity: warning
104
82
 
105
- Style/Documentation:
106
- Enabled: false
107
-
108
- Layout/SpaceInsideBlockBraces:
83
+ Lint/DuplicateHashKey:
109
84
  Enabled: false
110
85
 
111
- Layout/SpaceInsideArrayLiteralBrackets:
112
- Enabled: true
113
-
114
- Layout/SpaceInsideReferenceBrackets:
86
+ Lint/DuplicateMethods:
115
87
  Enabled: true
88
+ Severity: warning
116
89
 
117
- Layout/SpaceInsideHashLiteralBraces:
118
- Enabled: false
119
-
120
- Layout/SpaceInsideParens:
90
+ Lint/DuplicateRegexpCharacterClassElement:
121
91
  Enabled: true
122
92
 
123
- Layout/SpaceBeforeComma:
93
+ Lint/DuplicateRequire:
124
94
  Enabled: true
125
95
 
126
- Layout/IndentationConsistency:
96
+ Lint/DuplicateRescueException:
127
97
  Enabled: true
128
98
 
129
- Layout/CaseIndentation:
99
+ Lint/EmptyBlock:
130
100
  Enabled: true
131
101
 
132
- Style/MethodDefParentheses:
102
+ Lint/EmptyClass:
133
103
  Enabled: true
134
104
 
135
- Style/MultilineTernaryOperator:
105
+ Lint/EmptyConditionalBody:
136
106
  Enabled: true
137
107
 
138
- Style/NestedTernaryOperator:
108
+ Lint/EmptyFile:
139
109
  Enabled: true
140
110
 
141
- Style/UnlessElse:
111
+ Lint/FloatComparison:
142
112
  Enabled: true
143
113
 
144
- Style/SymbolArray:
145
- EnforcedStyle: brackets
146
-
147
- Style/WordArray:
148
- EnforcedStyle: brackets
149
-
150
- Style/ParenthesesAroundCondition:
114
+ Lint/IdentityComparison:
151
115
  Enabled: true
152
116
 
153
- Layout/MultilineBlockLayout:
117
+ Lint/ImplicitStringConcatenation:
154
118
  Enabled: true
155
119
 
156
- Layout/InitialIndentation:
157
- Enabled: true
120
+ Lint/IneffectiveAccessModifier:
121
+ Enabled: false
158
122
 
159
- Style/OptionalArguments:
123
+ Lint/LambdaWithoutLiteralBlock:
160
124
  Enabled: true
161
125
 
162
- Lint/DuplicateHashKey:
126
+ Lint/MissingSuper:
163
127
  Enabled: false
164
128
 
165
- Lint/CircularArgumentReference:
129
+ Lint/MixedRegexpCaptureTypes:
166
130
  Enabled: true
167
131
 
168
- Lint/AmbiguousOperator:
132
+ Lint/NoReturnInBeginEndBlocks:
169
133
  Enabled: true
170
134
 
171
- Lint/AmbiguousRegexpLiteral:
135
+ Lint/OutOfRangeRegexpRef:
172
136
  Enabled: true
173
137
 
174
- Layout/BlockAlignment:
138
+ Lint/RaiseException:
175
139
  Enabled: true
176
140
 
177
- Layout/DefEndAlignment:
141
+ Lint/RedundantDirGlobSort:
178
142
  Enabled: true
179
143
 
180
- Lint/DeprecatedClassMethods:
144
+ Lint/SelfAssignment:
181
145
  Enabled: true
182
146
 
183
- Layout/EndAlignment:
147
+ Lint/StructNewOverride:
184
148
  Enabled: true
185
149
 
186
- Lint/UselessAccessModifier:
187
- Enabled: false
188
-
189
- Lint/Void:
150
+ Lint/ToEnumArguments:
190
151
  Enabled: true
191
152
 
192
- Style/Alias:
193
- Enabled: false
194
-
195
- Layout/SpaceAroundBlockParameters:
153
+ Lint/TopLevelReturnWithArgument:
196
154
  Enabled: true
197
155
 
198
- Layout/SpaceAroundEqualsInParameterDefault:
156
+ Lint/TrailingCommaInAttributeDeclaration:
199
157
  Enabled: true
200
158
 
201
- Style/RedundantBegin:
159
+ Lint/UnderscorePrefixedVariableName:
202
160
  Enabled: true
161
+ Severity: warning
203
162
 
204
- Style/RedundantException:
163
+ Lint/UnexpectedBlockArity:
205
164
  Enabled: true
206
165
 
207
- Layout/EmptyLines:
166
+ Lint/UnmodifiedReduceAccumulator:
208
167
  Enabled: true
209
168
 
210
- Style/SelfAssignment:
169
+ Lint/UnreachableLoop:
211
170
  Enabled: true
212
171
 
213
- Style/LambdaCall:
172
+ Lint/UnusedBlockArgument:
214
173
  Enabled: true
174
+ Severity: warning
215
175
 
216
- Metrics/ModuleLength:
217
- Enabled: true
176
+ Lint/UselessAccessModifier:
177
+ Enabled: false
218
178
 
219
- Style/For:
179
+ Lint/UselessAssignment:
220
180
  Enabled: true
181
+ Severity: warning
221
182
 
222
- Layout/ExtraSpacing:
223
- Enabled: false
224
-
225
- Style/GuardClause:
226
- Enabled: false
183
+ Lint/UselessMethodDefinition:
184
+ Enabled: true
227
185
 
228
- Style/FrozenStringLiteralComment:
229
- Enabled: false
186
+ Lint/UselessTimes:
187
+ Enabled: true
230
188
 
231
- Style/StringLiterals:
232
- Enabled: false
189
+ Lint/Void:
190
+ Enabled: true
233
191
 
192
+ Metrics/BlockLength:
193
+ Exclude:
194
+ - spec/**/*.rb
195
+ -
234
196
  Metrics/ClassLength:
235
197
  Max: 512
236
198
  Enabled: true
237
199
 
238
- Layout/LineLength:
200
+ Metrics/ModuleLength:
239
201
  Enabled: true
240
- Max: 120
241
202
 
242
- Layout/ArgumentAlignment:
203
+ Naming/FileName:
243
204
  Enabled: true
244
205
 
245
- Style/HashEachMethods:
246
- Enabled: false
247
-
248
- Style/HashTransformKeys:
206
+ Naming/VariableName:
249
207
  Enabled: true
208
+ EnforcedStyle: snake_case
209
+ SupportedStyles:
210
+ - snake_case
211
+ - camelCase
250
212
 
251
- Style/HashTransformValues:
213
+ Style/AccessorGrouping:
252
214
  Enabled: true
253
215
 
254
- Layout/EmptyLinesAroundAttributeAccessor:
255
- Enabled: true
216
+ Style/Alias:
217
+ Enabled: false
256
218
 
257
- Layout/SpaceAroundMethodCallOperator:
219
+ Style/ArgumentsForwarding:
258
220
  Enabled: true
259
221
 
260
- Lint/DeprecatedOpenSSLConstant:
222
+ Style/ArrayCoercion:
261
223
  Enabled: true
262
224
 
263
- Lint/DuplicateElsifCondition:
225
+ Style/BisectedAttrAccessor:
264
226
  Enabled: true
265
227
 
266
- Lint/MixedRegexpCaptureTypes:
228
+ Style/CaseLikeIf:
267
229
  Enabled: true
268
230
 
269
- Lint/RaiseException:
231
+ Style/CollectionCompact:
270
232
  Enabled: true
271
233
 
272
- Lint/StructNewOverride:
234
+ Style/ColonMethodCall:
273
235
  Enabled: true
236
+ Severity: warning
274
237
 
275
- Style/AccessorGrouping:
238
+ Style/CombinableLoops:
276
239
  Enabled: true
277
240
 
278
- Style/ArrayCoercion:
241
+ Style/ConditionalAssignment:
279
242
  Enabled: true
280
243
 
281
- Style/BisectedAttrAccessor:
244
+ Style/DocumentDynamicEvalDefinition:
245
+ Enabled: false
246
+
247
+ Style/Documentation:
248
+ Enabled: false
249
+
250
+ Style/EndlessMethod:
282
251
  Enabled: true
283
252
 
284
- Style/CaseLikeIf:
253
+ Style/ExplicitBlockArgument:
285
254
  Enabled: true
286
255
 
287
256
  Style/ExponentialNotation:
288
257
  Enabled: false
289
258
 
290
- Style/HashAsLastArrayItem:
259
+ Style/For:
291
260
  Enabled: true
292
261
 
293
- Style/HashLikeCase:
262
+ Style/FormatString:
294
263
  Enabled: false
295
264
 
296
- Style/RedundantAssignment:
297
- Enabled: true
265
+ Style/FormatStringToken:
266
+ Enabled: false
298
267
 
299
- Style/RedundantFetchBlock:
300
- Enabled: true
268
+ Style/FrozenStringLiteralComment:
269
+ Enabled: false
301
270
 
302
- Style/RedundantFileExtensionInRequire:
271
+ Style/GlobalStdStream:
303
272
  Enabled: true
304
273
 
305
- Style/RedundantRegexpCharacterClass:
306
- Enabled: true
274
+ Style/GuardClause:
275
+ Enabled: false
307
276
 
308
- Style/RedundantRegexpEscape:
277
+ Style/HashAsLastArrayItem:
309
278
  Enabled: true
310
279
 
311
- Style/SlicingWithRange:
280
+ Style/HashEachMethods:
312
281
  Enabled: false
313
282
 
314
- Layout/BeginEndAlignment:
283
+ Style/HashExcept:
315
284
  Enabled: true
316
285
 
317
- Lint/BinaryOperatorWithIdenticalOperands:
318
- Enabled: true
286
+ Style/HashLikeCase:
287
+ Enabled: false
319
288
 
320
- Lint/ConstantDefinitionInBlock:
289
+ Style/HashTransformKeys:
321
290
  Enabled: true
322
- Exclude:
323
- - spec/**/*.rb
324
291
 
325
- Lint/DuplicateRequire:
292
+ Style/HashTransformValues:
326
293
  Enabled: true
327
294
 
328
- Lint/DuplicateRescueException:
295
+ Style/IfInsideElse:
329
296
  Enabled: true
330
297
 
331
- Lint/EmptyConditionalBody:
298
+ Style/KeywordParametersOrder:
332
299
  Enabled: true
333
300
 
334
- Lint/EmptyFile:
301
+ Style/LambdaCall:
335
302
  Enabled: true
336
303
 
337
- Lint/FloatComparison:
304
+ Style/MethodDefParentheses:
338
305
  Enabled: true
339
306
 
340
- Lint/IdentityComparison:
307
+ Style/MultilineTernaryOperator:
341
308
  Enabled: true
342
309
 
343
- Lint/MissingSuper:
310
+ Style/MutableConstant:
344
311
  Enabled: false
345
312
 
346
- Lint/OutOfRangeRegexpRef:
313
+ Style/NegatedIfElseCondition:
347
314
  Enabled: true
348
315
 
349
- Lint/SelfAssignment:
316
+ Style/NestedModifier:
350
317
  Enabled: true
351
318
 
352
- Lint/TopLevelReturnWithArgument:
319
+ Style/NestedParenthesizedCalls:
353
320
  Enabled: true
354
321
 
355
- Lint/TrailingCommaInAttributeDeclaration:
322
+ Style/NestedTernaryOperator:
356
323
  Enabled: true
357
324
 
358
- Lint/UnreachableLoop:
325
+ Style/NilLambda:
359
326
  Enabled: true
360
327
 
361
- Lint/UselessMethodDefinition:
362
- Enabled: true
328
+ Style/NumericPredicate:
329
+ Enabled: false
363
330
 
364
- Lint/UselessTimes:
331
+ Style/OptionalArguments:
365
332
  Enabled: true
366
333
 
367
- Style/CombinableLoops:
334
+ Style/OptionalBooleanParameter:
368
335
  Enabled: true
369
336
 
370
- Style/ExplicitBlockArgument:
337
+ Style/ParenthesesAroundCondition:
371
338
  Enabled: true
372
339
 
373
- Style/GlobalStdStream:
340
+ Style/RedundantArgument:
374
341
  Enabled: true
375
342
 
376
- Style/KeywordParametersOrder:
343
+ Style/RedundantAssignment:
377
344
  Enabled: true
378
345
 
379
- Style/OptionalBooleanParameter:
346
+ Style/RedundantBegin:
380
347
  Enabled: true
381
348
 
382
- Style/RedundantSelfAssignment:
349
+ Style/RedundantException:
383
350
  Enabled: true
384
351
 
385
- Style/SingleArgumentDig:
352
+ Style/RedundantFetchBlock:
386
353
  Enabled: true
387
354
 
388
- Style/SoleNestedConditional:
355
+ Style/RedundantFileExtensionInRequire:
389
356
  Enabled: true
390
357
 
391
- Style/StringConcatenation:
392
- Enabled: true
358
+ Style/RedundantInterpolation:
359
+ Enabled: false
393
360
 
394
- Lint/DuplicateRegexpCharacterClassElement:
361
+ Style/RedundantParentheses:
395
362
  Enabled: true
396
363
 
397
- Lint/EmptyBlock:
364
+ Style/RedundantRegexpCharacterClass:
398
365
  Enabled: true
399
366
 
400
- Lint/ToEnumArguments:
367
+ Style/RedundantRegexpEscape:
401
368
  Enabled: true
402
369
 
403
- Lint/UnmodifiedReduceAccumulator:
370
+ Style/RedundantReturn:
404
371
  Enabled: true
372
+ Severity: warning
405
373
 
406
- Style/ArgumentsForwarding:
374
+ Style/RedundantSelfAssignment:
407
375
  Enabled: true
408
376
 
409
- Style/DocumentDynamicEvalDefinition:
410
- Enabled: false
411
-
412
- Style/SwapValues:
377
+ Style/SelfAssignment:
413
378
  Enabled: true
414
379
 
415
- Lint/AmbiguousBlockAssociation:
416
- Exclude:
417
- - spec/**/*
418
-
419
- Layout/FirstHashElementIndentation:
420
- EnforcedStyle: consistent
421
-
422
- Style/FormatString:
423
- Enabled: false
424
-
425
- Style/FormatStringToken:
426
- Enabled: false
380
+ Style/SingleArgumentDig:
381
+ Enabled: true
427
382
 
428
- Style/NumericPredicate:
383
+ Style/SlicingWithRange:
429
384
  Enabled: false
430
385
 
431
- Lint/NoReturnInBeginEndBlocks:
386
+ Style/SoleNestedConditional:
432
387
  Enabled: true
433
388
 
434
- Style/CollectionCompact:
389
+ Style/SpecialGlobalVars:
435
390
  Enabled: true
391
+ Severity: warning
436
392
 
437
- Style/NegatedIfElseCondition:
393
+ Style/StringConcatenation:
438
394
  Enabled: true
439
395
 
440
- Lint/DuplicateBranch:
441
- Enabled: true
396
+ Style/StringLiterals:
397
+ Enabled: false
442
398
 
443
- Lint/EmptyClass:
444
- Enabled: true
445
-
446
- Style/NilLambda:
399
+ Style/SwapValues:
447
400
  Enabled: true
448
401
 
449
- Lint/UnexpectedBlockArity:
402
+ Style/SymbolArray:
403
+ EnforcedStyle: brackets
404
+
405
+ Style/UnlessElse:
450
406
  Enabled: true
451
407
 
452
- Style/RedundantArgument:
408
+ Style/WordArray:
409
+ EnforcedStyle: brackets
410
+
411
+ Style/ZeroLengthPredicate:
453
412
  Enabled: true
@@ -1,6 +1,3 @@
1
- AllCops:
2
- ExtraDetails: true
3
-
4
1
  require:
5
2
  - './lib/simplycop/custom_cops/constantize.rb'
6
3
  - './lib/simplycop/custom_cops/define_method.rb'
@@ -1,64 +1,20 @@
1
1
  require:
2
2
  - rubocop-rails
3
3
 
4
- AllCops:
5
- Exclude:
6
- - 'db/schema.rb'
7
- - 'vendor/**/*'
8
-
9
- # Cop names are not displayed in offense messages by default. Change behavior
10
- # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
11
- # option.
12
- DisplayCopNames: true
13
- # Style guide URLs are not displayed in offense messages by default. Change
14
- # behavior by overriding DisplayStyleGuide, or by giving the
15
- # -S/--display-style-guide option.
16
- DisplayStyleGuide: true
17
- UseCache: true
18
- MaxFilesInCache: 5000
19
- # Adapted from: https://github.com/simplybusiness/how-we-roll/blob/master/development/RUBYSTYLEGUIDE.markdown
20
-
21
- Rails:
22
- Enabled: true
23
-
24
- ## Rails Cops
25
- Rails/TimeZone:
26
- Enabled: true
27
- Severity: warning
28
-
29
- Rails/Date:
30
- Enabled: true
31
- Severity: warning
32
-
33
- Rails/Delegate:
34
- Enabled: false
35
-
36
- Rails/Output:
37
- Enabled: true
38
-
39
- Rails/Validation:
40
- Enabled: true
41
-
42
- Rails/FindBy:
43
- Enabled: true
44
-
45
- Rails/ActionFilter:
46
- Enabled: true
47
-
48
- Rails/ReadWriteAttribute:
4
+ Rails/ActiveRecordCallbacksOrder:
49
5
  Enabled: true
50
6
 
51
- Rails/PluralizationGrammar:
7
+ Rails/AfterCommitOverride:
52
8
  Enabled: true
53
9
 
54
- Rails/SkipsModelValidations:
10
+ Rails/AttributeDefaultBlockValue:
55
11
  Enabled: true
56
12
 
57
- Rails/ActiveRecordCallbacksOrder:
13
+ Rails/DefaultScope:
58
14
  Enabled: true
59
15
 
60
- Rails/AfterCommitOverride:
61
- Enabled: true
16
+ Rails/Delegate:
17
+ Enabled: false
62
18
 
63
19
  Rails/FindById:
64
20
  Enabled: true
@@ -75,9 +31,11 @@ Rails/MatchRoute:
75
31
  Rails/NegateInclude:
76
32
  Enabled: true
77
33
 
34
+ # Conflicts with Mongoid
78
35
  Rails/Pluck:
79
36
  Enabled: false
80
37
 
38
+ # Conflicts with Mongoid
81
39
  Rails/PluckInWhere:
82
40
  Enabled: false
83
41
 
@@ -93,17 +51,13 @@ Rails/ShortI18n:
93
51
  Rails/SquishedSQLHeredocs:
94
52
  Enabled: true
95
53
 
54
+ Rails/WhereEquals:
55
+ Enabled: true
56
+
57
+ # Conflicts with Mongoid
96
58
  Rails/WhereExists:
97
59
  Enabled: false
98
60
 
61
+ # Conflicts with Mongoid
99
62
  Rails/WhereNot:
100
63
  Enabled: false
101
-
102
- Rails/WhereEquals:
103
- Enabled: true
104
-
105
- Rails/AttributeDefaultBlockValue:
106
- Enabled: true
107
-
108
- Rails/ArelStar:
109
- Enabled: true
@@ -1,234 +1,48 @@
1
1
  require:
2
2
  - rubocop-rspec
3
3
 
4
- RSpec/ContextMethod:
5
- Enabled: false
6
-
7
- RSpec/LeakyConstantDeclaration:
8
- Enabled: false
9
-
10
- RSpec/EmptyLineAfterExample:
11
- Enabled: false
12
-
13
- RSpec/AnyInstance:
14
- Description: Check that instances are not being stubbed globally.
15
- Enabled: true
16
-
17
- RSpec/AroundBlock:
18
- Description: Checks that around blocks actually run the test.
19
- Enabled: true
20
-
21
- RSpec/BeEql:
22
- Description: Check for expectations where `be(...)` can replace `eql(...)`.
23
- Enabled: true
24
-
25
4
  RSpec/BeforeAfterAll:
26
- Description: Check that before/after(:all) isn't being used.
27
5
  Enabled: false
28
6
 
29
7
  RSpec/DescribeClass:
30
- Description: Check that the first argument to the top level describe is a constant.
31
- Enabled: false
32
-
33
- RSpec/DescribedClass:
34
- Description: Checks that tests use `described_class`.
35
- SkipBlocks: false
36
8
  Enabled: false
37
- EnforcedStyle: described_class
38
- SupportedStyles:
39
- - described_class
40
- - explicit
41
9
 
42
10
  RSpec/DescribeMethod:
43
- Description: Checks that the second argument to `describe` specifies a method.
44
- Enabled: false
45
-
46
- RSpec/DescribeSymbol:
47
- Description: Avoid describing symbols.
48
11
  Enabled: false
49
12
 
50
- RSpec/IteratedExpectation:
51
- Description: Check that `all` matcher is used instead of iterating over an array.
52
- Enabled: true
53
-
54
- RSpec/EmptyExampleGroup:
55
- Description: Checks if an example group does not include any tests.
56
- Enabled: true
57
-
58
- RSpec/EmptyLineAfterFinalLet:
59
- Description: Checks if there is an empty line after the last let block.
60
- Enabled: false
61
-
62
- RSpec/EmptyLineAfterSubject:
63
- Description: Checks if there is an empty line after subject block.
13
+ RSpec/DescribedClass:
64
14
  Enabled: false
65
15
 
66
16
  RSpec/ExampleLength:
67
- Description: Checks for long examples.
68
17
  Enabled: false
69
- Max: 5
70
-
71
- RSpec/ExampleWording:
72
- Description: Checks for common mistakes in example descriptions.
73
- Enabled: true
74
- CustomTransform:
75
- be: is
76
- BE: IS
77
- have: has
78
- HAVE: HAS
79
- IgnoredWords: []
80
-
81
- RSpec/ExpectActual:
82
- Description: Checks for `expect(...)` calls containing literal values.
83
- Enabled: true
84
18
 
85
19
  RSpec/ExpectOutput:
86
- Description: Checks for opportunities to use `expect { ... }.to output`.
87
20
  Enabled: false
88
21
 
89
22
  RSpec/FilePath:
90
- Description: Checks that spec file paths are consistent with the test subject.
91
- Enabled: false
92
- CustomTransform:
93
- RuboCop: rubocop
94
- RSpec: rspec
95
- IgnoreMethods: false
96
-
97
- RSpec/Focus:
98
- Description: Checks if examples are focused.
99
- Enabled: false
100
-
101
- RSpec/HookArgument:
102
- Description: Checks the arguments passed to `before`, `around`, and `after`.
103
- Enabled: true
104
- EnforcedStyle: implicit
105
- SupportedStyles:
106
- - implicit
107
- - each
108
- - example
109
-
110
- RSpec/ImplicitExpect:
111
- Description: Check that a consistent implicit expectation style is used.
112
- Enabled: true
113
- EnforcedStyle: is_expected
114
- SupportedStyles:
115
- - is_expected
116
- - should
117
-
118
- RSpec/InstanceSpy:
119
- Description: Checks for `instance_double` used with `have_received`.
120
23
  Enabled: false
121
24
 
122
25
  RSpec/InstanceVariable:
123
- Description: Checks for instance variable usage in specs.
124
- AssignmentOnly: false
125
26
  Enabled: false
126
27
 
127
- RSpec/ItBehavesLike:
128
- Description: Checks that only one `it_behaves_like` style is used.
129
- Enabled: true
130
- EnforcedStyle: it_behaves_like
131
- SupportedStyles:
132
- - it_behaves_like
133
- - it_should_behave_like
134
-
135
- RSpec/LeadingSubject:
136
- Description: Checks for `subject` definitions that come after `let` definitions.
137
- Enabled: true
138
-
139
- RSpec/LetSetup:
140
- Description: Checks unreferenced `let!` calls being used for test setup.
141
- Enabled: true
142
-
143
- RSpec/MessageChain:
144
- Description: Check that chains of messages are not being stubbed.
145
- Enabled: true
146
-
147
- RSpec/MessageExpectation:
148
- Description: Checks for consistent message expectation style.
149
- Enabled: false
150
- EnforcedStyle: allow
151
- SupportedStyles:
152
- - allow
153
- - expect
154
-
155
28
  RSpec/MessageSpies:
156
- Description: Checks that message expectations are set using spies.
157
29
  Enabled: false
158
- EnforcedStyle: have_received
159
- SupportedStyles:
160
- - have_received
161
- - receive
162
-
163
- RSpec/MultipleDescribes:
164
- Description: Checks for multiple top level describes.
165
- Enabled: true
166
30
 
167
31
  RSpec/MultipleExpectations:
168
- Description: Checks if examples contain too many `expect` calls.
169
32
  Enabled: false
170
- Max: 1
171
33
 
172
34
  RSpec/MultipleMemoizedHelpers:
173
35
  Enabled: false
174
36
 
175
- RSpec/NamedSubject:
176
- Description: Checks for explicitly referenced test subjects.
177
- Enabled: true
178
-
179
37
  RSpec/NestedGroups:
180
- Description: Checks for nested example groups.
181
38
  Enabled: true
182
39
  Max: 4
183
40
 
184
41
  RSpec/NotToNot:
185
- Description: Checks for consistent method usage for negating expectations.
186
- EnforcedStyle: not_to
187
- SupportedStyles:
188
- - not_to
189
- - to_not
190
42
  Enabled: false
191
43
 
192
- RSpec/OverwritingSetup:
193
- Enabled: true
194
- Description: Checks if there is a let/subject that overwrites an existing one.
195
-
196
- RSpec/RepeatedDescription:
197
- Enabled: true
198
- Description: Check for repeated description strings in example groups.
199
-
200
- RSpec/RepeatedExample:
201
- Enabled: true
202
- Description: Check for repeated examples within example groups.
203
-
204
- RSpec/SharedContext:
205
- Description: Checks for proper shared_context and shared_examples usage.
206
- Enabled: true
207
-
208
- RSpec/SingleArgumentMessageChain:
209
- Description: Checks that chains of messages contain more than one element.
210
- Enabled: true
211
-
212
- RSpec/ScatteredLet:
213
- Description: Checks for let scattered across the example group.
214
- Enabled: true
215
-
216
44
  RSpec/ScatteredSetup:
217
- Description: Checks for setup scattered across multiple hooks in an example group.
218
- Enabled: false
219
-
220
- RSpec/SubjectStub:
221
- Description: Checks for stubbed test subjects.
222
- Enabled: true
223
-
224
- RSpec/VerifiedDoubles:
225
- Description: Prefer using verifying doubles over normal doubles.
226
45
  Enabled: false
227
- IgnoreSymbolicNames: true
228
-
229
- Metrics/BlockLength:
230
- Exclude:
231
- - 'spec/**/*.rb'
232
46
 
233
47
  RSpec/StubbedMock:
234
48
  Enabled: false
@@ -3,9 +3,6 @@ require:
3
3
  - './lib/simplycop/security/reject_all_requests_local.rb'
4
4
  - './lib/simplycop/security/check_for_vulnerable_code.rb'
5
5
 
6
- AllCops:
7
- ExtraDetails: true
8
-
9
6
  Security/CSRFTokenValidation:
10
7
  Enabled: true
11
8
  Details: >-
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CustomCops
4
+ class DontPrintAllEnv < RuboCop::Cop::Cop
5
+ # This cop checks if someone accidentally print all environment variables
6
+ # because some of them may contain secrets.
7
+ #
8
+ # @example
9
+ # # bad
10
+ # puts ENV.to_h
11
+ # puts `env`
12
+ # puts ENVIRON.to_h
13
+ #
14
+ # # good
15
+ # puts ENV['SOME_KEY']
16
+ # puts ENVIRON['SOME_KEY']
17
+ MSG = 'Printing all Environment Variables is extremely risky'\
18
+ ' If this code has been run, then it is likely that secrets have been'\
19
+ ' exposed in plaintext. Please alert `#infosec` about this so it can be'\
20
+ ' investigated immediately.'\
21
+
22
+ def_node_matcher :convert_env_to_hash_or_array?, <<~PATTERN
23
+ (send (const nil? {:ENVIRON :ENV}) {:to_h :to_a :to_hash})
24
+ PATTERN
25
+
26
+ def_node_matcher :print_all_env_shell?, <<~PATTERN
27
+ (send nil? {:puts :p :print} (xstr(str "env")))
28
+ PATTERN
29
+
30
+ def on_send(node)
31
+ return unless convert_env_to_hash_or_array?(node) || print_all_env_shell?(node)
32
+
33
+ add_offense(node, location: :selector)
34
+ end
35
+ end
36
+ end
@@ -7,5 +7,5 @@
7
7
  #
8
8
 
9
9
  module Simplycop
10
- VERSION = '1.2.0'
10
+ VERSION = '1.5.0'
11
11
  end
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency 'rubocop', '~> 1.6.1'
20
+ spec.add_dependency 'rubocop', '~> 1.8.1'
21
21
  spec.add_dependency 'rubocop-rails', '~> 2.9.0'
22
- spec.add_dependency 'rubocop-rspec', '~> 2.0.1'
22
+ spec.add_dependency 'rubocop-rspec', '~> 2.1.0'
23
23
  spec.add_development_dependency 'bundler'
24
24
  spec.add_development_dependency 'rake', '>= 12.3.3'
25
25
  spec.add_development_dependency 'rspec', '~> 3.10'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplycop
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-15 00:00:00.000000000 Z
11
+ date: 2021-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.6.1
19
+ version: 1.8.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.6.1
26
+ version: 1.8.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rubocop-rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.0.1
47
+ version: 2.1.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.0.1
54
+ version: 2.1.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +103,7 @@ extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
105
  - ".custom_simplycop.yml"
106
+ - ".github/dependabot.yml"
106
107
  - ".github/workflows/ci.yml"
107
108
  - ".github/workflows/publish_gem.yml"
108
109
  - ".github/workflows/version_forget_me_not.yml"
@@ -124,6 +125,7 @@ files:
124
125
  - lib/simplycop.rb
125
126
  - lib/simplycop/custom_cops/constantize.rb
126
127
  - lib/simplycop/custom_cops/define_method.rb
128
+ - lib/simplycop/custom_cops/dont_print_all_env.rb
127
129
  - lib/simplycop/custom_cops/instance_eval.rb
128
130
  - lib/simplycop/custom_cops/method_missing.rb
129
131
  - lib/simplycop/custom_cops/timecop_without_block.rb
@@ -152,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
154
  - !ruby/object:Gem::Version
153
155
  version: '0'
154
156
  requirements: []
155
- rubygems_version: 3.1.4
157
+ rubygems_version: 3.2.3
156
158
  signing_key:
157
159
  specification_version: 4
158
160
  summary: Provides a single point of reference for common rubocop rules.