Skip to content

Commit 09c97de

Browse files
committed
Add Style enforcer (via Rubocop)
It will fail the build, but as it is currently, most of the cops are 'todos'. Great for new contributors.. :)
1 parent 6784866 commit 09c97de

File tree

12 files changed

+430
-10
lines changed

12 files changed

+430
-10
lines changed

.rubocop.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
inherit_from: .rubocop_todo.yml
2+
3+
AllCops:
4+
Exclude:
5+
- config/initializers/forbidden_yaml.rb
6+
- !ruby/regexp /(vendor|bundle|bin|db)\/.*/
7+
RunRailsCops: true
8+
DisplayCopNames: true
9+
DisplayStyleGuide: true
10+
11+
Lint/NestedMethodDefinition:
12+
Enabled: false
13+
Exclude:
14+
- test/action_controller/serialization_test.rb
15+
16+
Style/StringLiterals:
17+
EnforcedStyle: single_quotes
18+
19+
Metrics/AbcSize:
20+
Max: 35 # TODO: Lower to 15
21+
22+
Metrics/ClassLength:
23+
Max: 261 # TODO: Lower to 100
24+
Exclude:
25+
- test/**/*.rb
26+
27+
Metrics/CyclomaticComplexity:
28+
Max: 7 # TODO: Lower to 6
29+
30+
Metrics/LineLength:
31+
Max: 251 # TODO: Lower to 80
32+
33+
Metrics/MethodLength:
34+
Max: 106 # TODO: Lower to 10
35+
36+
Metrics/PerceivedComplexity:
37+
Max: 9 # TODO: Lower to 7
38+
39+
Style/AlignParameters:
40+
EnforcedStyle: with_fixed_indentation
41+
42+
Style/ClassAndModuleChildren:
43+
EnforcedStyle: compact
44+
45+
Style/Documentation:
46+
Enabled: false
47+
48+
Style/MultilineOperationIndentation:
49+
EnforcedStyle: indented

.rubocop_todo.yml

Lines changed: 347 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,347 @@
1+
# This configuration was generated by `rubocop --auto-gen-config`
2+
# on 2015-08-30 23:03:50 -0500 using RuboCop version 0.31.0.
3+
# The point is for the user to remove these configuration records
4+
# one by one as the offenses are removed from the code base.
5+
# Note that changes in the inspected code, or installation of new
6+
# versions of RuboCop, may require this file to be generated again.
7+
8+
# Offense count: 1
9+
# Configuration parameters: AllowSafeAssignment.
10+
Lint/AssignmentInCondition:
11+
Enabled: false
12+
13+
# Offense count: 1
14+
Lint/EmptyEnsure:
15+
Enabled: false
16+
17+
# Offense count: 1
18+
Lint/HandleExceptions:
19+
Enabled: false
20+
21+
# Offense count: 2
22+
# Cop supports --auto-correct.
23+
Lint/UnusedBlockArgument:
24+
Enabled: false
25+
26+
# Offense count: 9
27+
# Cop supports --auto-correct.
28+
Lint/UnusedMethodArgument:
29+
Enabled: false
30+
31+
# Offense count: 1
32+
Lint/UselessAccessModifier:
33+
Enabled: false
34+
35+
# Offense count: 3
36+
Lint/UselessAssignment:
37+
Enabled: false
38+
39+
# Offense count: 1
40+
# Configuration parameters: EnforcedStyle, SupportedStyles.
41+
Rails/Date:
42+
Enabled: false
43+
44+
# Offense count: 8
45+
# Configuration parameters: EnforcedStyle, SupportedStyles.
46+
Rails/TimeZone:
47+
Enabled: false
48+
49+
# Offense count: 1
50+
# Cop supports --auto-correct.
51+
# Configuration parameters: EnforcedStyle, SupportedStyles.
52+
Style/AccessModifierIndentation:
53+
Enabled: false
54+
55+
# Offense count: 16
56+
# Cop supports --auto-correct.
57+
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle, SupportedLastArgumentHashStyles.
58+
Style/AlignHash:
59+
Enabled: false
60+
61+
# Offense count: 6
62+
# Cop supports --auto-correct.
63+
# Configuration parameters: EnforcedStyle, SupportedStyles.
64+
Style/AlignParameters:
65+
Enabled: false
66+
67+
# Offense count: 1
68+
# Cop supports --auto-correct.
69+
# Configuration parameters: EnforcedStyle, SupportedStyles.
70+
Style/AndOr:
71+
Enabled: false
72+
73+
# Offense count: 6
74+
# Cop supports --auto-correct.
75+
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
76+
Style/BlockDelimiters:
77+
Enabled: false
78+
79+
# Offense count: 46
80+
# Cop supports --auto-correct.
81+
# Configuration parameters: EnforcedStyle, SupportedStyles.
82+
Style/BracesAroundHashParameters:
83+
Enabled: false
84+
85+
# Offense count: 167
86+
# Configuration parameters: EnforcedStyle, SupportedStyles.
87+
Style/ClassAndModuleChildren:
88+
Enabled: false
89+
90+
# Offense count: 1
91+
# Cop supports --auto-correct.
92+
Style/CommentIndentation:
93+
Enabled: false
94+
95+
# Offense count: 1
96+
Style/DoubleNegation:
97+
Enabled: false
98+
99+
# Offense count: 1
100+
Style/EachWithObject:
101+
Enabled: false
102+
103+
# Offense count: 4
104+
# Cop supports --auto-correct.
105+
Style/EmptyLines:
106+
Enabled: false
107+
108+
# Offense count: 3
109+
# Cop supports --auto-correct.
110+
Style/EmptyLinesAroundAccessModifier:
111+
Enabled: false
112+
113+
# Offense count: 2
114+
# Cop supports --auto-correct.
115+
# Configuration parameters: EnforcedStyle, SupportedStyles.
116+
Style/EmptyLinesAroundBlockBody:
117+
Enabled: false
118+
119+
# Offense count: 16
120+
# Cop supports --auto-correct.
121+
# Configuration parameters: EnforcedStyle, SupportedStyles.
122+
Style/EmptyLinesAroundClassBody:
123+
Enabled: false
124+
125+
# Offense count: 9
126+
# Cop supports --auto-correct.
127+
Style/EmptyLinesAroundMethodBody:
128+
Enabled: false
129+
130+
# Offense count: 3
131+
# Cop supports --auto-correct.
132+
# Configuration parameters: EnforcedStyle, SupportedStyles.
133+
Style/EmptyLinesAroundModuleBody:
134+
Enabled: false
135+
136+
# Offense count: 3
137+
# Configuration parameters: MinBodyLength.
138+
Style/GuardClause:
139+
Enabled: false
140+
141+
# Offense count: 12
142+
# Cop supports --auto-correct.
143+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues.
144+
Style/HashSyntax:
145+
Enabled: false
146+
147+
# Offense count: 9
148+
# Cop supports --auto-correct.
149+
Style/IndentArray:
150+
Enabled: false
151+
152+
# Offense count: 8
153+
# Cop supports --auto-correct.
154+
# Configuration parameters: EnforcedStyle, SupportedStyles.
155+
Style/IndentHash:
156+
Enabled: false
157+
158+
# Offense count: 1
159+
# Cop supports --auto-correct.
160+
# Configuration parameters: EnforcedStyle, SupportedStyles.
161+
Style/IndentationConsistency:
162+
Enabled: false
163+
164+
# Offense count: 2
165+
# Cop supports --auto-correct.
166+
# Configuration parameters: Width.
167+
Style/IndentationWidth:
168+
Enabled: false
169+
170+
# Offense count: 1
171+
# Cop supports --auto-correct.
172+
Style/Lambda:
173+
Enabled: false
174+
175+
# Offense count: 2
176+
# Cop supports --auto-correct.
177+
Style/MethodCallParentheses:
178+
Enabled: false
179+
180+
# Offense count: 1
181+
# Cop supports --auto-correct.
182+
# Configuration parameters: EnforcedStyle, SupportedStyles.
183+
Style/MethodDefParentheses:
184+
Enabled: false
185+
186+
# Offense count: 3
187+
# Cop supports --auto-correct.
188+
# Configuration parameters: EnforcedStyle, SupportedStyles.
189+
Style/MultilineOperationIndentation:
190+
Enabled: false
191+
192+
# Offense count: 1
193+
# Cop supports --auto-correct.
194+
Style/NegatedIf:
195+
Enabled: false
196+
197+
# Offense count: 1
198+
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
199+
Style/Next:
200+
Enabled: false
201+
202+
# Offense count: 1
203+
# Cop supports --auto-correct.
204+
Style/NumericLiterals:
205+
MinDigits: 7
206+
207+
# Offense count: 2
208+
# Cop supports --auto-correct.
209+
# Configuration parameters: PreferredDelimiters.
210+
Style/PercentLiteralDelimiters:
211+
Enabled: false
212+
213+
# Offense count: 2
214+
# Cop supports --auto-correct.
215+
Style/PerlBackrefs:
216+
Enabled: false
217+
218+
# Offense count: 6
219+
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
220+
Style/PredicateName:
221+
Enabled: false
222+
223+
# Offense count: 7
224+
# Cop supports --auto-correct.
225+
Style/RedundantSelf:
226+
Enabled: false
227+
228+
# Offense count: 1
229+
# Cop supports --auto-correct.
230+
# Configuration parameters: AllowAsExpressionSeparator.
231+
Style/Semicolon:
232+
Enabled: false
233+
234+
# Offense count: 6
235+
# Cop supports --auto-correct.
236+
# Configuration parameters: EnforcedStyle, SupportedStyles.
237+
Style/SignalException:
238+
Enabled: false
239+
240+
# Offense count: 1
241+
# Cop supports --auto-correct.
242+
# Configuration parameters: AllowIfMethodIsEmpty.
243+
Style/SingleLineMethods:
244+
Enabled: false
245+
246+
# Offense count: 26
247+
# Cop supports --auto-correct.
248+
Style/SpaceAfterColon:
249+
Enabled: false
250+
251+
# Offense count: 7
252+
# Cop supports --auto-correct.
253+
Style/SpaceAfterComma:
254+
Enabled: false
255+
256+
# Offense count: 1
257+
# Cop supports --auto-correct.
258+
Style/SpaceAfterNot:
259+
Enabled: false
260+
261+
# Offense count: 5
262+
# Cop supports --auto-correct.
263+
# Configuration parameters: EnforcedStyle, SupportedStyles.
264+
Style/SpaceAroundEqualsInParameterDefault:
265+
Enabled: false
266+
267+
# Offense count: 39
268+
# Cop supports --auto-correct.
269+
# Configuration parameters: MultiSpaceAllowedForOperators.
270+
Style/SpaceAroundOperators:
271+
Enabled: false
272+
273+
# Offense count: 3
274+
# Cop supports --auto-correct.
275+
# Configuration parameters: EnforcedStyle, SupportedStyles.
276+
Style/SpaceBeforeBlockBraces:
277+
Enabled: false
278+
279+
# Offense count: 8
280+
# Cop supports --auto-correct.
281+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
282+
Style/SpaceInsideBlockBraces:
283+
Enabled: false
284+
285+
# Offense count: 20
286+
# Cop supports --auto-correct.
287+
Style/SpaceInsideBrackets:
288+
Enabled: false
289+
290+
# Offense count: 179
291+
# Cop supports --auto-correct.
292+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
293+
Style/SpaceInsideHashLiteralBraces:
294+
Enabled: false
295+
296+
# Offense count: 1
297+
# Cop supports --auto-correct.
298+
Style/SpaceInsideParens:
299+
Enabled: false
300+
301+
# Offense count: 2
302+
# Cop supports --auto-correct.
303+
# Configuration parameters: EnforcedStyle, SupportedStyles.
304+
Style/StringLiteralsInInterpolation:
305+
Enabled: false
306+
307+
# Offense count: 1
308+
Style/StructInheritance:
309+
Enabled: false
310+
311+
# Offense count: 1
312+
# Cop supports --auto-correct.
313+
# Configuration parameters: IgnoredMethods.
314+
Style/SymbolProc:
315+
Enabled: false
316+
317+
# Offense count: 9
318+
# Cop supports --auto-correct.
319+
# Configuration parameters: EnforcedStyle, SupportedStyles.
320+
Style/TrailingBlankLines:
321+
Enabled: false
322+
323+
# Offense count: 6
324+
# Cop supports --auto-correct.
325+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
326+
Style/TrailingComma:
327+
Enabled: false
328+
329+
# Offense count: 2
330+
# Cop supports --auto-correct.
331+
Style/TrailingWhitespace:
332+
Enabled: false
333+
334+
# Offense count: 1
335+
Style/UnlessElse:
336+
Enabled: false
337+
338+
# Offense count: 2
339+
# Cop supports --auto-correct.
340+
Style/UnneededPercentQ:
341+
Enabled: false
342+
343+
# Offense count: 4
344+
# Cop supports --auto-correct.
345+
# Configuration parameters: WordRegex.
346+
Style/WordArray:
347+
MinSize: 2

0 commit comments

Comments
 (0)