Skip to content

Commit 8c90c4c

Browse files
committed
Add RuboCop
1 parent 1520b2b commit 8c90c4c

File tree

4 files changed

+369
-1
lines changed

4 files changed

+369
-1
lines changed

.rubocop.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
inherit_from: .rubocop_todo.yml
2+
3+
AllCops:
4+
DisplayCopNames: true
5+
Exclude:
6+
- 'tmp/**/*'
7+
8+
Lint/EndAlignment:
9+
AlignWith: variable
10+
11+
Style/CaseIndentation:
12+
IndentWhenRelativeTo: end
13+
14+
Style/IndentHash:
15+
EnforcedStyle: consistent
16+
17+
Style/TrailingComma:
18+
EnforcedStyleForMultiline: comma
19+
20+
Style/TrivialAccessors:
21+
AllowPredicates: true
22+
23+
# TODO: remove when we end support for < 1.9.3
24+
25+
Style/HashSyntax:
26+
EnforcedStyle: hash_rockets
27+
28+
Style/Lambda:
29+
Enabled: false

.rubocop_todo.yml

Lines changed: 330 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,330 @@
1+
# This configuration was generated by `rubocop --auto-gen-config`
2+
# on 2015-03-12 17:39:18 -0700 using RuboCop version 0.29.1.
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: 2
9+
# Configuration parameters: AllowSafeAssignment.
10+
Lint/AssignmentInCondition:
11+
Enabled: false
12+
13+
# Offense count: 1
14+
# Cop supports --auto-correct.
15+
Lint/DeprecatedClassMethods:
16+
Enabled: false
17+
18+
# Offense count: 1
19+
# Configuration parameters: AlignWith, SupportedStyles.
20+
Lint/EndAlignment:
21+
Enabled: false
22+
23+
# Offense count: 1
24+
Lint/Eval:
25+
Enabled: false
26+
27+
# Offense count: 1
28+
Lint/RescueException:
29+
Enabled: false
30+
31+
# Offense count: 2
32+
Lint/ShadowingOuterLocalVariable:
33+
Enabled: false
34+
35+
# Offense count: 23
36+
# Cop supports --auto-correct.
37+
Lint/UnusedBlockArgument:
38+
Enabled: false
39+
40+
# Offense count: 1
41+
Lint/UselessAccessModifier:
42+
Enabled: false
43+
44+
# Offense count: 4
45+
Lint/UselessAssignment:
46+
Enabled: false
47+
48+
# Offense count: 1
49+
Lint/Void:
50+
Enabled: false
51+
52+
# Offense count: 2
53+
Metrics/AbcSize:
54+
Max: 64
55+
56+
# Offense count: 1
57+
Metrics/BlockNesting:
58+
Max: 5
59+
60+
# Offense count: 2
61+
Metrics/CyclomaticComplexity:
62+
Max: 21
63+
64+
# Offense count: 244
65+
# Configuration parameters: AllowURI, URISchemes.
66+
Metrics/LineLength:
67+
Max: 232
68+
69+
# Offense count: 4
70+
# Configuration parameters: CountComments.
71+
Metrics/MethodLength:
72+
Max: 40
73+
74+
# Offense count: 1
75+
Metrics/PerceivedComplexity:
76+
Max: 20
77+
78+
# Offense count: 40
79+
# Cop supports --auto-correct.
80+
Style/Blocks:
81+
Enabled: false
82+
83+
# Offense count: 8
84+
# Cop supports --auto-correct.
85+
# Configuration parameters: EnforcedStyle, SupportedStyles.
86+
Style/BracesAroundHashParameters:
87+
Enabled: false
88+
89+
# Offense count: 1
90+
# Configuration parameters: EnforcedStyle, SupportedStyles.
91+
Style/ClassAndModuleChildren:
92+
Enabled: false
93+
94+
# Offense count: 1
95+
Style/ClassVars:
96+
Enabled: false
97+
98+
# Offense count: 2
99+
# Cop supports --auto-correct.
100+
Style/CommentIndentation:
101+
Enabled: false
102+
103+
# Offense count: 1
104+
# Cop supports --auto-correct.
105+
Style/DeprecatedHashMethods:
106+
Enabled: false
107+
108+
# Offense count: 9
109+
Style/Documentation:
110+
Enabled: false
111+
112+
# Offense count: 1
113+
Style/DoubleNegation:
114+
Enabled: false
115+
116+
# Offense count: 2
117+
# Cop supports --auto-correct.
118+
Style/ElseAlignment:
119+
Enabled: false
120+
121+
# Offense count: 1
122+
# Cop supports --auto-correct.
123+
Style/EmptyLines:
124+
Enabled: false
125+
126+
# Offense count: 1
127+
# Cop supports --auto-correct.
128+
Style/EmptyLinesAroundAccessModifier:
129+
Enabled: false
130+
131+
# Offense count: 2
132+
# Cop supports --auto-correct.
133+
# Configuration parameters: EnforcedStyle, SupportedStyles.
134+
Style/EmptyLinesAroundModuleBody:
135+
Enabled: false
136+
137+
# Offense count: 9
138+
# Configuration parameters: AllowedVariables.
139+
Style/GlobalVars:
140+
Enabled: false
141+
142+
# Offense count: 4
143+
# Configuration parameters: MaxLineLength.
144+
Style/IfUnlessModifier:
145+
Enabled: false
146+
147+
# Offense count: 1
148+
# Cop supports --auto-correct.
149+
Style/IndentationConsistency:
150+
Enabled: false
151+
152+
# Offense count: 3
153+
# Cop supports --auto-correct.
154+
# Configuration parameters: Width.
155+
Style/IndentationWidth:
156+
Enabled: false
157+
158+
# Offense count: 3
159+
# Cop supports --auto-correct.
160+
# Configuration parameters: EnforcedStyle, SupportedStyles.
161+
Style/MethodDefParentheses:
162+
Enabled: false
163+
164+
# Offense count: 1
165+
Style/MultilineBlockChain:
166+
Enabled: false
167+
168+
# Offense count: 2
169+
# Cop supports --auto-correct.
170+
Style/MultilineIfThen:
171+
Enabled: false
172+
173+
# Offense count: 1
174+
# Cop supports --auto-correct.
175+
Style/NegatedIf:
176+
Enabled: false
177+
178+
# Offense count: 1
179+
# Cop supports --auto-correct.
180+
Style/NegatedWhile:
181+
Enabled: false
182+
183+
# Offense count: 1
184+
# Cop supports --auto-correct.
185+
Style/Not:
186+
Enabled: false
187+
188+
# Offense count: 13
189+
# Cop supports --auto-correct.
190+
Style/NumericLiterals:
191+
MinDigits: 20
192+
193+
# Offense count: 7
194+
# Cop supports --auto-correct.
195+
# Configuration parameters: PreferredDelimiters.
196+
Style/PercentLiteralDelimiters:
197+
Enabled: false
198+
199+
# Offense count: 1
200+
# Configuration parameters: SupportedStyles.
201+
Style/RaiseArgs:
202+
EnforcedStyle: compact
203+
204+
# Offense count: 1
205+
# Cop supports --auto-correct.
206+
Style/RedundantSelf:
207+
Enabled: false
208+
209+
# Offense count: 1
210+
Style/RegexpLiteral:
211+
MaxSlashes: 0
212+
213+
# Offense count: 2
214+
# Cop supports --auto-correct.
215+
# Configuration parameters: EnforcedStyle, SupportedStyles.
216+
Style/SignalException:
217+
Enabled: false
218+
219+
# Offense count: 9
220+
# Cop supports --auto-correct.
221+
Style/SingleSpaceBeforeFirstArg:
222+
Enabled: false
223+
224+
# Offense count: 6
225+
# Cop supports --auto-correct.
226+
Style/SpaceAfterComma:
227+
Enabled: false
228+
229+
# Offense count: 1
230+
# Cop supports --auto-correct.
231+
Style/SpaceAfterControlKeyword:
232+
Enabled: false
233+
234+
# Offense count: 1
235+
# Cop supports --auto-correct.
236+
Style/SpaceAfterNot:
237+
Enabled: false
238+
239+
# Offense count: 3
240+
# Cop supports --auto-correct.
241+
# Configuration parameters: EnforcedStyle, SupportedStyles.
242+
Style/SpaceAroundEqualsInParameterDefault:
243+
Enabled: false
244+
245+
# Offense count: 5
246+
# Cop supports --auto-correct.
247+
Style/SpaceAroundOperators:
248+
Enabled: false
249+
250+
# Offense count: 5
251+
# Cop supports --auto-correct.
252+
# Configuration parameters: EnforcedStyle, SupportedStyles.
253+
Style/SpaceBeforeBlockBraces:
254+
Enabled: false
255+
256+
# Offense count: 14
257+
# Cop supports --auto-correct.
258+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
259+
Style/SpaceInsideBlockBraces:
260+
Enabled: false
261+
262+
# Offense count: 2
263+
# Cop supports --auto-correct.
264+
Style/SpaceInsideBrackets:
265+
Enabled: false
266+
267+
# Offense count: 8
268+
# Cop supports --auto-correct.
269+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
270+
Style/SpaceInsideHashLiteralBraces:
271+
Enabled: false
272+
273+
# Offense count: 4
274+
# Cop supports --auto-correct.
275+
Style/SpaceInsideParens:
276+
Enabled: false
277+
278+
# Offense count: 2
279+
# Cop supports --auto-correct.
280+
Style/SpecialGlobalVars:
281+
Enabled: false
282+
283+
# Offense count: 550
284+
# Cop supports --auto-correct.
285+
# Configuration parameters: EnforcedStyle, SupportedStyles.
286+
Style/StringLiterals:
287+
Enabled: false
288+
289+
# Offense count: 1
290+
# Cop supports --auto-correct.
291+
# Configuration parameters: IgnoredMethods.
292+
Style/SymbolProc:
293+
Enabled: false
294+
295+
# Offense count: 2
296+
# Cop supports --auto-correct.
297+
# Configuration parameters: EnforcedStyle, SupportedStyles.
298+
Style/TrailingBlankLines:
299+
Enabled: false
300+
301+
# Offense count: 6
302+
# Cop supports --auto-correct.
303+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
304+
Style/TrailingComma:
305+
Enabled: false
306+
307+
# Offense count: 2
308+
Style/UnlessElse:
309+
Enabled: false
310+
311+
# Offense count: 4
312+
# Cop supports --auto-correct.
313+
Style/UnneededPercentQ:
314+
Enabled: false
315+
316+
# Offense count: 1
317+
# Cop supports --auto-correct.
318+
Style/WhileUntilDo:
319+
Enabled: false
320+
321+
# Offense count: 1
322+
# Configuration parameters: MaxLineLength.
323+
Style/WhileUntilModifier:
324+
Enabled: false
325+
326+
# Offense count: 4
327+
# Cop supports --auto-correct.
328+
# Configuration parameters: WordRegex.
329+
Style/WordArray:
330+
MinSize: 5

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gem 'rake-compiler', '~> 0.9.5'
88
group :test do
99
gem 'eventmachine' unless RUBY_PLATFORM =~ /mswin|mingw/
1010
gem 'rspec', '~> 3.2'
11+
gem 'rubocop', '~> 0.29.1' unless RUBY_VERSION =~ /1.8/
1112
end
1213

1314
group :benchmarks do

Rakefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@ load 'tasks/compile.rake'
88
load 'tasks/generate.rake'
99
load 'tasks/benchmarks.rake'
1010

11-
task :default => :spec
11+
# TODO: remove when we end support for < 1.9.3
12+
if RUBY_VERSION =~ /1.8/
13+
task :default => :spec
14+
else
15+
require 'rubocop/rake_task'
16+
RuboCop::RakeTask.new
17+
18+
task :default => [:spec, :rubocop]
19+
end

0 commit comments

Comments
 (0)