scrubba 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2fad6478c28b93b323d700ab5f92b02a5693d7b6
4
+ data.tar.gz: a5ecff169902c3da492f0b1a9aaece26ec6a45a2
5
+ SHA512:
6
+ metadata.gz: f10b5c034de3041751c1419092006251fafb4e0ea757820c28a94969cf10fc477e0288040441530c086bebee431d9784b258d8e0922af58d4da83c842cca4ebe
7
+ data.tar.gz: 8da73c23ed34f140261c663f0e711f6e36c374f984da734441a8f090e7cd00af98093c5b02e72324267b7fa6f1d09eb31be003d0183426b31235316bf101321c
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,812 @@
1
+ Style/AccessModifierIndentation:
2
+ Description: Check indentation of private/protected visibility modifiers.
3
+ Enabled: true
4
+
5
+ Style/AccessorMethodName:
6
+ Description: Check the naming of accessor methods for get_/set_.
7
+ Enabled: false
8
+
9
+ Style/Alias:
10
+ Description: 'Use alias_method instead of alias.'
11
+ Enabled: false
12
+
13
+ Style/AlignArray:
14
+ Description: >-
15
+ Align the elements of an array literal if they span more than
16
+ one line.
17
+ Enabled: true
18
+
19
+ Style/AlignHash:
20
+ Description: >-
21
+ Align the elements of a hash literal if they span more than
22
+ one line.
23
+ Enabled: true
24
+
25
+ Style/AlignParameters:
26
+ Description: >-
27
+ Align the parameters of a method call if they span more
28
+ than one line.
29
+ Enabled: true
30
+
31
+ Style/AndOr:
32
+ Description: 'Use &&/|| instead of and/or.'
33
+ Enabled: true
34
+
35
+ Style/ArrayJoin:
36
+ Description: 'Use Array#join instead of Array#*.'
37
+ Enabled: false
38
+
39
+ Style/AsciiComments:
40
+ Description: 'Use only ascii symbols in comments.'
41
+ Enabled: false
42
+
43
+ Style/AsciiIdentifiers:
44
+ Description: 'Use only ascii symbols in identifiers.'
45
+ Enabled: false
46
+
47
+ Style/Attr:
48
+ Description: 'Checks for uses of Module#attr.'
49
+ Enabled: false
50
+
51
+ Style/BeginBlock:
52
+ Description: 'Avoid the use of BEGIN blocks.'
53
+ Enabled: true
54
+
55
+ Style/BarePercentLiterals:
56
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
57
+ Enabled: true
58
+
59
+ Style/BlockComments:
60
+ Description: 'Do not use block comments.'
61
+ Enabled: true
62
+
63
+ Style/BlockEndNewline:
64
+ Description: 'Put end statement of multiline block on its own line.'
65
+ Enabled: true
66
+
67
+ Style/BracesAroundHashParameters:
68
+ Description: 'Enforce braces style inside hash parameters.'
69
+ Enabled: true
70
+
71
+ Style/CaseEquality:
72
+ Description: 'Avoid explicit use of the case equality operator(===).'
73
+ Enabled: false
74
+
75
+ Style/CaseIndentation:
76
+ Description: 'Indentation of when in a case/when/[else/]end.'
77
+ Enabled: true
78
+
79
+ Style/CharacterLiteral:
80
+ Description: 'Checks for uses of character literals.'
81
+ Enabled: false
82
+
83
+ Style/ClassAndModuleCamelCase:
84
+ Description: 'Use CamelCase for classes and modules.'
85
+ Enabled: true
86
+
87
+ Style/ClassAndModuleChildren:
88
+ Description: 'Checks style of children classes and modules.'
89
+ Enabled: false
90
+
91
+ Style/ClassCheck:
92
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
93
+ Enabled: true
94
+
95
+ Style/ClassMethods:
96
+ Description: 'Use self when defining module/class methods.'
97
+ Enabled: true
98
+
99
+ Style/ClassVars:
100
+ Description: 'Avoid the use of class variables.'
101
+ Enabled: false
102
+
103
+ Style/CollectionMethods:
104
+ Description: 'Preferred collection methods.'
105
+ Enabled: true
106
+ PreferredMethods:
107
+ find: detect
108
+ reduce: reduce
109
+ collect: map
110
+ find_all: select
111
+
112
+ Style/ColonMethodCall:
113
+ Description: 'Do not use :: for method call.'
114
+ Enabled: false
115
+
116
+ Style/CommentAnnotation:
117
+ Description: >-
118
+ Checks formatting of special comments
119
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
120
+ Enabled: false
121
+
122
+ Style/CommentIndentation:
123
+ Description: 'Indentation of comments.'
124
+ Enabled: true
125
+
126
+ Style/ConstantName:
127
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
128
+ Enabled: true
129
+
130
+ Style/DefWithParentheses:
131
+ Description: 'Use def with parentheses when there are arguments.'
132
+ Enabled: true
133
+
134
+ Style/DeprecatedHashMethods:
135
+ Description: 'Checks for use of deprecated Hash methods.'
136
+ Enabled: false
137
+
138
+ Style/Documentation:
139
+ Description: 'Document classes and non-namespace modules.'
140
+ Enabled: false
141
+
142
+ Style/DotPosition:
143
+ Description: 'Checks the position of the dot in multi-line method calls.'
144
+ Enabled: true
145
+ EnforcedStyle: trailing
146
+
147
+ Style/DoubleNegation:
148
+ Description: 'Checks for uses of double negation (!!).'
149
+ Enabled: false
150
+
151
+ Style/EachWithObject:
152
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
153
+ Enabled: false
154
+
155
+ Style/EmptyLineBetweenDefs:
156
+ Description: 'Use empty lines between defs.'
157
+ Enabled: true
158
+
159
+ Style/EmptyLines:
160
+ Description: "Don't use several empty lines in a row."
161
+ Enabled: true
162
+
163
+ Style/EmptyLinesAroundAccessModifier:
164
+ Description: "Keep blank lines around access modifiers."
165
+ Enabled: true
166
+
167
+ # Style/EmptyLinesAroundBody:
168
+ # Description: "Keeps track of empty lines around expression bodies."
169
+ # Enabled: true
170
+
171
+ Style/EmptyLiteral:
172
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
173
+ Enabled: false
174
+
175
+ Style/Encoding:
176
+ Description: 'Use UTF-8 as the source file encoding.'
177
+ Enabled: false
178
+
179
+ Style/EndBlock:
180
+ Description: 'Avoid the use of END blocks.'
181
+ Enabled: true
182
+
183
+ Style/EndOfLine:
184
+ Description: 'Use Unix-style line endings.'
185
+ Enabled: true
186
+
187
+ Style/EvenOdd:
188
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
189
+ Enabled: false
190
+
191
+ Style/FileName:
192
+ Description: 'Use snake_case for source file names.'
193
+ Enabled: false
194
+
195
+ Style/FlipFlop:
196
+ Description: 'Checks for flip flops'
197
+ Enabled: false
198
+
199
+ Style/For:
200
+ Description: 'Checks use of for or each in multiline loops.'
201
+ Enabled: true
202
+
203
+ Style/FormatString:
204
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
205
+ Enabled: false
206
+
207
+ Style/GlobalVars:
208
+ Description: 'Do not introduce global variables.'
209
+ Enabled: false
210
+
211
+ Style/GuardClause:
212
+ Description: 'Check for conditionals that can be replaced with guard clauses'
213
+ Enabled: false
214
+
215
+ Style/HashSyntax:
216
+ Description: >-
217
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
218
+ { :a => 1, :b => 2 }.
219
+ Enabled: true
220
+
221
+ Style/IfUnlessModifier:
222
+ Description: >-
223
+ Favor modifier if/unless usage when you have a
224
+ single-line body.
225
+ Enabled: false
226
+
227
+ Style/IfWithSemicolon:
228
+ Description: 'Never use if x; .... Use the ternary operator instead.'
229
+ Enabled: false
230
+
231
+ Style/IndentationConsistency:
232
+ Description: 'Keep indentation straight.'
233
+ Enabled: true
234
+
235
+ Style/IndentationWidth:
236
+ Description: 'Use 2 spaces for indentation.'
237
+ Enabled: true
238
+
239
+ Style/IndentArray:
240
+ Description: >-
241
+ Checks the indentation of the first element in an array
242
+ literal.
243
+ Enabled: true
244
+
245
+ Style/IndentHash:
246
+ Description: 'Checks the indentation of the first key in a hash literal.'
247
+ Enabled: true
248
+
249
+ Style/InlineComment:
250
+ Description: 'Avoid inline comments.'
251
+ Enabled: false
252
+
253
+ Style/Lambda:
254
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
255
+ Enabled: false
256
+
257
+ Style/LambdaCall:
258
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
259
+ Enabled: false
260
+
261
+ Style/LeadingCommentSpace:
262
+ Description: 'Comments should start with a space.'
263
+ Enabled: true
264
+
265
+ Style/LineEndConcatenation:
266
+ Description: >-
267
+ Use \ instead of + or << to concatenate two string literals at
268
+ line end.
269
+ Enabled: false
270
+
271
+ Style/MethodCalledOnDoEndBlock:
272
+ Description: 'Avoid chaining a method call on a do...end block.'
273
+ Enabled: true
274
+
275
+ Style/MethodCallParentheses:
276
+ Description: 'Do not use parentheses for method calls with no arguments.'
277
+ Enabled: true
278
+
279
+ Style/MethodDefParentheses:
280
+ Description: >-
281
+ Checks if the method definitions have or don't have
282
+ parentheses.
283
+ Enabled: true
284
+
285
+ Style/MethodName:
286
+ Description: 'Use the configured style when naming methods.'
287
+ Enabled: true
288
+
289
+ Style/ModuleFunction:
290
+ Description: 'Checks for usage of `extend self` in modules.'
291
+ Enabled: false
292
+
293
+ Style/MultilineBlockChain:
294
+ Description: 'Avoid multi-line chains of blocks.'
295
+ Enabled: true
296
+
297
+ Style/MultilineBlockLayout:
298
+ Description: 'Ensures newlines after multiline block do statements.'
299
+ Enabled: true
300
+
301
+ Style/MultilineIfThen:
302
+ Description: 'Never use then for multi-line if/unless.'
303
+ Enabled: true
304
+
305
+ Style/MultilineOperationIndentation:
306
+ Enabled: true
307
+
308
+ Style/MultilineTernaryOperator:
309
+ Description: >-
310
+ Avoid multi-line ?: (the ternary operator);
311
+ use if/unless instead.
312
+ Enabled: true
313
+
314
+ Style/NegatedIf:
315
+ Description: >-
316
+ Favor unless over if for negative conditions
317
+ (or control flow or).
318
+ Enabled: false
319
+
320
+ Style/NegatedWhile:
321
+ Description: 'Favor until over while for negative conditions.'
322
+ Enabled: false
323
+
324
+ Style/NestedTernaryOperator:
325
+ Description: 'Use one expression per branch in a ternary operator.'
326
+ Enabled: true
327
+
328
+ Style/Next:
329
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
330
+ Enabled: false
331
+
332
+ Style/NilComparison:
333
+ Description: 'Prefer x.nil? to x == nil.'
334
+ Enabled: false
335
+
336
+ Style/NonNilCheck:
337
+ Description: 'Checks for redundant nil checks.'
338
+ Enabled: true
339
+
340
+ Style/Not:
341
+ Description: 'Use ! instead of not.'
342
+ Enabled: false
343
+
344
+ Style/NumericLiterals:
345
+ Description: >-
346
+ Add underscores to large numeric literals to improve their
347
+ readability.
348
+ Enabled: false
349
+
350
+ Style/OneLineConditional:
351
+ Description: >-
352
+ Favor the ternary operator(?:) over
353
+ if/then/else/end constructs.
354
+ Enabled: false
355
+
356
+ Style/OpMethod:
357
+ Description: 'When defining binary operators, name the argument other.'
358
+ Enabled: false
359
+
360
+ Style/ParenthesesAroundCondition:
361
+ Description: >-
362
+ Don't use parentheses around the condition of an
363
+ if/unless/while.
364
+ Enabled: true
365
+
366
+ Style/PercentLiteralDelimiters:
367
+ Description: 'Use `%`-literal delimiters consistently'
368
+ Enabled: false
369
+
370
+ Style/PercentQLiterals:
371
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
372
+ Enabled: true
373
+
374
+ Style/PerlBackrefs:
375
+ Description: 'Avoid Perl-style regex back references.'
376
+ Enabled: false
377
+
378
+ Style/PredicateName:
379
+ Description: 'Check the names of predicate methods.'
380
+ Enabled: true
381
+ NamePrefixBlacklist:
382
+ - is_
383
+
384
+ Style/Proc:
385
+ Description: 'Use proc instead of Proc.new.'
386
+ Enabled: false
387
+
388
+ Style/RaiseArgs:
389
+ Description: 'Checks the arguments passed to raise/fail.'
390
+ Enabled: false
391
+
392
+ Style/RedundantBegin:
393
+ Description: "Don't use begin blocks when they are not needed."
394
+ Enabled: true
395
+
396
+ Style/RedundantException:
397
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
398
+ Enabled: true
399
+
400
+ Style/RedundantReturn:
401
+ Description: "Don't use return where it's not required."
402
+ Enabled: true
403
+
404
+ Style/RedundantSelf:
405
+ Description: "Don't use self where it's not needed."
406
+ Enabled: true
407
+
408
+ Style/RegexpLiteral:
409
+ Description: >-
410
+ Use %r for regular expressions matching more than
411
+ `MaxSlashes` '/' characters.
412
+ Use %r only for regular expressions matching more than
413
+ `MaxSlashes` '/' character.
414
+ Enabled: false
415
+
416
+ Style/RescueModifier:
417
+ Description: 'Avoid using rescue in its modifier form.'
418
+ Enabled: true
419
+
420
+ Style/SelfAssignment:
421
+ Description: >-
422
+ Checks for places where self-assignment shorthand should have
423
+ been used.
424
+ Enabled: false
425
+
426
+ Style/Semicolon:
427
+ Description: "Don't use semicolons to terminate expressions."
428
+ Enabled: true
429
+
430
+ Style/SignalException:
431
+ Description: 'Checks for proper usage of fail and raise.'
432
+ Enabled: false
433
+
434
+ Style/SingleLineBlockParams:
435
+ Description: 'Enforces the names of some block params.'
436
+ Enabled: false
437
+
438
+ Style/SingleLineMethods:
439
+ Description: 'Avoid single-line methods.'
440
+ Enabled: false
441
+
442
+ Style/SingleSpaceBeforeFirstArg:
443
+ Description: >-
444
+ Checks that exactly one space is used between a method name
445
+ and the first argument for method calls without parentheses.
446
+ Enabled: true
447
+
448
+ Style/SpaceAfterColon:
449
+ Description: 'Use spaces after colons.'
450
+ Enabled: true
451
+
452
+ Style/SpaceAfterComma:
453
+ Description: 'Use spaces after commas.'
454
+ Enabled: true
455
+
456
+ Style/SpaceAfterControlKeyword:
457
+ Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
458
+ Enabled: true
459
+
460
+ Style/SpaceAfterMethodName:
461
+ Description: >-
462
+ Never put a space between a method name and the opening
463
+ parenthesis in a method definition.
464
+ Enabled: true
465
+
466
+ Style/SpaceAfterNot:
467
+ Description: Tracks redundant space after the ! operator.
468
+ Enabled: true
469
+
470
+ Style/SpaceAfterSemicolon:
471
+ Description: 'Use spaces after semicolons.'
472
+ Enabled: true
473
+
474
+ Style/SpaceBeforeBlockBraces:
475
+ Description: >-
476
+ Checks that the left block brace has or doesn't have space
477
+ before it.
478
+ Enabled: true
479
+
480
+ Style/SpaceBeforeComma:
481
+ Description: 'No spaces before commas.'
482
+ Enabled: true
483
+
484
+ Style/SpaceBeforeComment:
485
+ Description: >-
486
+ Checks for missing space between code and a comment on the
487
+ same line.
488
+ Enabled: true
489
+
490
+ Style/SpaceBeforeSemicolon:
491
+ Description: 'No spaces before semicolons.'
492
+ Enabled: true
493
+
494
+ Style/SpaceInsideBlockBraces:
495
+ Description: >-
496
+ Checks that block braces have or don't have surrounding space.
497
+ For blocks taking parameters, checks that the left brace has
498
+ or doesn't have trailing space.
499
+ Enabled: true
500
+
501
+ Style/SpaceAroundEqualsInParameterDefault:
502
+ Description: >-
503
+ Checks that the equals signs in parameter default assignments
504
+ have or don't have surrounding space depending on
505
+ configuration.
506
+ Enabled: true
507
+
508
+ Style/SpaceAroundOperators:
509
+ Description: 'Use spaces around operators.'
510
+ Enabled: true
511
+
512
+ Style/SpaceBeforeModifierKeyword:
513
+ Description: 'Put a space before the modifier keyword.'
514
+ Enabled: true
515
+
516
+ Style/SpaceInsideBrackets:
517
+ Description: 'No spaces after [ or before ].'
518
+ Enabled: true
519
+
520
+ Style/SpaceInsideHashLiteralBraces:
521
+ Description: "Use spaces inside hash literal braces - or don't."
522
+ Enabled: false
523
+ EnforcedStyle: no_space
524
+
525
+ Style/SpaceInsideParens:
526
+ Description: 'No spaces after ( or before ).'
527
+ Enabled: true
528
+
529
+ Style/SpaceInsideRangeLiteral:
530
+ Description: 'No spaces inside range literals.'
531
+ Enabled: true
532
+
533
+ Style/SpecialGlobalVars:
534
+ Description: 'Avoid Perl-style global variables.'
535
+ Enabled: false
536
+
537
+ Style/StringLiterals:
538
+ Description: 'Checks if uses of quotes match the configured preference.'
539
+ EnforcedStyle: double_quotes
540
+ Enabled: true
541
+
542
+ Style/StringLiteralsInInterpolation:
543
+ EnforcedStyle: double_quotes
544
+ Enabled: true
545
+
546
+ Style/SymbolArray:
547
+ Description: 'Use %i or %I for arrays of symbols.'
548
+ Enabled: true
549
+
550
+ Style/Tab:
551
+ Description: 'No hard tabs.'
552
+ Enabled: true
553
+
554
+ Style/TrailingBlankLines:
555
+ Description: 'Checks trailing blank lines and final newline.'
556
+ Enabled: true
557
+
558
+ Style/TrailingComma:
559
+ Description: 'Checks for trailing comma in parameter lists and literals.'
560
+ Enabled: false
561
+
562
+ Style/TrailingWhitespace:
563
+ Description: 'Avoid trailing whitespace.'
564
+ Enabled: true
565
+
566
+ Style/TrivialAccessors:
567
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
568
+ Enabled: false
569
+
570
+ Style/UnlessElse:
571
+ Description: >-
572
+ Never use unless with else. Rewrite these with the positive
573
+ case first.
574
+ Enabled: true
575
+
576
+ Style/UnneededCapitalW:
577
+ Description: 'Checks for %W when interpolation is not needed.'
578
+ Enabled: true
579
+
580
+ Style/UnneededPercentQ:
581
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
582
+ Enabled: true
583
+
584
+ Style/VariableInterpolation:
585
+ Description: >-
586
+ Don't interpolate global, instance and class variables
587
+ directly in strings.
588
+ Enabled: false
589
+
590
+ Style/VariableName:
591
+ Description: 'Use the configured style when naming variables.'
592
+ Enabled: true
593
+
594
+ Style/WhenThen:
595
+ Description: 'Use when x then ... for one-line cases.'
596
+ Enabled: false
597
+
598
+ Style/WhileUntilDo:
599
+ Description: 'Checks for redundant do after while or until.'
600
+ Enabled: true
601
+
602
+ Style/WhileUntilModifier:
603
+ Description: >-
604
+ Favor modifier while/until usage when you have a
605
+ single-line body.
606
+ Enabled: false
607
+
608
+ Style/WordArray:
609
+ Description: 'Use %w or %W for arrays of words.'
610
+ Enabled: false
611
+
612
+ #################### Metrics ################################
613
+ Metrics/AbcSize:
614
+ Max: 38
615
+
616
+ Metrics/BlockNesting:
617
+ Description: 'Avoid excessive block nesting'
618
+ Enabled: false
619
+
620
+ Metrics/ClassLength:
621
+ Description: 'Avoid classes longer than 100 lines of code.'
622
+ Enabled: true
623
+
624
+ Metrics/CyclomaticComplexity:
625
+ Description: >-
626
+ A complexity metric that is strongy correlated to the number
627
+ of test cases needed to validate a method.
628
+ Enabled: false
629
+
630
+ Metrics/LineLength:
631
+ Description: 'Limit lines to 80 characters.'
632
+ Enabled: true
633
+ Max: 80
634
+
635
+ Metrics/MethodLength:
636
+ Description: 'Avoid methods longer than 10 lines of code.'
637
+ Enabled: false
638
+
639
+ Metrics/ParameterLists:
640
+ Description: 'Avoid parameter lists longer than three or four parameters.'
641
+ Enabled: false
642
+
643
+ Metrics/PerceivedComplexity:
644
+ Description: >-
645
+ A complexity metric geared towards measuring complexity for a
646
+ human reader.
647
+ Enabled: true
648
+
649
+ #################### Lint ################################
650
+ ### Warnings
651
+
652
+ Lint/AmbiguousOperator:
653
+ Description: >-
654
+ Checks for ambiguous operators in the first argument of a
655
+ method invocation without parentheses.
656
+ Enabled: false
657
+
658
+ Lint/AmbiguousRegexpLiteral:
659
+ Description: >-
660
+ Checks for ambiguous regexp literals in the first argument of
661
+ a method invocation without parenthesis.
662
+ Enabled: false
663
+
664
+ Lint/AssignmentInCondition:
665
+ Description: "Don't use assignment in conditions."
666
+ Enabled: false
667
+
668
+ Lint/BlockAlignment:
669
+ Description: 'Align block ends correctly.'
670
+ Enabled: true
671
+
672
+ Lint/ConditionPosition:
673
+ Description: >-
674
+ Checks for condition placed in a confusing position relative to
675
+ the keyword.
676
+ Enabled: false
677
+
678
+ Lint/Debugger:
679
+ Description: 'Check for debugger calls.'
680
+ Enabled: true
681
+
682
+ Lint/DefEndAlignment:
683
+ Description: 'Align ends corresponding to defs correctly.'
684
+ Enabled: true
685
+
686
+ Lint/DeprecatedClassMethods:
687
+ Description: 'Check for deprecated class method calls.'
688
+ Enabled: false
689
+
690
+ Lint/ElseLayout:
691
+ Description: 'Check for odd code arrangement in an else block.'
692
+ Enabled: false
693
+
694
+ Lint/EmptyEnsure:
695
+ Description: 'Checks for empty ensure block.'
696
+ Enabled: true
697
+
698
+ Lint/EmptyInterpolation:
699
+ Description: 'Checks for empty string interpolation.'
700
+ Enabled: true
701
+
702
+ Lint/EndAlignment:
703
+ Description: 'Align ends correctly.'
704
+ Enabled: true
705
+
706
+ Lint/EndInMethod:
707
+ Description: 'END blocks should not be placed inside method definitions.'
708
+ Enabled: true
709
+
710
+ Lint/EnsureReturn:
711
+ Description: 'Never use return in an ensure block.'
712
+ Enabled: true
713
+
714
+ Lint/Eval:
715
+ Description: 'The use of eval represents a serious security risk.'
716
+ Enabled: true
717
+
718
+ Lint/HandleExceptions:
719
+ Description: "Don't suppress exception."
720
+ Enabled: false
721
+
722
+ Lint/InvalidCharacterLiteral:
723
+ Description: >-
724
+ Checks for invalid character literals with a non-escaped
725
+ whitespace character.
726
+ Enabled: false
727
+
728
+ Lint/LiteralInCondition:
729
+ Description: 'Checks of literals used in conditions.'
730
+ Enabled: false
731
+
732
+ Lint/LiteralInInterpolation:
733
+ Description: 'Checks for literals used in interpolation.'
734
+ Enabled: false
735
+
736
+ Lint/Loop:
737
+ Description: >-
738
+ Use Kernel#loop with break rather than begin/end/until or
739
+ begin/end/while for post-loop tests.
740
+ Enabled: false
741
+
742
+ Lint/ParenthesesAsGroupedExpression:
743
+ Description: >-
744
+ Checks for method calls with a space before the opening
745
+ parenthesis.
746
+ Enabled: false
747
+
748
+ Lint/RequireParentheses:
749
+ Description: >-
750
+ Use parentheses in the method call to avoid confusion
751
+ about precedence.
752
+ Enabled: false
753
+
754
+ Lint/RescueException:
755
+ Description: 'Avoid rescuing the Exception class.'
756
+ Enabled: true
757
+
758
+ Lint/ShadowingOuterLocalVariable:
759
+ Description: >-
760
+ Do not use the same name as outer local variable
761
+ for block arguments or block local variables.
762
+ Enabled: true
763
+
764
+ Lint/SpaceBeforeFirstArg:
765
+ Description: >-
766
+ Put a space between a method name and the first argument
767
+ in a method call without parentheses.
768
+ Enabled: true
769
+
770
+ Lint/StringConversionInInterpolation:
771
+ Description: 'Checks for Object#to_s usage in string interpolation.'
772
+ Enabled: true
773
+
774
+ Lint/UnderscorePrefixedVariableName:
775
+ Description: 'Do not use prefix `_` for a variable that is used.'
776
+ Enabled: false
777
+
778
+ Lint/UnusedBlockArgument:
779
+ Description: 'Checks for unused block arguments.'
780
+ Enabled: true
781
+
782
+ Lint/UnusedMethodArgument:
783
+ Description: 'Checks for unused method arguments.'
784
+ Enabled: true
785
+
786
+ Lint/UnreachableCode:
787
+ Description: 'Unreachable code.'
788
+ Enabled: true
789
+
790
+ Lint/UselessAccessModifier:
791
+ Description: 'Checks for useless access modifiers.'
792
+ Enabled: true
793
+
794
+ Lint/UselessAssignment:
795
+ Description: 'Checks for useless assignment to a local variable.'
796
+ Enabled: true
797
+
798
+ Lint/UselessComparison:
799
+ Description: 'Checks for comparison of something with itself.'
800
+ Enabled: true
801
+
802
+ Lint/UselessElseWithoutRescue:
803
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
804
+ Enabled: true
805
+
806
+ Lint/UselessSetterCall:
807
+ Description: 'Checks for useless setter call to a local variable.'
808
+ Enabled: true
809
+
810
+ Lint/Void:
811
+ Description: 'Possible use of operator/literal/variable in void context.'
812
+ Enabled: false
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.2
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in scrubba.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Jon-Michael Deldin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # Scrubba: Clean your strings!
2
+
3
+ [![Build Status](https://travis-ci.org/jmdeldin/scrubba.svg)](https://travis-ci.org/jmdeldin/scrubba)
4
+
5
+ Scrubba is a tiny gem to strip and normalize whitespace. It provides a few convenient methods for working with ActiveRecord/ActiveModel/ActiveAttr/ActiveNode attributes too.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'scrubba'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install scrubba
22
+
23
+ ## Usage
24
+
25
+ Standalone:
26
+
27
+ ```ruby
28
+ require "scrubba"
29
+
30
+ some_str = " foo \t bar "
31
+ Scrubba.scrub(some_str) #=> "foo \t bar"
32
+ Scrubba.normalize(some_str) #=> " foo bar "
33
+ ```
34
+
35
+ In an ActiveRecord model:
36
+
37
+ ```ruby
38
+ require "scrubba"
39
+
40
+ class Post < ActiveRecord::Base
41
+ extend Scrubba::ActiveMethods
42
+
43
+ strip :title, :body
44
+ normalize :title
45
+ end
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jmdeldin/scrubba.
51
+
52
+ ## License
53
+
54
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
55
+
56
+ ## Author
57
+
58
+ [Jon-Michael Deldin](http://www.jmdeldin.com), [@jmdeldin](http://twitter.com/jmdeldin)
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :style do
11
+ sh "rubocop"
12
+ end
13
+
14
+ task :console do
15
+ require "bundler/setup"
16
+ require "pry"
17
+ require "scrubba"
18
+ Pry.start
19
+ end
20
+
21
+ task default: %i[style test]
@@ -0,0 +1,19 @@
1
+ module Scrubba
2
+ module ActiveMethods
3
+ def scrub(*keys)
4
+ before_validation do
5
+ keys.each do |k|
6
+ self[k] = Scrubba.scrub(self[k]) if self[k].present?
7
+ end
8
+ end
9
+ end
10
+
11
+ def normalize(*keys)
12
+ before_validation do
13
+ keys.each do |k|
14
+ self[k] = Scrubba.normalize(self[k]) if self[k].present?
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module Scrubba
2
+ VERSION = "0.1.0"
3
+ end
data/lib/scrubba.rb ADDED
@@ -0,0 +1,21 @@
1
+ require "scrubba/version"
2
+
3
+ module Scrubba
4
+ autoload :ActiveMethods, "scrubba/active_methods"
5
+
6
+ # Removes leading and trailing whitespace from a string.
7
+ #
8
+ # @param [String] str
9
+ # @return [String]
10
+ def self.scrub(str)
11
+ str.gsub(/(\A[[:space:]]+|[[:space:]]+\z)/, "") if str
12
+ end
13
+
14
+ # Converts and compresses ASCII and Unicode whitespace into single spaces.
15
+ #
16
+ # @param [String] str
17
+ # @return [String]
18
+ def self.normalize(str)
19
+ str.gsub(/[[:space:]]+/, " ") if str
20
+ end
21
+ end
data/scrubba.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "scrubba/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "scrubba"
8
+ spec.version = Scrubba::VERSION
9
+ spec.authors = ["Jon-Michael Deldin"]
10
+ spec.email = ["dev@jmdeldin.com"]
11
+
12
+ spec.summary = "Strip and normalize strings for ActiveModel/ActiveAttr"
13
+ spec.homepage = "https://github.com/jmdeldin/scrubba"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(/^test\//) }
17
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler"
21
+ spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "minitest"
23
+ spec.add_development_dependency "activemodel"
24
+ spec.add_development_dependency "rubocop"
25
+ spec.add_development_dependency "pry"
26
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrubba
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jon-Michael Deldin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: activemodel
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - dev@jmdeldin.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".rubocop.yml"
106
+ - ".ruby-version"
107
+ - ".travis.yml"
108
+ - Gemfile
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - lib/scrubba.rb
113
+ - lib/scrubba/active_methods.rb
114
+ - lib/scrubba/version.rb
115
+ - scrubba.gemspec
116
+ homepage: https://github.com/jmdeldin/scrubba
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.4.5
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Strip and normalize strings for ActiveModel/ActiveAttr
140
+ test_files: []
141
+ has_rdoc: