finstyle 1.4.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
  SHA1:
3
- metadata.gz: 84538f975b126cba240de14cd84c5e779af130d2
4
- data.tar.gz: 2dd8828b126037fab9cfcd9d9a509a33ce6a05c8
3
+ metadata.gz: cb52b61fbd36937ee920334582446d8b0f7ccbca
4
+ data.tar.gz: 5f26849bb13445851863d9775346a8f5c321adb7
5
5
  SHA512:
6
- metadata.gz: 0000b23989b5942d3793bf9ef4fa31711d051d5d0b8ffdc49590192403496e582d1ba1959ff5b4c9d3efe8698a96bd3d8c9e850a697918d521b30611dd4686e4
7
- data.tar.gz: 9025636bf7b8334f60e984f3633597177ab13e61fee82bd5a06d7eb2f4cd7bb5f4591d3ec87b64cd4b4a9364bc4a7a56079440c129e378f45434a886eaa01e1a
6
+ metadata.gz: b91228cfbc8304286324a213a5e850ba370e8ff44d2ba44d641de25c9043287e18fd29c56fd995f79ac5c3bf77b54e90de27769c00986354056e14cf5d5b1cea
7
+ data.tar.gz: 75bc6e7c8460adaa7ace7a12b2d393a3016acd230ec8872255c4347050dd908ab9744028e710d38673af33363b163adf58114a1f94fd83158ef2531c87efc5eb
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
+ - 2.2
4
5
  - 2.1
5
6
  - 2.0.0
6
7
  - 1.9.3
@@ -1,3 +1,15 @@
1
+ ## 1.5.0 / 2015-06-29
2
+
3
+ ### Breaking changes
4
+
5
+ * Pull request [#4][]: Upgrade to RuboCop 0.32.1 support. ([@fnichol][])
6
+ * Pull request [#3][]: Upgrade to RuboCop 0.30.1 support. ([@fnichol][])
7
+
8
+ ### Improvements
9
+
10
+ * Pull request [#2][]: Ensure the desired target version of RuboCop is gem activated. ([@fnichol][])
11
+
12
+
1
13
  ## 1.4.0 / 2014-12-15
2
14
 
3
15
  ### Breaking changes
@@ -53,5 +65,8 @@ The initial release.
53
65
 
54
66
  <!--- The following link definition list is generated by PimpMyChangelog --->
55
67
  [#1]: https://github.com/fnichol/finstyle/issues/1
68
+ [#2]: https://github.com/fnichol/finstyle/issues/2
69
+ [#3]: https://github.com/fnichol/finstyle/issues/3
70
+ [#4]: https://github.com/fnichol/finstyle/issues/4
56
71
  [@cwjohnston]: https://github.com/cwjohnston
57
72
  [@fnichol]: https://github.com/fnichol
data/README.md CHANGED
@@ -111,7 +111,7 @@ Ideally create a topic branch for every separate change you make. For
111
111
  example:
112
112
 
113
113
 
114
- 1. Fork it ( https://github.com/[my-github-username]/finstyle/fork )
114
+ 1. Fork it ( https://github.com/fnichol/finstyle/fork )
115
115
  2. Create your feature branch (`git checkout -b my-new-feature`)
116
116
  3. Commit your changes (`git commit -am 'Add some feature'`)
117
117
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,8 +1,16 @@
1
1
  # These are all the cops that are disabled in the default configuration.
2
2
 
3
+ Style/AutoResourceCleanup:
4
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
5
+ Enabled: false
6
+
3
7
  Style/CollectionMethods:
4
8
  Description: 'Preferred collection methods.'
5
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-fine-select-reduce-size'
9
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size'
10
+ Enabled: false
11
+
12
+ Style/Copyright:
13
+ Description: 'Include a copyright notice in each file before any code.'
6
14
  Enabled: false
7
15
 
8
16
  Style/Encoding:
@@ -19,6 +27,23 @@ Style/MethodCalledOnDoEndBlock:
19
27
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
20
28
  Enabled: false
21
29
 
30
+ Style/MissingElse:
31
+ Description: >-
32
+ Require if/case expressions to have an else branches.
33
+ If enabled, it is recommended that
34
+ Style/UnlessElse and Style/EmptyElse be enabled.
35
+ This will conflict with Style/EmptyElse if
36
+ Style/EmptyElse is configured to style "both"
37
+ Enabled: false
38
+ EnforcedStyle: both
39
+ SupportedStyles:
40
+ # if - warn when an if expression is missing an else branch
41
+ # case - warn when a case expression is misisng an else branch
42
+ # both - warn when an if or case expression is missing an else branch
43
+ - if
44
+ - case
45
+ - both
46
+
22
47
  Style/SymbolArray:
23
48
  Description: 'Use %i or %I for arrays of symbols.'
24
49
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-i'
@@ -28,3 +53,6 @@ Style/ExtraSpacing:
28
53
  Description: 'Do not use unnecessary spacing.'
29
54
  Enabled: false
30
55
 
56
+ Lint/LiteralInInterpolation:
57
+ Description: 'Avoid interpolating literals in strings'
58
+ AutoCorrect: false
@@ -78,7 +78,7 @@ Style/BlockEndNewline:
78
78
  Description: 'Put end statement of multiline block on its own line.'
79
79
  Enabled: true
80
80
 
81
- Style/Blocks:
81
+ Style/BlockDelimiters:
82
82
  Description: >-
83
83
  Avoid using {...} for multi-line blocks (multiline chaining is
84
84
  always ugly).
@@ -120,7 +120,7 @@ Style/ClassCheck:
120
120
 
121
121
  Style/ClassMethods:
122
122
  Description: 'Use self when defining module/class methods.'
123
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-singletons'
123
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods'
124
124
  Enabled: true
125
125
 
126
126
  Style/ClassVars:
@@ -128,11 +128,20 @@ Style/ClassVars:
128
128
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
129
129
  Enabled: true
130
130
 
131
+ Style/ClosingParenthesisIndentation:
132
+ Description: 'Checks the indentation of hanging closing parentheses.'
133
+ Enabled: true
134
+
131
135
  Style/ColonMethodCall:
132
136
  Description: 'Do not use :: for method call.'
133
137
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
134
138
  Enabled: true
135
139
 
140
+ Style/CommandLiteral:
141
+ Description: 'Use `` or %x around command literals.'
142
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x'
143
+ Enabled: true
144
+
136
145
  Style/CommentAnnotation:
137
146
  Description: >-
138
147
  Checks formatting of special comments
@@ -239,6 +248,10 @@ Style/FileName:
239
248
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
240
249
  Enabled: true
241
250
 
251
+ Style/FirstParameterIndentation:
252
+ Description: 'Checks the indentation of the first parameter in a method call.'
253
+ Enabled: true
254
+
242
255
  Style/FlipFlop:
243
256
  Description: 'Checks for flip flops'
244
257
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
@@ -257,6 +270,7 @@ Style/FormatString:
257
270
  Style/GlobalVars:
258
271
  Description: 'Do not introduce global variables.'
259
272
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
273
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
260
274
  Enabled: true
261
275
 
262
276
  Style/GuardClause:
@@ -433,6 +447,16 @@ Style/OpMethod:
433
447
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
434
448
  Enabled: true
435
449
 
450
+ Style/ParallelAssignment:
451
+ Description: >-
452
+ Check for simple usages of parallel assignment.
453
+ It will only warn when the number of variables
454
+ matches on both sides of the assignment.
455
+ This also provides performance benefits
456
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment'
457
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#parallel-assignment-vs-sequential-assignment-code'
458
+ Enabled: true
459
+
436
460
  Style/ParenthesesAroundCondition:
437
461
  Description: >-
438
462
  Don't use parentheses around the condition of an
@@ -490,11 +514,7 @@ Style/RedundantSelf:
490
514
  Enabled: true
491
515
 
492
516
  Style/RegexpLiteral:
493
- Description: >-
494
- Use %r for regular expressions matching more than
495
- `MaxSlashes` '/' characters.
496
- Use %r only for regular expressions matching more than
497
- `MaxSlashes` '/' character.
517
+ Description: 'Use / or %r around regular expressions.'
498
518
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
499
519
  Enabled: true
500
520
 
@@ -594,6 +614,10 @@ Style/SpaceInsideBlockBraces:
594
614
  or doesn't have trailing space.
595
615
  Enabled: true
596
616
 
617
+ Style/SpaceAroundBlockParameters:
618
+ Description: 'Checks the spacing inside and after block parameters pipes.'
619
+ Enabled: true
620
+
597
621
  Style/SpaceAroundEqualsInParameterDefault:
598
622
  Description: >-
599
623
  Checks that the equals signs in parameter default assignments
@@ -603,7 +627,7 @@ Style/SpaceAroundEqualsInParameterDefault:
603
627
  Enabled: true
604
628
 
605
629
  Style/SpaceAroundOperators:
606
- Description: 'Use spaces around operators.'
630
+ Description: 'Use a single space around operators.'
607
631
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
608
632
  Enabled: true
609
633
 
@@ -631,6 +655,11 @@ Style/SpaceInsideRangeLiteral:
631
655
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
632
656
  Enabled: true
633
657
 
658
+ Style/SpaceInsideStringInterpolation:
659
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
660
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation'
661
+ Enabled: true
662
+
634
663
  Style/SpecialGlobalVars:
635
664
  Description: 'Avoid Perl-style global variables.'
636
665
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
@@ -647,6 +676,15 @@ Style/StringLiteralsInInterpolation:
647
676
  strings match the configured preference.
648
677
  Enabled: true
649
678
 
679
+ Style/StructInheritance:
680
+ Description: 'Checks for inheritance from Struct.new.'
681
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new'
682
+ Enabled: true
683
+
684
+ Style/SymbolLiteral:
685
+ Description: 'Use plain symbols instead of string symbols when possible.'
686
+ Enabled: true
687
+
650
688
  Style/SymbolProc:
651
689
  Description: 'Use symbols as procs instead of blocks when possible.'
652
690
  Enabled: true
@@ -692,9 +730,10 @@ Style/UnneededPercentQ:
692
730
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
693
731
  Enabled: true
694
732
 
695
- Style/UnneededPercentX:
696
- Description: 'Checks for %x when `` would do.'
697
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x'
733
+ Style/TrailingUnderscoreVariable:
734
+ Description: >-
735
+ Checks for the usage of unneeded trailing underscores at the
736
+ end of parallel variable assignment.
698
737
  Enabled: true
699
738
 
700
739
  Style/VariableInterpolation:
@@ -737,6 +776,7 @@ Metrics/AbcSize:
737
776
  Description: >-
738
777
  A calculated magnitude based on number of assignments,
739
778
  branches, and conditions.
779
+ Reference: 'http://c2.com/cgi/wiki?AbcMetric'
740
780
  Enabled: true
741
781
 
742
782
  Metrics/BlockNesting:
@@ -748,6 +788,10 @@ Metrics/ClassLength:
748
788
  Description: 'Avoid classes longer than 100 lines of code.'
749
789
  Enabled: true
750
790
 
791
+ Metrics/ModuleLength:
792
+ Description: 'Avoid modules longer than 100 lines of code.'
793
+ Enabled: true
794
+
751
795
  Metrics/CyclomaticComplexity:
752
796
  Description: >-
753
797
  A complexity metric that is strongly correlated to the number
@@ -819,6 +863,14 @@ Lint/DeprecatedClassMethods:
819
863
  Description: 'Check for deprecated class method calls.'
820
864
  Enabled: true
821
865
 
866
+ Lint/DuplicateMethods:
867
+ Description: 'Check for duplicate methods calls.'
868
+ Enabled: true
869
+
870
+ Lint/EachWithObjectArgument:
871
+ Description: 'Check for immutable argument given to each_with_object.'
872
+ Enabled: true
873
+
822
874
  Lint/ElseLayout:
823
875
  Description: 'Check for odd code arrangement in an else block.'
824
876
  Enabled: true
@@ -874,6 +926,15 @@ Lint/Loop:
874
926
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
875
927
  Enabled: true
876
928
 
929
+ Lint/NestedMethodDefinition:
930
+ Description: 'Do not use nested method definitions.'
931
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
932
+ Enabled: true
933
+
934
+ Lint/NonLocalExitFromIterator:
935
+ Description: 'Do not use return in iterator to cause non-local exit.'
936
+ Enabled: true
937
+
877
938
  Lint/ParenthesesAsGroupedExpression:
878
939
  Description: >-
879
940
  Checks for method calls with a space before the opening
@@ -913,6 +974,10 @@ Lint/UnderscorePrefixedVariableName:
913
974
  Description: 'Do not use prefix `_` for a variable that is used.'
914
975
  Enabled: true
915
976
 
977
+ Lint/UnneededDisable:
978
+ Description: 'Checks for rubocop:disable comments that can be removed.'
979
+ Enabled: true
980
+
916
981
  Lint/UnusedBlockArgument:
917
982
  Description: 'Checks for unused block arguments.'
918
983
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
@@ -952,12 +1017,66 @@ Lint/Void:
952
1017
  Description: 'Possible use of operator/literal/variable in void context.'
953
1018
  Enabled: true
954
1019
 
1020
+ ##################### Performance #############################
1021
+
1022
+ Performance/Count:
1023
+ Description: >-
1024
+ Use `count` instead of `select...size`, `reject...size`,
1025
+ `select...count`, `reject...count`, `select...length`,
1026
+ and `reject...length`.
1027
+ Enabled: true
1028
+
1029
+ Performance/Detect:
1030
+ Description: >-
1031
+ Use `detect` instead of `select.first`, `find_all.first`,
1032
+ `select.last`, and `find_all.last`.
1033
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
1034
+ Enabled: true
1035
+
1036
+ Performance/FlatMap:
1037
+ Description: >-
1038
+ Use `Enumerable#flat_map`
1039
+ instead of `Enumerable#map...Array#flatten(1)`
1040
+ or `Enumberable#collect..Array#flatten(1)`
1041
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
1042
+ Enabled: true
1043
+ EnabledForFlattenWithoutParams: false
1044
+ # If enabled, this cop will warn about usages of
1045
+ # `flatten` being called without any parameters.
1046
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
1047
+ # `flatten` without any parameters can flatten multiple levels.
1048
+
1049
+ Performance/ReverseEach:
1050
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
1051
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
1052
+ Enabled: true
1053
+
1054
+ Performance/Sample:
1055
+ Description: >-
1056
+ Use `sample` instead of `shuffle.first`,
1057
+ `shuffle.last`, and `shuffle[Fixnum]`.
1058
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
1059
+ Enabled: true
1060
+
1061
+ Performance/Size:
1062
+ Description: >-
1063
+ Use `size` instead of `count` for counting
1064
+ the number of elements in `Array` and `Hash`.
1065
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
1066
+ Enabled: true
1067
+
955
1068
  ##################### Rails ##################################
956
1069
 
957
1070
  Rails/ActionFilter:
958
1071
  Description: 'Enforces consistent use of action filter methods.'
959
1072
  Enabled: true
960
1073
 
1074
+ Rails/Date:
1075
+ Description: >-
1076
+ Checks the correct usage of date aware methods,
1077
+ such as Date.today, Date.current etc.
1078
+ Enabled: true
1079
+
961
1080
  Rails/DefaultScope:
962
1081
  Description: 'Checks if the argument passed to default_scope is a block.'
963
1082
  Enabled: true
@@ -966,6 +1085,14 @@ Rails/Delegate:
966
1085
  Description: 'Prefer delegate method for delegations.'
967
1086
  Enabled: true
968
1087
 
1088
+ Rails/FindBy:
1089
+ Description: 'Prefer find_by over where.first.'
1090
+ Enabled: true
1091
+
1092
+ Rails/FindEach:
1093
+ Description: 'Prefer all.find_each over all.find.'
1094
+ Enabled: true
1095
+
969
1096
  Rails/HasAndBelongsToMany:
970
1097
  Description: 'Prefer has_many :through to has_and_belongs_to_many.'
971
1098
  Enabled: true
@@ -984,6 +1111,12 @@ Rails/ScopeArgs:
984
1111
  Description: 'Checks the arguments of ActiveRecord scopes.'
985
1112
  Enabled: true
986
1113
 
1114
+ Rails/TimeZone:
1115
+ Description: 'Checks the correct usage of time zone aware methods.'
1116
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
1117
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1118
+ Enabled: true
1119
+
987
1120
  Rails/Validation:
988
1121
  Description: 'Use validates :attribute, hash of validations.'
989
1122
  Enabled: true
@@ -35,6 +35,10 @@ Metrics/LineLength:
35
35
  Metrics/MethodLength:
36
36
  Max: 20
37
37
 
38
+ # ABC complexity is a far better code smell signal than raw class length.
39
+ Metrics/ModuleLength:
40
+ Max: 300
41
+
38
42
  #
39
43
  ### Style Cops
40
44
  #
@@ -47,12 +51,17 @@ Style/AlignParameters:
47
51
  # * http://devblog.avdi.org/2011/07/26/the-procedurefunction-block-convention-in-ruby/
48
52
  # * http://talklikeaduck.denhaven2.com/2007/10/02/ruby-blocks-do-or-brace
49
53
  # * http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
50
- Style/Blocks:
54
+ Style/BlockDelimiters:
51
55
  Enabled: false
52
56
 
53
57
  BracesAroundHashParameters:
54
58
  EnforcedStyle: context_dependent
55
59
 
60
+ # As of 0.30.1, too many false positives and no ability to configure
61
+ # this cop
62
+ Style/ClosingParenthesisIndentation:
63
+ Enabled: false
64
+
56
65
  # Words help us convey meaning and Ruby aliased methods help with this.
57
66
  Style/CollectionMethods:
58
67
  PreferredMethods:
@@ -94,6 +103,9 @@ Style/HashSyntax:
94
103
  Style/EmptyLiteral:
95
104
  Enabled: false
96
105
 
106
+ Style/FirstParameterIndentation:
107
+ EnforcedStyle: consistent
108
+
97
109
  # Claimed violations of this by Rubocop are, in general, complete nonsense and
98
110
  # worse can dramtically reduce the safe readability of code (it would lead you
99
111
  # to add a lot more `return if ...` blocks in the *middle* of method bodies)
@@ -7,13 +7,14 @@ inherit_from:
7
7
 
8
8
  # Common configuration.
9
9
  AllCops:
10
- # Include gemspec and Rakefile
10
+ # Include common Ruby source files.
11
11
  Include:
12
12
  - '**/*.gemspec'
13
13
  - '**/*.podspec'
14
14
  - '**/*.jbuilder'
15
15
  - '**/*.rake'
16
16
  - '**/*.opal'
17
+ - '**/config.ru'
17
18
  - '**/Gemfile'
18
19
  - '**/Rakefile'
19
20
  - '**/Capfile'
@@ -29,6 +30,18 @@ AllCops:
29
30
  # By default, the rails cops are not run. Override in project or home
30
31
  # directory .rubocop.yml files, or by giving the -R/--rails option.
31
32
  RunRailsCops: false
33
+ # Cop names are not displayed in offense messages by default. Change behavior
34
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
35
+ # option.
36
+ DisplayCopNames: false
37
+ # Style guide URLs are not displayed in offense messages by default. Change
38
+ # behavior by overriding DisplayStyleGuide, or by giving the
39
+ # -S/--display-style-guide option.
40
+ DisplayStyleGuide: false
41
+ # Additional cops that do not reference a style guide rule may be enabled by
42
+ # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
43
+ # the --only-guide-cops option.
44
+ StyleGuideCopsOnly: false
32
45
 
33
46
  # Indent private/protected/public as deep as method definitions
34
47
  Style/AccessModifierIndentation:
@@ -136,6 +149,72 @@ Style/BarePercentLiterals:
136
149
  - percent_q
137
150
  - bare_percent
138
151
 
152
+ Style/BlockDelimiters:
153
+ EnforcedStyle: line_count_based
154
+ SupportedStyles:
155
+ # The `line_count_based` style enforces braces around single line blocks and
156
+ # do..end around multi-line blocks.
157
+ - line_count_based
158
+ # The `semantic` style enforces braces around functional blocks, where the
159
+ # primary purpose of the block is to return a value and do..end for
160
+ # procedural blocks, where the primary purpose of the block is its
161
+ # side-effects.
162
+ #
163
+ # This looks at the usage of a block's method to determine its type (e.g. is
164
+ # the result of a `map` assigned to a variable or passed to another
165
+ # method) but exceptions are permitted in the `ProceduralMethods`,
166
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
167
+ - semantic
168
+ ProceduralMethods:
169
+ # Methods that are known to be procedural in nature but look functional from
170
+ # their usage, e.g.
171
+ #
172
+ # time = Benchmark.realtime do
173
+ # foo.bar
174
+ # end
175
+ #
176
+ # Here, the return value of the block is discarded but the return value of
177
+ # `Benchmark.realtime` is used.
178
+ - benchmark
179
+ - bm
180
+ - bmbm
181
+ - create
182
+ - each_with_object
183
+ - measure
184
+ - new
185
+ - realtime
186
+ - tap
187
+ - with_object
188
+ FunctionalMethods:
189
+ # Methods that are known to be functional in nature but look procedural from
190
+ # their usage, e.g.
191
+ #
192
+ # let(:foo) { Foo.new }
193
+ #
194
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
195
+ # doesn't appear to be used from the return value of `let`.
196
+ - let
197
+ - let!
198
+ - subject
199
+ - watch
200
+ IgnoredMethods:
201
+ # Methods that can be either procedural or functional and cannot be
202
+ # categorised from their usage alone, e.g.
203
+ #
204
+ # foo = lambda do |x|
205
+ # puts "Hello, #{x}"
206
+ # end
207
+ #
208
+ # foo = lambda do |x|
209
+ # x * 100
210
+ # end
211
+ #
212
+ # Here, it is impossible to tell from the return value of `lambda` whether
213
+ # the inner block's return value is significant.
214
+ - lambda
215
+ - proc
216
+ - it
217
+
139
218
  Style/BracesAroundHashParameters:
140
219
  EnforcedStyle: no_braces
141
220
  SupportedStyles:
@@ -200,6 +279,20 @@ Style/CollectionMethods:
200
279
  detect: 'find'
201
280
  find_all: 'select'
202
281
 
282
+ # Use ` or %x around command literals.
283
+ Style/CommandLiteral:
284
+ EnforcedStyle: backticks
285
+ # backticks: Always use backticks.
286
+ # percent_x: Always use %x.
287
+ # mixed: Use backticks on single-line commands, and %x on multi-line commands.
288
+ SupportedStyles:
289
+ - backticks
290
+ - percent_x
291
+ - mixed
292
+ # If false, the cop will always recommend using %x if one or more backticks
293
+ # are found in the command string.
294
+ AllowInnerBackticks: false
295
+
203
296
  # Checks formatting of special comments
204
297
  Style/CommentAnnotation:
205
298
  Keywords:
@@ -209,6 +302,28 @@ Style/CommentAnnotation:
209
302
  - HACK
210
303
  - REVIEW
211
304
 
305
+ # Checks that you have put a copyright in a comment before any code.
306
+ #
307
+ # You can override the default Notice in your .rubocop.yml file.
308
+ #
309
+ # In order to use autocorrect, you must supply a value for the
310
+ # AutocorrectNotice key that matches the regexp Notice. A blank
311
+ # AutocorrectNotice will cause an error during autocorrect.
312
+ #
313
+ # Autocorrect will add a copyright notice in a comment at the top
314
+ # of the file immediately after any shebang or encoding comments.
315
+ #
316
+ # Example rubocop.yml:
317
+ #
318
+ # Style/Copyright:
319
+ # Enabled: true
320
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
321
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
322
+ #
323
+ Style/Copyright:
324
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
325
+ AutocorrectNotice: ''
326
+
212
327
  # Multi-line method chaining should be done with leading dots.
213
328
  Style/DotPosition:
214
329
  EnforcedStyle: leading
@@ -216,6 +331,17 @@ Style/DotPosition:
216
331
  - leading
217
332
  - trailing
218
333
 
334
+ # Warn on empty else statements
335
+ # empty - warn only on empty else
336
+ # nil - warn on else with nil in it
337
+ # both - warn on empty else and else with nil in it
338
+ Style/EmptyElse:
339
+ EnforcedStyle: both
340
+ SupportedStyles:
341
+ - empty
342
+ - nil
343
+ - both
344
+
219
345
  # Use empty lines between defs.
220
346
  Style/EmptyLineBetweenDefs:
221
347
  # If true, this parameter means that single line method definitions don't
@@ -241,17 +367,35 @@ Style/EmptyLinesAroundModuleBody:
241
367
  - no_empty_lines
242
368
 
243
369
  # Checks whether the source file has a utf-8 encoding comment or not
370
+ # AutoCorrectEncodingComment must match the regex
371
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
244
372
  Style/Encoding:
245
373
  EnforcedStyle: always
246
374
  SupportedStyles:
247
375
  - when_needed
248
376
  - always
377
+ AutoCorrectEncodingComment: '# encoding: utf-8'
249
378
 
250
379
  Style/FileName:
251
380
  # File names listed in AllCops:Include are excluded by default. Add extra
252
381
  # excludes here.
253
382
  Exclude: []
254
383
 
384
+ Style/FirstParameterIndentation:
385
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
386
+ SupportedStyles:
387
+ # The first parameter should always be indented one step more than the
388
+ # preceding line.
389
+ - consistent
390
+ # The first parameter should normally be indented one step more than the
391
+ # preceding line, but if it's a parameter for a method call that is itself
392
+ # a parameter in a method call, then the inner parameter should be indented
393
+ # relative to the inner method.
394
+ - special_for_inner_method_call
395
+ # Same as special_for_inner_method_call except that the special rule only
396
+ # applies if the outer method call encloses its arguments in parentheses.
397
+ - special_for_inner_method_call_in_parentheses
398
+
255
399
  # Checks use of for or each in multiline loops.
256
400
  Style/For:
257
401
  EnforcedStyle: each
@@ -280,11 +424,26 @@ Style/HashSyntax:
280
424
  EnforcedStyle: ruby19
281
425
  SupportedStyles:
282
426
  - ruby19
427
+ - ruby19_no_mixed_keys
283
428
  - hash_rockets
429
+ # Force hashes that have a symbol value to use hash rockets
430
+ UseHashRocketsWithSymbolValues: false
284
431
 
285
432
  Style/IfUnlessModifier:
286
433
  MaxLineLength: 80
287
434
 
435
+ Style/IndentationConsistency:
436
+ # The difference between `rails` and `normal` is that the `rails` style
437
+ # prescribes that in classes and modules the `protected` and `private`
438
+ # modifier keywords shall be indented the same as public methods and that
439
+ # protected and private members shall be indented one step more than the
440
+ # modifiers. Other than that, both styles mean that entities on the same
441
+ # logical depth shall have the same indentation.
442
+ EnforcedStyle: normal
443
+ SupportedStyles:
444
+ - normal
445
+ - rails
446
+
288
447
  Style/IndentationWidth:
289
448
  # Number of spaces for each indentation level.
290
449
  Width: 2
@@ -395,10 +554,19 @@ Style/RedundantReturn:
395
554
  # When true allows code like `return x, y`.
396
555
  AllowMultipleReturnValues: false
397
556
 
557
+ # Use / or %r around regular expressions.
398
558
  Style/RegexpLiteral:
399
- # The maximum number of (escaped) slashes that a slash-delimited regexp is
400
- # allowed to have. If there are more slashes, a %r regexp shall be used.
401
- MaxSlashes: 1
559
+ EnforcedStyle: slashes
560
+ # slashes: Always use slashes.
561
+ # percent_r: Always use %r.
562
+ # mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
563
+ SupportedStyles:
564
+ - slashes
565
+ - percent_r
566
+ - mixed
567
+ # If false, the cop will always recommend using %r if one or more slashes
568
+ # are found in the regexp string.
569
+ AllowInnerSlashes: false
402
570
 
403
571
  Style/Semicolon:
404
572
  # Allow ; to separate several expressions on the same line.
@@ -435,12 +603,23 @@ Style/StringLiteralsInInterpolation:
435
603
  - single_quotes
436
604
  - double_quotes
437
605
 
606
+ Style/SpaceAroundBlockParameters:
607
+ EnforcedStyleInsidePipes: no_space
608
+ SupportedStyles:
609
+ - space
610
+ - no_space
611
+
438
612
  Style/SpaceAroundEqualsInParameterDefault:
439
613
  EnforcedStyle: space
440
614
  SupportedStyles:
441
615
  - space
442
616
  - no_space
443
617
 
618
+ Style/SpaceAroundOperators:
619
+ MultiSpaceAllowedForOperators:
620
+ - '='
621
+ - '=>'
622
+
444
623
  Style/SpaceBeforeBlockBraces:
445
624
  EnforcedStyle: space
446
625
  SupportedStyles:
@@ -477,17 +656,28 @@ Style/TrailingBlankLines:
477
656
  - final_blank_line
478
657
 
479
658
  Style/TrailingComma:
480
- # If EnforcedStyleForMultiline is comma, the cop allows a comma after the
659
+ # If EnforcedStyleForMultiline is comma, the cop requires a comma after the
481
660
  # last item of a list, but only for lists where each item is on its own line.
661
+ # If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
662
+ # after the last item of a list, for all lists.
482
663
  EnforcedStyleForMultiline: no_comma
483
664
  SupportedStyles:
484
665
  - comma
666
+ - consistent_comma
485
667
  - no_comma
486
668
 
487
- # TrivialAccessors doesn't require exact name matches and doesn't allow
669
+ # TrivialAccessors requires exact name matches and doesn't allow
488
670
  # predicated methods by default.
489
671
  Style/TrivialAccessors:
490
- ExactNameMatch: false
672
+ # When set to false the cop will suggest the use of accessor methods
673
+ # in situations like:
674
+ #
675
+ # def name
676
+ # @other_name
677
+ # end
678
+ #
679
+ # This way you can uncover "hidden" attributes in your code.
680
+ ExactNameMatch: true
491
681
  AllowPredicates: false
492
682
  # Allows trivial writers that don't end in an equal sign. e.g.
493
683
  #
@@ -498,6 +688,7 @@ Style/TrivialAccessors:
498
688
  #
499
689
  # Commonly used in DSLs
500
690
  AllowDSLWriters: false
691
+ IgnoreClassMethods: false
501
692
  Whitelist:
502
693
  - to_ary
503
694
  - to_a
@@ -545,12 +736,18 @@ Metrics/ClassLength:
545
736
  CountComments: false # count full line comments?
546
737
  Max: 100
547
738
 
739
+ Metrics/ModuleLength:
740
+ CountComments: false # count full line comments?
741
+ Max: 100
742
+
548
743
  # Avoid complex methods.
549
744
  Metrics/CyclomaticComplexity:
550
745
  Max: 6
551
746
 
552
747
  Metrics/LineLength:
553
748
  Max: 80
749
+ # To make it possible to copy or click on URIs in the code, we allow lines
750
+ # contaning a URI to be longer than Max.
554
751
  AllowURI: true
555
752
  URISchemes:
556
753
  - http
@@ -584,6 +781,7 @@ Lint/EndAlignment:
584
781
  SupportedStyles:
585
782
  - keyword
586
783
  - variable
784
+ AutoCorrect: false
587
785
 
588
786
  Lint/DefEndAlignment:
589
787
  # The value `def` means that `end` should be aligned with the def keyword.
@@ -594,6 +792,7 @@ Lint/DefEndAlignment:
594
792
  SupportedStyles:
595
793
  - start_of_line
596
794
  - def
795
+ AutoCorrect: false
597
796
 
598
797
  ##################### Rails ##################################
599
798
 
@@ -605,10 +804,29 @@ Rails/ActionFilter:
605
804
  Include:
606
805
  - app/controllers/**/*.rb
607
806
 
807
+ Rails/Date:
808
+ # The value `always` disallows usage of `Date.today`, `Date.current`,
809
+ # `Date#to_time` etc.
810
+ # The value `acceptable` allows usage of `Date.current`, `Date.yesterday`, etc
811
+ # (but not `Date.today`) which are overriden by ActiveSupport to handle current
812
+ # time zone.
813
+ EnforcedStyle: always
814
+ SupportedStyles:
815
+ - always
816
+ - acceptable
817
+
608
818
  Rails/DefaultScope:
609
819
  Include:
610
820
  - app/models/**/*.rb
611
821
 
822
+ Rails/FindBy:
823
+ Include:
824
+ - app/models/**/*.rb
825
+
826
+ Rails/FindEach:
827
+ Include:
828
+ - app/models/**/*.rb
829
+
612
830
  Rails/HasAndBelongsToMany:
613
831
  Include:
614
832
  - app/models/**/*.rb
@@ -628,6 +846,14 @@ Rails/ScopeArgs:
628
846
  Include:
629
847
  - app/models/**/*.rb
630
848
 
849
+ Rails/TimeZone:
850
+ # The value `always` means that `Time` should be used with `zone`.
851
+ # The value `acceptable` allows usage of `in_time_zone` instead of `zone`.
852
+ EnforcedStyle: always
853
+ SupportedStyles:
854
+ - always
855
+ - acceptable
856
+
631
857
  Rails/Validation:
632
858
  Include:
633
859
  - app/models/**/*.rb
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = ">= 1.9.3"
23
23
 
24
- spec.add_dependency("rubocop", "0.28.0")
24
+ spec.add_dependency("rubocop", Finstyle::RUBOCOP_VERSION)
25
25
 
26
26
  spec.add_development_dependency("bundler", "~> 1.6")
27
27
  spec.add_development_dependency("rake", "~> 10.0")
@@ -1,6 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  require "finstyle/version"
4
+
5
+ # ensure the desired target version of RuboCop is gem activated
6
+ gem "rubocop", "= #{Finstyle::RUBOCOP_VERSION}"
4
7
  require "rubocop"
5
8
 
6
9
  # Honestly, this is generally **not** a good idea and takes advantage of
@@ -1,5 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
3
  module Finstyle
4
- VERSION = "1.4.0"
4
+ VERSION = "1.5.0"
5
+
6
+ RUBOCOP_VERSION = "0.32.1"
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-15 00:00:00.000000000 Z
11
+ date: 2015-06-29 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: 0.28.0
19
+ version: 0.32.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: 0.28.0
26
+ version: 0.32.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  version: '0'
130
130
  requirements: []
131
131
  rubyforge_project:
132
- rubygems_version: 2.2.2
132
+ rubygems_version: 2.4.5
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Version pinning RuboCop and configuration for consistentcy in CI