the_bath_of_zahn 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/Rakefile +14 -2
- data/{rubocop.yml → config/internal/overrides.yml} +0 -5
- data/config/internal/rails_style_guide.yml +47 -0
- data/config/internal/style_guide.yml +986 -0
- data/config/rubocop-rails.yml +13 -0
- data/config/rubocop.yml +7 -0
- data/lib/the_bath_of_zahn/utility/extractor.rb +48 -0
- data/the_bath_of_zahn.gemspec +2 -2
- metadata +13 -9
- data/rubocop-rails.yml +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cde9bc080f5a06d68306f15616880cd31c183e0b
|
4
|
+
data.tar.gz: 3150d6504ccd8bdf9b78833c0bb390565902bd46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 657f2363772906e13c1a49efaabd16b8bfcd316990a9a1dcb917d63f72cb8ad8ff71fa53841f9e6f3470245bbb60de044f5722147d3703fbb392bff3277b0f78
|
7
|
+
data.tar.gz: ef82f1e739c3d4136301e116a9349effa49da36f8d0d954f63ee56640e0dafa1ccab1cec7785127da583e85d32daa5b2e81a7d644a4051449ba91b9fb4d45042
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ tests/specs can have as many lines as desired.
|
|
11
11
|
The rules here were generally guided by a few principles:
|
12
12
|
|
13
13
|
1. Prefer what the Ruby community seems to follow as a whole
|
14
|
-
1. Prefer rules which
|
14
|
+
1. Prefer rules which result in a smaller `git diff`
|
15
15
|
1. Avoid unnecessarily changing default behavior
|
16
16
|
|
17
17
|
|
@@ -38,7 +38,7 @@ Create a `.rubocop.yml` file in your repository with the following contents
|
|
38
38
|
|
39
39
|
```yaml
|
40
40
|
inherit_gem:
|
41
|
-
the_bath_of_zahn: rubocop-rails.yml
|
41
|
+
the_bath_of_zahn: config/rubocop-rails.yml
|
42
42
|
```
|
43
43
|
|
44
44
|
Or, if you are not working on a Rails project, there's a non-Rails configuration
|
@@ -46,7 +46,7 @@ as well.
|
|
46
46
|
|
47
47
|
```yaml
|
48
48
|
inherit_gem:
|
49
|
-
the_bath_of_zahn: rubocop.yml
|
49
|
+
the_bath_of_zahn: config/rubocop.yml
|
50
50
|
```
|
51
51
|
|
52
52
|
|
data/Rakefile
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
3
|
task :test do
|
4
|
-
system %(rubocop -c rubocop.yml)
|
5
|
-
system %(rubocop -c rubocop-rails.yml)
|
4
|
+
system %(rubocop -c config/rubocop.yml)
|
5
|
+
system %(rubocop -c config/rubocop-rails.yml)
|
6
6
|
end
|
7
7
|
|
8
8
|
task :fix do
|
9
9
|
system %(rubocop -c rubocop.yml -a)
|
10
10
|
end
|
11
11
|
|
12
|
+
task :extract do
|
13
|
+
require "yaml"
|
14
|
+
require_relative "lib/the_bath_of_zahn/utility/extractor"
|
15
|
+
|
16
|
+
extract = TheBathOfZahn::Utility::Extractor.new
|
17
|
+
|
18
|
+
Dir.chdir("config/internal") do
|
19
|
+
File.write("style_guide.yml", extract.rules_plain.to_yaml)
|
20
|
+
File.write("rails_style_guide.yml", extract.rules_rails.to_yaml)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
12
24
|
task default: :test
|
@@ -0,0 +1,47 @@
|
|
1
|
+
---
|
2
|
+
Rails/DynamicFindBy:
|
3
|
+
Description: Use `find_by` instead of dynamic `find_by_*`.
|
4
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#find_by
|
5
|
+
Enabled: true
|
6
|
+
Whitelist:
|
7
|
+
- find_by_sql
|
8
|
+
Rails/FindBy:
|
9
|
+
Description: Prefer find_by over where.first.
|
10
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#find_by
|
11
|
+
Enabled: true
|
12
|
+
Include:
|
13
|
+
- app/models/**/*.rb
|
14
|
+
Rails/FindEach:
|
15
|
+
Description: Prefer all.find_each over all.find.
|
16
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#find-each
|
17
|
+
Enabled: true
|
18
|
+
Include:
|
19
|
+
- app/models/**/*.rb
|
20
|
+
Rails/HasAndBelongsToMany:
|
21
|
+
Description: Prefer has_many :through to has_and_belongs_to_many.
|
22
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#has-many-through
|
23
|
+
Enabled: true
|
24
|
+
Include:
|
25
|
+
- app/models/**/*.rb
|
26
|
+
Rails/ReadWriteAttribute:
|
27
|
+
Description: Checks for read_attribute(:attr) and write_attribute(:attr, val).
|
28
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#read-attribute
|
29
|
+
Enabled: true
|
30
|
+
Include:
|
31
|
+
- app/models/**/*.rb
|
32
|
+
Rails/ReversibleMigration:
|
33
|
+
Description: Checks whether the change method of the migration file is reversible.
|
34
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#reversible-migration
|
35
|
+
Reference: http://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html
|
36
|
+
Enabled: true
|
37
|
+
Include:
|
38
|
+
- db/migrate/*.rb
|
39
|
+
Rails/TimeZone:
|
40
|
+
Description: Checks the correct usage of time zone aware methods.
|
41
|
+
StyleGuide: https://github.com/bbatsov/rails-style-guide#time
|
42
|
+
Reference: http://danilenko.org/2012/7/6/rails_timezones
|
43
|
+
Enabled: true
|
44
|
+
EnforcedStyle: flexible
|
45
|
+
SupportedStyles:
|
46
|
+
- strict
|
47
|
+
- flexible
|
@@ -0,0 +1,986 @@
|
|
1
|
+
---
|
2
|
+
Layout/AccessModifierIndentation:
|
3
|
+
Description: Check indentation of private/protected visibility modifiers.
|
4
|
+
StyleGuide: "#indent-public-private-protected"
|
5
|
+
Enabled: true
|
6
|
+
EnforcedStyle: indent
|
7
|
+
SupportedStyles:
|
8
|
+
- outdent
|
9
|
+
- indent
|
10
|
+
IndentationWidth:
|
11
|
+
Layout/AlignArray:
|
12
|
+
Description: Align the elements of an array literal if they span more than one line.
|
13
|
+
StyleGuide: "#align-multiline-arrays"
|
14
|
+
Enabled: true
|
15
|
+
Layout/AlignParameters:
|
16
|
+
Description: Align the parameters of a method call if they span more than one line.
|
17
|
+
StyleGuide: "#no-double-indent"
|
18
|
+
Enabled: true
|
19
|
+
EnforcedStyle: with_first_parameter
|
20
|
+
SupportedStyles:
|
21
|
+
- with_first_parameter
|
22
|
+
- with_fixed_indentation
|
23
|
+
IndentationWidth:
|
24
|
+
Layout/CaseIndentation:
|
25
|
+
Description: Indentation of when in a case/when/[else/]end.
|
26
|
+
StyleGuide: "#indent-when-to-case"
|
27
|
+
Enabled: true
|
28
|
+
EnforcedStyle: case
|
29
|
+
SupportedStyles:
|
30
|
+
- case
|
31
|
+
- end
|
32
|
+
IndentOneStep: false
|
33
|
+
IndentationWidth:
|
34
|
+
Layout/DotPosition:
|
35
|
+
Description: Checks the position of the dot in multi-line method calls.
|
36
|
+
StyleGuide: "#consistent-multi-line-chains"
|
37
|
+
Enabled: true
|
38
|
+
EnforcedStyle: leading
|
39
|
+
SupportedStyles:
|
40
|
+
- leading
|
41
|
+
- trailing
|
42
|
+
Layout/EmptyLineBetweenDefs:
|
43
|
+
Description: Use empty lines between defs.
|
44
|
+
StyleGuide: "#empty-lines-between-methods"
|
45
|
+
Enabled: true
|
46
|
+
AllowAdjacentOneLineDefs: false
|
47
|
+
NumberOfEmptyLines: 1
|
48
|
+
Layout/EmptyLines:
|
49
|
+
Description: Don't use several empty lines in a row.
|
50
|
+
StyleGuide: "#two-or-more-empty-lines"
|
51
|
+
Enabled: true
|
52
|
+
Layout/EmptyLinesAroundAccessModifier:
|
53
|
+
Description: Keep blank lines around access modifiers.
|
54
|
+
StyleGuide: "#empty-lines-around-access-modifier"
|
55
|
+
Enabled: true
|
56
|
+
Layout/EmptyLinesAroundBeginBody:
|
57
|
+
Description: Keeps track of empty lines around begin-end bodies.
|
58
|
+
StyleGuide: "#empty-lines-around-bodies"
|
59
|
+
Enabled: true
|
60
|
+
Layout/EmptyLinesAroundBlockBody:
|
61
|
+
Description: Keeps track of empty lines around block bodies.
|
62
|
+
StyleGuide: "#empty-lines-around-bodies"
|
63
|
+
Enabled: true
|
64
|
+
EnforcedStyle: no_empty_lines
|
65
|
+
SupportedStyles:
|
66
|
+
- empty_lines
|
67
|
+
- no_empty_lines
|
68
|
+
Layout/EmptyLinesAroundClassBody:
|
69
|
+
Description: Keeps track of empty lines around class bodies.
|
70
|
+
StyleGuide: "#empty-lines-around-bodies"
|
71
|
+
Enabled: true
|
72
|
+
EnforcedStyle: no_empty_lines
|
73
|
+
SupportedStyles:
|
74
|
+
- empty_lines
|
75
|
+
- empty_lines_except_namespace
|
76
|
+
- empty_lines_special
|
77
|
+
- no_empty_lines
|
78
|
+
Layout/EmptyLinesAroundExceptionHandlingKeywords:
|
79
|
+
Description: Keeps track of empty lines around exception handling keywords.
|
80
|
+
StyleGuide: "#empty-lines-around-bodies"
|
81
|
+
Enabled: true
|
82
|
+
Layout/EmptyLinesAroundModuleBody:
|
83
|
+
Description: Keeps track of empty lines around module bodies.
|
84
|
+
StyleGuide: "#empty-lines-around-bodies"
|
85
|
+
Enabled: true
|
86
|
+
EnforcedStyle: no_empty_lines
|
87
|
+
SupportedStyles:
|
88
|
+
- empty_lines
|
89
|
+
- empty_lines_except_namespace
|
90
|
+
- empty_lines_special
|
91
|
+
- no_empty_lines
|
92
|
+
Layout/EmptyLinesAroundMethodBody:
|
93
|
+
Description: Keeps track of empty lines around method bodies.
|
94
|
+
StyleGuide: "#empty-lines-around-bodies"
|
95
|
+
Enabled: true
|
96
|
+
Layout/EndOfLine:
|
97
|
+
Description: Use Unix-style line endings.
|
98
|
+
StyleGuide: "#crlf"
|
99
|
+
Enabled: true
|
100
|
+
EnforcedStyle: native
|
101
|
+
SupportedStyles:
|
102
|
+
- native
|
103
|
+
- lf
|
104
|
+
- crlf
|
105
|
+
Layout/IndentationConsistency:
|
106
|
+
Description: Keep indentation straight.
|
107
|
+
StyleGuide: "#spaces-indentation"
|
108
|
+
Enabled: true
|
109
|
+
EnforcedStyle: normal
|
110
|
+
SupportedStyles:
|
111
|
+
- normal
|
112
|
+
- rails
|
113
|
+
Layout/IndentationWidth:
|
114
|
+
Description: Use 2 spaces for indentation.
|
115
|
+
StyleGuide: "#spaces-indentation"
|
116
|
+
Enabled: true
|
117
|
+
Width: 2
|
118
|
+
IgnoredPatterns: []
|
119
|
+
Layout/IndentHeredoc:
|
120
|
+
Description: This cops checks the indentation of the here document bodies.
|
121
|
+
StyleGuide: "#squiggly-heredocs"
|
122
|
+
Enabled: true
|
123
|
+
EnforcedStyle: auto_detection
|
124
|
+
SupportedStyles:
|
125
|
+
- auto_detection
|
126
|
+
- squiggly
|
127
|
+
- active_support
|
128
|
+
- powerpack
|
129
|
+
- unindent
|
130
|
+
Layout/LeadingCommentSpace:
|
131
|
+
Description: Comments should start with a space.
|
132
|
+
StyleGuide: "#hash-space"
|
133
|
+
Enabled: true
|
134
|
+
Layout/EmptyLineAfterMagicComment:
|
135
|
+
Description: Add an empty line after magic comments to separate them from code.
|
136
|
+
StyleGuide: "#separate-magic-comments-from-code"
|
137
|
+
Enabled: true
|
138
|
+
Layout/SpaceAfterColon:
|
139
|
+
Description: Use spaces after colons.
|
140
|
+
StyleGuide: "#spaces-operators"
|
141
|
+
Enabled: true
|
142
|
+
Layout/SpaceAfterComma:
|
143
|
+
Description: Use spaces after commas.
|
144
|
+
StyleGuide: "#spaces-operators"
|
145
|
+
Enabled: true
|
146
|
+
Layout/SpaceAfterMethodName:
|
147
|
+
Description: Do not put a space between a method name and the opening parenthesis
|
148
|
+
in a method definition.
|
149
|
+
StyleGuide: "#parens-no-spaces"
|
150
|
+
Enabled: true
|
151
|
+
Layout/SpaceAfterNot:
|
152
|
+
Description: Tracks redundant space after the ! operator.
|
153
|
+
StyleGuide: "#no-space-bang"
|
154
|
+
Enabled: true
|
155
|
+
Layout/SpaceAfterSemicolon:
|
156
|
+
Description: Use spaces after semicolons.
|
157
|
+
StyleGuide: "#spaces-operators"
|
158
|
+
Enabled: true
|
159
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
160
|
+
Description: Checks that the equals signs in parameter default assignments have
|
161
|
+
or don't have surrounding space depending on configuration.
|
162
|
+
StyleGuide: "#spaces-around-equals"
|
163
|
+
Enabled: true
|
164
|
+
EnforcedStyle: space
|
165
|
+
SupportedStyles:
|
166
|
+
- space
|
167
|
+
- no_space
|
168
|
+
Layout/SpaceAroundOperators:
|
169
|
+
Description: Use a single space around operators.
|
170
|
+
StyleGuide: "#spaces-operators"
|
171
|
+
Enabled: true
|
172
|
+
AllowForAlignment: true
|
173
|
+
Layout/SpaceInsideBrackets:
|
174
|
+
Description: No spaces after [ or before ].
|
175
|
+
StyleGuide: "#no-spaces-braces"
|
176
|
+
Enabled: true
|
177
|
+
Layout/SpaceInsideHashLiteralBraces:
|
178
|
+
Description: Use spaces inside hash literal braces - or don't.
|
179
|
+
StyleGuide: "#spaces-operators"
|
180
|
+
Enabled: true
|
181
|
+
EnforcedStyle: space
|
182
|
+
SupportedStyles:
|
183
|
+
- space
|
184
|
+
- no_space
|
185
|
+
- compact
|
186
|
+
EnforcedStyleForEmptyBraces: no_space
|
187
|
+
SupportedStylesForEmptyBraces:
|
188
|
+
- space
|
189
|
+
- no_space
|
190
|
+
Layout/SpaceInsideParens:
|
191
|
+
Description: No spaces after ( or before ).
|
192
|
+
StyleGuide: "#no-spaces-braces"
|
193
|
+
Enabled: true
|
194
|
+
Layout/SpaceInsideRangeLiteral:
|
195
|
+
Description: No spaces inside range literals.
|
196
|
+
StyleGuide: "#no-space-inside-range-literals"
|
197
|
+
Enabled: true
|
198
|
+
Layout/SpaceInsideStringInterpolation:
|
199
|
+
Description: Checks for padding/surrounding spaces inside string interpolation.
|
200
|
+
StyleGuide: "#string-interpolation"
|
201
|
+
Enabled: true
|
202
|
+
EnforcedStyle: no_space
|
203
|
+
SupportedStyles:
|
204
|
+
- space
|
205
|
+
- no_space
|
206
|
+
Layout/Tab:
|
207
|
+
Description: No hard tabs.
|
208
|
+
StyleGuide: "#spaces-indentation"
|
209
|
+
Enabled: true
|
210
|
+
Layout/TrailingBlankLines:
|
211
|
+
Description: Checks trailing blank lines and final newline.
|
212
|
+
StyleGuide: "#newline-eof"
|
213
|
+
Enabled: true
|
214
|
+
EnforcedStyle: final_newline
|
215
|
+
SupportedStyles:
|
216
|
+
- final_newline
|
217
|
+
- final_blank_line
|
218
|
+
Layout/TrailingWhitespace:
|
219
|
+
Description: Avoid trailing whitespace.
|
220
|
+
StyleGuide: "#no-trailing-whitespace"
|
221
|
+
Enabled: true
|
222
|
+
Style/AccessorMethodName:
|
223
|
+
Description: Check the naming of accessor methods for get_/set_.
|
224
|
+
StyleGuide: "#accessor_mutator_method_names"
|
225
|
+
Enabled: true
|
226
|
+
Style/Alias:
|
227
|
+
Description: Use alias instead of alias_method.
|
228
|
+
StyleGuide: "#alias-method"
|
229
|
+
Enabled: true
|
230
|
+
EnforcedStyle: prefer_alias
|
231
|
+
SupportedStyles:
|
232
|
+
- prefer_alias
|
233
|
+
- prefer_alias_method
|
234
|
+
Style/AndOr:
|
235
|
+
Description: Use &&/|| instead of and/or.
|
236
|
+
StyleGuide: "#no-and-or-or"
|
237
|
+
Enabled: true
|
238
|
+
EnforcedStyle: always
|
239
|
+
SupportedStyles:
|
240
|
+
- always
|
241
|
+
- conditionals
|
242
|
+
Style/ArrayJoin:
|
243
|
+
Description: Use Array#join instead of Array#*.
|
244
|
+
StyleGuide: "#array-join"
|
245
|
+
Enabled: true
|
246
|
+
Style/AsciiComments:
|
247
|
+
Description: Use only ascii symbols in comments.
|
248
|
+
StyleGuide: "#english-comments"
|
249
|
+
Enabled: true
|
250
|
+
Style/AsciiIdentifiers:
|
251
|
+
Description: Use only ascii symbols in identifiers.
|
252
|
+
StyleGuide: "#english-identifiers"
|
253
|
+
Enabled: true
|
254
|
+
Style/Attr:
|
255
|
+
Description: Checks for uses of Module#attr.
|
256
|
+
StyleGuide: "#attr"
|
257
|
+
Enabled: true
|
258
|
+
Style/BeginBlock:
|
259
|
+
Description: Avoid the use of BEGIN blocks.
|
260
|
+
StyleGuide: "#no-BEGIN-blocks"
|
261
|
+
Enabled: true
|
262
|
+
Style/BarePercentLiterals:
|
263
|
+
Description: Checks if usage of %() or %Q() matches configuration.
|
264
|
+
StyleGuide: "#percent-q-shorthand"
|
265
|
+
Enabled: true
|
266
|
+
EnforcedStyle: bare_percent
|
267
|
+
SupportedStyles:
|
268
|
+
- percent_q
|
269
|
+
- bare_percent
|
270
|
+
Style/BlockComments:
|
271
|
+
Description: Do not use block comments.
|
272
|
+
StyleGuide: "#no-block-comments"
|
273
|
+
Enabled: true
|
274
|
+
Style/BlockDelimiters:
|
275
|
+
Description: Avoid using {...} for multi-line blocks (multiline chaining is always
|
276
|
+
ugly). Prefer {...} over do...end for single-line blocks.
|
277
|
+
StyleGuide: "#single-line-blocks"
|
278
|
+
Enabled: true
|
279
|
+
EnforcedStyle: line_count_based
|
280
|
+
SupportedStyles:
|
281
|
+
- line_count_based
|
282
|
+
- semantic
|
283
|
+
- braces_for_chaining
|
284
|
+
ProceduralMethods:
|
285
|
+
- benchmark
|
286
|
+
- bm
|
287
|
+
- bmbm
|
288
|
+
- create
|
289
|
+
- each_with_object
|
290
|
+
- measure
|
291
|
+
- new
|
292
|
+
- realtime
|
293
|
+
- tap
|
294
|
+
- with_object
|
295
|
+
FunctionalMethods:
|
296
|
+
- let
|
297
|
+
- let!
|
298
|
+
- subject
|
299
|
+
- watch
|
300
|
+
IgnoredMethods:
|
301
|
+
- lambda
|
302
|
+
- proc
|
303
|
+
- it
|
304
|
+
Style/CaseEquality:
|
305
|
+
Description: Avoid explicit use of the case equality operator(===).
|
306
|
+
StyleGuide: "#no-case-equality"
|
307
|
+
Enabled: true
|
308
|
+
Style/CharacterLiteral:
|
309
|
+
Description: Checks for uses of character literals.
|
310
|
+
StyleGuide: "#no-character-literals"
|
311
|
+
Enabled: true
|
312
|
+
Style/ClassAndModuleCamelCase:
|
313
|
+
Description: Use CamelCase for classes and modules.
|
314
|
+
StyleGuide: "#camelcase-classes"
|
315
|
+
Enabled: true
|
316
|
+
Style/ClassMethods:
|
317
|
+
Description: Use self when defining module/class methods.
|
318
|
+
StyleGuide: "#def-self-class-methods"
|
319
|
+
Enabled: true
|
320
|
+
Style/ClassVars:
|
321
|
+
Description: Avoid the use of class variables.
|
322
|
+
StyleGuide: "#no-class-vars"
|
323
|
+
Enabled: true
|
324
|
+
Style/ColonMethodCall:
|
325
|
+
Description: 'Do not use :: for method call.'
|
326
|
+
StyleGuide: "#double-colons"
|
327
|
+
Enabled: true
|
328
|
+
Style/CommandLiteral:
|
329
|
+
Description: Use `` or %x around command literals.
|
330
|
+
StyleGuide: "#percent-x"
|
331
|
+
Enabled: true
|
332
|
+
EnforcedStyle: backticks
|
333
|
+
SupportedStyles:
|
334
|
+
- backticks
|
335
|
+
- percent_x
|
336
|
+
- mixed
|
337
|
+
AllowInnerBackticks: false
|
338
|
+
Style/CommentAnnotation:
|
339
|
+
Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
|
340
|
+
REVIEW).
|
341
|
+
StyleGuide: "#annotate-keywords"
|
342
|
+
Enabled: true
|
343
|
+
Keywords:
|
344
|
+
- TODO
|
345
|
+
- FIXME
|
346
|
+
- OPTIMIZE
|
347
|
+
- HACK
|
348
|
+
- REVIEW
|
349
|
+
Style/ConstantName:
|
350
|
+
Description: Constants should use SCREAMING_SNAKE_CASE.
|
351
|
+
StyleGuide: "#screaming-snake-case"
|
352
|
+
Enabled: true
|
353
|
+
Style/DefWithParentheses:
|
354
|
+
Description: Use def with parentheses when there are arguments.
|
355
|
+
StyleGuide: "#method-parens"
|
356
|
+
Enabled: true
|
357
|
+
Style/DoubleNegation:
|
358
|
+
Description: Checks for uses of double negation (!!).
|
359
|
+
StyleGuide: "#no-bang-bang"
|
360
|
+
Enabled: true
|
361
|
+
Style/EmptyLiteral:
|
362
|
+
Description: Prefer literals to Array.new/Hash.new/String.new.
|
363
|
+
StyleGuide: "#literal-array-hash"
|
364
|
+
Enabled: true
|
365
|
+
Style/EmptyMethod:
|
366
|
+
Description: Checks the formatting of empty method definitions.
|
367
|
+
StyleGuide: "#no-single-line-methods"
|
368
|
+
Enabled: true
|
369
|
+
EnforcedStyle: compact
|
370
|
+
SupportedStyles:
|
371
|
+
- compact
|
372
|
+
- expanded
|
373
|
+
Style/EndBlock:
|
374
|
+
Description: Avoid the use of END blocks.
|
375
|
+
StyleGuide: "#no-END-blocks"
|
376
|
+
Enabled: true
|
377
|
+
Style/EvenOdd:
|
378
|
+
Description: Favor the use of Integer#even? && Integer#odd?
|
379
|
+
StyleGuide: "#predicate-methods"
|
380
|
+
Enabled: true
|
381
|
+
Style/FileName:
|
382
|
+
Description: Use snake_case for source file names.
|
383
|
+
StyleGuide: "#snake-case-files"
|
384
|
+
Enabled: true
|
385
|
+
Exclude: []
|
386
|
+
ExpectMatchingDefinition: false
|
387
|
+
Regex:
|
388
|
+
IgnoreExecutableScripts: true
|
389
|
+
AllowedAcronyms:
|
390
|
+
- CLI
|
391
|
+
- DSL
|
392
|
+
- ACL
|
393
|
+
- API
|
394
|
+
- ASCII
|
395
|
+
- CPU
|
396
|
+
- CSS
|
397
|
+
- DNS
|
398
|
+
- EOF
|
399
|
+
- GUID
|
400
|
+
- HTML
|
401
|
+
- HTTP
|
402
|
+
- HTTPS
|
403
|
+
- ID
|
404
|
+
- IP
|
405
|
+
- JSON
|
406
|
+
- LHS
|
407
|
+
- QPS
|
408
|
+
- RAM
|
409
|
+
- RHS
|
410
|
+
- RPC
|
411
|
+
- SLA
|
412
|
+
- SMTP
|
413
|
+
- SQL
|
414
|
+
- SSH
|
415
|
+
- TCP
|
416
|
+
- TLS
|
417
|
+
- TTL
|
418
|
+
- UDP
|
419
|
+
- UI
|
420
|
+
- UID
|
421
|
+
- UUID
|
422
|
+
- URI
|
423
|
+
- URL
|
424
|
+
- UTF8
|
425
|
+
- VM
|
426
|
+
- XML
|
427
|
+
- XMPP
|
428
|
+
- XSRF
|
429
|
+
- XSS
|
430
|
+
Style/FlipFlop:
|
431
|
+
Description: Checks for flip flops
|
432
|
+
StyleGuide: "#no-flip-flops"
|
433
|
+
Enabled: true
|
434
|
+
Style/For:
|
435
|
+
Description: Checks use of for or each in multiline loops.
|
436
|
+
StyleGuide: "#no-for-loops"
|
437
|
+
Enabled: true
|
438
|
+
EnforcedStyle: each
|
439
|
+
SupportedStyles:
|
440
|
+
- for
|
441
|
+
- each
|
442
|
+
Style/FormatString:
|
443
|
+
Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%.
|
444
|
+
StyleGuide: "#sprintf"
|
445
|
+
Enabled: true
|
446
|
+
EnforcedStyle: format
|
447
|
+
SupportedStyles:
|
448
|
+
- format
|
449
|
+
- sprintf
|
450
|
+
- percent
|
451
|
+
Style/GlobalVars:
|
452
|
+
Description: Do not introduce global variables.
|
453
|
+
StyleGuide: "#instance-vars"
|
454
|
+
Reference: http://www.zenspider.com/Languages/Ruby/QuickRef.html
|
455
|
+
Enabled: true
|
456
|
+
AllowedVariables: []
|
457
|
+
Style/GuardClause:
|
458
|
+
Description: Check for conditionals that can be replaced with guard clauses
|
459
|
+
StyleGuide: "#no-nested-conditionals"
|
460
|
+
Enabled: true
|
461
|
+
MinBodyLength: 1
|
462
|
+
Style/HashSyntax:
|
463
|
+
Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a =>
|
464
|
+
1, :b => 2 }.'
|
465
|
+
StyleGuide: "#hash-literals"
|
466
|
+
Enabled: true
|
467
|
+
EnforcedStyle: ruby19
|
468
|
+
SupportedStyles:
|
469
|
+
- ruby19
|
470
|
+
- hash_rockets
|
471
|
+
- no_mixed_keys
|
472
|
+
- ruby19_no_mixed_keys
|
473
|
+
UseHashRocketsWithSymbolValues: false
|
474
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
475
|
+
Style/IfUnlessModifier:
|
476
|
+
Description: Favor modifier if/unless usage when you have a single-line body.
|
477
|
+
StyleGuide: "#if-as-a-modifier"
|
478
|
+
Enabled: true
|
479
|
+
MaxLineLength: 80
|
480
|
+
Style/IfWithSemicolon:
|
481
|
+
Description: Do not use if x; .... Use the ternary operator instead.
|
482
|
+
StyleGuide: "#no-semicolon-ifs"
|
483
|
+
Enabled: true
|
484
|
+
Style/InfiniteLoop:
|
485
|
+
Description: Use Kernel#loop for infinite loops.
|
486
|
+
StyleGuide: "#infinite-loop"
|
487
|
+
Enabled: true
|
488
|
+
Style/Lambda:
|
489
|
+
Description: Use the new lambda literal syntax for single-line blocks.
|
490
|
+
StyleGuide: "#lambda-multi-line"
|
491
|
+
Enabled: true
|
492
|
+
EnforcedStyle: line_count_dependent
|
493
|
+
SupportedStyles:
|
494
|
+
- line_count_dependent
|
495
|
+
- lambda
|
496
|
+
- literal
|
497
|
+
Style/LambdaCall:
|
498
|
+
Description: Use lambda.call(...) instead of lambda.(...).
|
499
|
+
StyleGuide: "#proc-call"
|
500
|
+
Enabled: true
|
501
|
+
EnforcedStyle: call
|
502
|
+
SupportedStyles:
|
503
|
+
- call
|
504
|
+
- braces
|
505
|
+
Style/MethodCallWithoutArgsParentheses:
|
506
|
+
Description: Do not use parentheses for method calls with no arguments.
|
507
|
+
StyleGuide: "#method-invocation-parens"
|
508
|
+
Enabled: true
|
509
|
+
Style/MethodDefParentheses:
|
510
|
+
Description: Checks if the method definitions have or don't have parentheses.
|
511
|
+
StyleGuide: "#method-parens"
|
512
|
+
Enabled: true
|
513
|
+
EnforcedStyle: require_parentheses
|
514
|
+
SupportedStyles:
|
515
|
+
- require_parentheses
|
516
|
+
- require_no_parentheses
|
517
|
+
- require_no_parentheses_except_multiline
|
518
|
+
Style/MethodName:
|
519
|
+
Description: Use the configured style when naming methods.
|
520
|
+
StyleGuide: "#snake-case-symbols-methods-vars"
|
521
|
+
Enabled: true
|
522
|
+
EnforcedStyle: snake_case
|
523
|
+
SupportedStyles:
|
524
|
+
- snake_case
|
525
|
+
- camelCase
|
526
|
+
Style/MethodMissing:
|
527
|
+
Description: Avoid using `method_missing`.
|
528
|
+
StyleGuide: "#no-method-missing"
|
529
|
+
Enabled: true
|
530
|
+
Style/MixinGrouping:
|
531
|
+
Description: Checks for grouping of mixins in `class` and `module` bodies.
|
532
|
+
StyleGuide: "#mixin-grouping"
|
533
|
+
Enabled: true
|
534
|
+
EnforcedStyle: separated
|
535
|
+
SupportedStyles:
|
536
|
+
- separated
|
537
|
+
- grouped
|
538
|
+
Style/ModuleFunction:
|
539
|
+
Description: Checks for usage of `extend self` in modules.
|
540
|
+
StyleGuide: "#module-function"
|
541
|
+
Enabled: true
|
542
|
+
EnforcedStyle: module_function
|
543
|
+
SupportedStyles:
|
544
|
+
- module_function
|
545
|
+
- extend_self
|
546
|
+
Style/MultilineBlockChain:
|
547
|
+
Description: Avoid multi-line chains of blocks.
|
548
|
+
StyleGuide: "#single-line-blocks"
|
549
|
+
Enabled: true
|
550
|
+
Style/MultilineIfThen:
|
551
|
+
Description: Do not use then for multi-line if/unless.
|
552
|
+
StyleGuide: "#no-then"
|
553
|
+
Enabled: true
|
554
|
+
Style/MultilineIfModifier:
|
555
|
+
Description: Only use if/unless modifiers on single line statements.
|
556
|
+
StyleGuide: "#no-multiline-if-modifiers"
|
557
|
+
Enabled: true
|
558
|
+
Style/MultilineTernaryOperator:
|
559
|
+
Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
|
560
|
+
StyleGuide: "#no-multiline-ternary"
|
561
|
+
Enabled: true
|
562
|
+
Style/NegatedIf:
|
563
|
+
Description: Favor unless over if for negative conditions (or control flow or).
|
564
|
+
StyleGuide: "#unless-for-negatives"
|
565
|
+
Enabled: true
|
566
|
+
EnforcedStyle: both
|
567
|
+
SupportedStyles:
|
568
|
+
- both
|
569
|
+
- prefix
|
570
|
+
- postfix
|
571
|
+
Style/NegatedWhile:
|
572
|
+
Description: Favor until over while for negative conditions.
|
573
|
+
StyleGuide: "#until-for-negatives"
|
574
|
+
Enabled: true
|
575
|
+
Style/NestedModifier:
|
576
|
+
Description: Avoid using nested modifiers.
|
577
|
+
StyleGuide: "#no-nested-modifiers"
|
578
|
+
Enabled: true
|
579
|
+
Style/NestedTernaryOperator:
|
580
|
+
Description: Use one expression per branch in a ternary operator.
|
581
|
+
StyleGuide: "#no-nested-ternary"
|
582
|
+
Enabled: true
|
583
|
+
Style/Next:
|
584
|
+
Description: Use `next` to skip iteration instead of a condition at the end.
|
585
|
+
StyleGuide: "#no-nested-conditionals"
|
586
|
+
Enabled: true
|
587
|
+
EnforcedStyle: skip_modifier_ifs
|
588
|
+
MinBodyLength: 3
|
589
|
+
SupportedStyles:
|
590
|
+
- skip_modifier_ifs
|
591
|
+
- always
|
592
|
+
Style/NilComparison:
|
593
|
+
Description: Prefer x.nil? to x == nil.
|
594
|
+
StyleGuide: "#predicate-methods"
|
595
|
+
Enabled: true
|
596
|
+
Style/NonNilCheck:
|
597
|
+
Description: Checks for redundant nil checks.
|
598
|
+
StyleGuide: "#no-non-nil-checks"
|
599
|
+
Enabled: true
|
600
|
+
IncludeSemanticChanges: false
|
601
|
+
Style/Not:
|
602
|
+
Description: Use ! instead of not.
|
603
|
+
StyleGuide: "#bang-not-not"
|
604
|
+
Enabled: true
|
605
|
+
Style/NumericLiterals:
|
606
|
+
Description: Add underscores to large numeric literals to improve their readability.
|
607
|
+
StyleGuide: "#underscores-in-numerics"
|
608
|
+
Enabled: true
|
609
|
+
MinDigits: 5
|
610
|
+
Strict: false
|
611
|
+
Style/NumericLiteralPrefix:
|
612
|
+
Description: Use smallcase prefixes for numeric literals.
|
613
|
+
StyleGuide: "#numeric-literal-prefixes"
|
614
|
+
Enabled: true
|
615
|
+
EnforcedOctalStyle: zero_with_o
|
616
|
+
SupportedOctalStyles:
|
617
|
+
- zero_with_o
|
618
|
+
- zero_only
|
619
|
+
Style/NumericPredicate:
|
620
|
+
Description: Checks for the use of predicate- or comparison methods for numeric
|
621
|
+
comparisons.
|
622
|
+
StyleGuide: "#predicate-methods"
|
623
|
+
AutoCorrect: false
|
624
|
+
Enabled: true
|
625
|
+
EnforcedStyle: predicate
|
626
|
+
SupportedStyles:
|
627
|
+
- predicate
|
628
|
+
- comparison
|
629
|
+
Exclude:
|
630
|
+
- spec/**/*
|
631
|
+
Style/OneLineConditional:
|
632
|
+
Description: Favor the ternary operator(?:) over if/then/else/end constructs.
|
633
|
+
StyleGuide: "#ternary-operator"
|
634
|
+
Enabled: true
|
635
|
+
Style/OpMethod:
|
636
|
+
Description: When defining binary operators, name the argument other.
|
637
|
+
StyleGuide: "#other-arg"
|
638
|
+
Enabled: true
|
639
|
+
Style/OptionalArguments:
|
640
|
+
Description: Checks for optional arguments that do not appear at the end of the
|
641
|
+
argument list
|
642
|
+
StyleGuide: "#optional-arguments"
|
643
|
+
Enabled: true
|
644
|
+
Style/ParallelAssignment:
|
645
|
+
Description: Check for simple usages of parallel assignment. It will only warn when
|
646
|
+
the number of variables matches on both sides of the assignment.
|
647
|
+
StyleGuide: "#parallel-assignment"
|
648
|
+
Enabled: true
|
649
|
+
Style/ParenthesesAroundCondition:
|
650
|
+
Description: Don't use parentheses around the condition of an if/unless/while.
|
651
|
+
StyleGuide: "#no-parens-around-condition"
|
652
|
+
Enabled: true
|
653
|
+
AllowSafeAssignment: true
|
654
|
+
Style/PercentLiteralDelimiters:
|
655
|
+
Description: Use `%`-literal delimiters consistently
|
656
|
+
StyleGuide: "#percent-literal-braces"
|
657
|
+
Enabled: true
|
658
|
+
PreferredDelimiters:
|
659
|
+
default: "()"
|
660
|
+
"%i": "[]"
|
661
|
+
"%I": "[]"
|
662
|
+
"%r": "{}"
|
663
|
+
"%w": "[]"
|
664
|
+
"%W": "[]"
|
665
|
+
Style/PerlBackrefs:
|
666
|
+
Description: Avoid Perl-style regex back references.
|
667
|
+
StyleGuide: "#no-perl-regexp-last-matchers"
|
668
|
+
Enabled: true
|
669
|
+
Style/PredicateName:
|
670
|
+
Description: Check the names of predicate methods.
|
671
|
+
StyleGuide: "#bool-methods-qmark"
|
672
|
+
Enabled: true
|
673
|
+
NamePrefix:
|
674
|
+
- is_
|
675
|
+
- has_
|
676
|
+
- have_
|
677
|
+
NamePrefixBlacklist:
|
678
|
+
- is_
|
679
|
+
- has_
|
680
|
+
- have_
|
681
|
+
NameWhitelist:
|
682
|
+
- is_a?
|
683
|
+
Exclude:
|
684
|
+
- spec/**/*
|
685
|
+
Style/PreferredHashMethods:
|
686
|
+
Description: Checks use of `has_key?` and `has_value?` Hash methods.
|
687
|
+
StyleGuide: "#hash-key"
|
688
|
+
Enabled: true
|
689
|
+
EnforcedStyle: short
|
690
|
+
SupportedStyles:
|
691
|
+
- short
|
692
|
+
- verbose
|
693
|
+
Style/Proc:
|
694
|
+
Description: Use proc instead of Proc.new.
|
695
|
+
StyleGuide: "#proc"
|
696
|
+
Enabled: true
|
697
|
+
Style/RaiseArgs:
|
698
|
+
Description: Checks the arguments passed to raise/fail.
|
699
|
+
StyleGuide: "#exception-class-messages"
|
700
|
+
Enabled: true
|
701
|
+
EnforcedStyle: exploded
|
702
|
+
SupportedStyles:
|
703
|
+
- compact
|
704
|
+
- exploded
|
705
|
+
Style/RedundantBegin:
|
706
|
+
Description: Don't use begin blocks when they are not needed.
|
707
|
+
StyleGuide: "#begin-implicit"
|
708
|
+
Enabled: true
|
709
|
+
Style/RedundantException:
|
710
|
+
Description: Checks for an obsolete RuntimeException argument in raise/fail.
|
711
|
+
StyleGuide: "#no-explicit-runtimeerror"
|
712
|
+
Enabled: true
|
713
|
+
Style/RedundantReturn:
|
714
|
+
Description: Don't use return where it's not required.
|
715
|
+
StyleGuide: "#no-explicit-return"
|
716
|
+
Enabled: true
|
717
|
+
AllowMultipleReturnValues: false
|
718
|
+
Style/RedundantSelf:
|
719
|
+
Description: Don't use self where it's not needed.
|
720
|
+
StyleGuide: "#no-self-unless-required"
|
721
|
+
Enabled: true
|
722
|
+
Style/RegexpLiteral:
|
723
|
+
Description: Use / or %r around regular expressions.
|
724
|
+
StyleGuide: "#percent-r"
|
725
|
+
Enabled: true
|
726
|
+
EnforcedStyle: slashes
|
727
|
+
SupportedStyles:
|
728
|
+
- slashes
|
729
|
+
- percent_r
|
730
|
+
- mixed
|
731
|
+
AllowInnerSlashes: false
|
732
|
+
Style/RescueModifier:
|
733
|
+
Description: Avoid using rescue in its modifier form.
|
734
|
+
StyleGuide: "#no-rescue-modifiers"
|
735
|
+
Enabled: true
|
736
|
+
Style/SelfAssignment:
|
737
|
+
Description: Checks for places where self-assignment shorthand should have been
|
738
|
+
used.
|
739
|
+
StyleGuide: "#self-assignment"
|
740
|
+
Enabled: true
|
741
|
+
Style/Semicolon:
|
742
|
+
Description: Don't use semicolons to terminate expressions.
|
743
|
+
StyleGuide: "#no-semicolon"
|
744
|
+
Enabled: true
|
745
|
+
AllowAsExpressionSeparator: false
|
746
|
+
Style/SignalException:
|
747
|
+
Description: Checks for proper usage of fail and raise.
|
748
|
+
StyleGuide: "#prefer-raise-over-fail"
|
749
|
+
Enabled: true
|
750
|
+
EnforcedStyle: only_raise
|
751
|
+
SupportedStyles:
|
752
|
+
- only_raise
|
753
|
+
- only_fail
|
754
|
+
- semantic
|
755
|
+
Style/SingleLineMethods:
|
756
|
+
Description: Avoid single-line methods.
|
757
|
+
StyleGuide: "#no-single-line-methods"
|
758
|
+
Enabled: true
|
759
|
+
AllowIfMethodIsEmpty: true
|
760
|
+
Style/SpecialGlobalVars:
|
761
|
+
Description: Avoid Perl-style global variables.
|
762
|
+
StyleGuide: "#no-cryptic-perlisms"
|
763
|
+
Enabled: true
|
764
|
+
EnforcedStyle: use_english_names
|
765
|
+
SupportedStyles:
|
766
|
+
- use_perl_names
|
767
|
+
- use_english_names
|
768
|
+
Style/StabbyLambdaParentheses:
|
769
|
+
Description: Check for the usage of parentheses around stabby lambda arguments.
|
770
|
+
StyleGuide: "#stabby-lambda-with-args"
|
771
|
+
Enabled: true
|
772
|
+
EnforcedStyle: require_parentheses
|
773
|
+
SupportedStyles:
|
774
|
+
- require_parentheses
|
775
|
+
- require_no_parentheses
|
776
|
+
Style/StringLiterals:
|
777
|
+
Description: Checks if uses of quotes match the configured preference.
|
778
|
+
StyleGuide: "#consistent-string-literals"
|
779
|
+
Enabled: true
|
780
|
+
EnforcedStyle: single_quotes
|
781
|
+
SupportedStyles:
|
782
|
+
- single_quotes
|
783
|
+
- double_quotes
|
784
|
+
ConsistentQuotesInMultiline: false
|
785
|
+
Style/StructInheritance:
|
786
|
+
Description: Checks for inheritance from Struct.new.
|
787
|
+
StyleGuide: "#no-extend-struct-new"
|
788
|
+
Enabled: true
|
789
|
+
Style/SymbolArray:
|
790
|
+
Description: Use %i or %I for arrays of symbols.
|
791
|
+
StyleGuide: "#percent-i"
|
792
|
+
Enabled: true
|
793
|
+
EnforcedStyle: percent
|
794
|
+
MinSize: 0
|
795
|
+
SupportedStyles:
|
796
|
+
- percent
|
797
|
+
- brackets
|
798
|
+
Style/TrailingCommaInArguments:
|
799
|
+
Description: Checks for trailing comma in argument lists.
|
800
|
+
StyleGuide: "#no-trailing-params-comma"
|
801
|
+
Enabled: true
|
802
|
+
EnforcedStyleForMultiline: no_comma
|
803
|
+
SupportedStylesForMultiline:
|
804
|
+
- comma
|
805
|
+
- consistent_comma
|
806
|
+
- no_comma
|
807
|
+
Style/TrailingCommaInLiteral:
|
808
|
+
Description: Checks for trailing comma in array and hash literals.
|
809
|
+
StyleGuide: "#no-trailing-array-commas"
|
810
|
+
Enabled: true
|
811
|
+
EnforcedStyleForMultiline: no_comma
|
812
|
+
SupportedStylesForMultiline:
|
813
|
+
- comma
|
814
|
+
- consistent_comma
|
815
|
+
- no_comma
|
816
|
+
Style/TrivialAccessors:
|
817
|
+
Description: Prefer attr_* methods to trivial readers/writers.
|
818
|
+
StyleGuide: "#attr_family"
|
819
|
+
Enabled: true
|
820
|
+
ExactNameMatch: true
|
821
|
+
AllowPredicates: true
|
822
|
+
AllowDSLWriters: false
|
823
|
+
IgnoreClassMethods: false
|
824
|
+
Whitelist:
|
825
|
+
- to_ary
|
826
|
+
- to_a
|
827
|
+
- to_c
|
828
|
+
- to_enum
|
829
|
+
- to_h
|
830
|
+
- to_hash
|
831
|
+
- to_i
|
832
|
+
- to_int
|
833
|
+
- to_io
|
834
|
+
- to_open
|
835
|
+
- to_path
|
836
|
+
- to_proc
|
837
|
+
- to_r
|
838
|
+
- to_regexp
|
839
|
+
- to_str
|
840
|
+
- to_s
|
841
|
+
- to_sym
|
842
|
+
Style/UnlessElse:
|
843
|
+
Description: Do not use unless with else. Rewrite these with the positive case first.
|
844
|
+
StyleGuide: "#no-else-with-unless"
|
845
|
+
Enabled: true
|
846
|
+
Style/UnneededPercentQ:
|
847
|
+
Description: Checks for %q/%Q when single quotes or double quotes would do.
|
848
|
+
StyleGuide: "#percent-q"
|
849
|
+
Enabled: true
|
850
|
+
Style/VariableInterpolation:
|
851
|
+
Description: Don't interpolate global, instance and class variables directly in
|
852
|
+
strings.
|
853
|
+
StyleGuide: "#curlies-interpolate"
|
854
|
+
Enabled: true
|
855
|
+
Style/VariableName:
|
856
|
+
Description: Use the configured style when naming variables.
|
857
|
+
StyleGuide: "#snake-case-symbols-methods-vars"
|
858
|
+
Enabled: true
|
859
|
+
EnforcedStyle: snake_case
|
860
|
+
SupportedStyles:
|
861
|
+
- snake_case
|
862
|
+
- camelCase
|
863
|
+
Style/WhenThen:
|
864
|
+
Description: Use when x then ... for one-line cases.
|
865
|
+
StyleGuide: "#one-line-cases"
|
866
|
+
Enabled: true
|
867
|
+
Style/WhileUntilDo:
|
868
|
+
Description: Checks for redundant do after while or until.
|
869
|
+
StyleGuide: "#no-multiline-while-do"
|
870
|
+
Enabled: true
|
871
|
+
Style/WhileUntilModifier:
|
872
|
+
Description: Favor modifier while/until usage when you have a single-line body.
|
873
|
+
StyleGuide: "#while-as-a-modifier"
|
874
|
+
Enabled: true
|
875
|
+
MaxLineLength: 80
|
876
|
+
Style/WordArray:
|
877
|
+
Description: Use %w or %W for arrays of words.
|
878
|
+
StyleGuide: "#percent-w"
|
879
|
+
Enabled: true
|
880
|
+
EnforcedStyle: percent
|
881
|
+
SupportedStyles:
|
882
|
+
- percent
|
883
|
+
- brackets
|
884
|
+
MinSize: 0
|
885
|
+
WordRegex: !ruby/regexp /\A[\p{Word}\n\t]+\z/
|
886
|
+
Metrics/BlockNesting:
|
887
|
+
Description: Avoid excessive block nesting
|
888
|
+
StyleGuide: "#three-is-the-number-thou-shalt-count"
|
889
|
+
Enabled: true
|
890
|
+
CountBlocks: false
|
891
|
+
Max: 3
|
892
|
+
Metrics/LineLength:
|
893
|
+
Description: Limit lines to 80 characters.
|
894
|
+
StyleGuide: "#80-character-limits"
|
895
|
+
Enabled: true
|
896
|
+
Max: 80
|
897
|
+
AllowHeredoc: true
|
898
|
+
AllowURI: true
|
899
|
+
URISchemes:
|
900
|
+
- http
|
901
|
+
- https
|
902
|
+
IgnoreCopDirectives: false
|
903
|
+
IgnoredPatterns: []
|
904
|
+
Metrics/MethodLength:
|
905
|
+
Description: Avoid methods longer than 10 lines of code.
|
906
|
+
StyleGuide: "#short-methods"
|
907
|
+
Enabled: true
|
908
|
+
CountComments: false
|
909
|
+
Max: 10
|
910
|
+
Metrics/ParameterLists:
|
911
|
+
Description: Avoid parameter lists longer than three or four parameters.
|
912
|
+
StyleGuide: "#too-many-params"
|
913
|
+
Enabled: true
|
914
|
+
Max: 5
|
915
|
+
CountKeywordArgs: true
|
916
|
+
Lint/AmbiguousBlockAssociation:
|
917
|
+
Description: Checks for ambiguous block association with method when param passed
|
918
|
+
without parentheses.
|
919
|
+
StyleGuide: "#syntax"
|
920
|
+
Enabled: true
|
921
|
+
Lint/AmbiguousOperator:
|
922
|
+
Description: Checks for ambiguous operators in the first argument of a method invocation
|
923
|
+
without parentheses.
|
924
|
+
StyleGuide: "#method-invocation-parens"
|
925
|
+
Enabled: true
|
926
|
+
Lint/AssignmentInCondition:
|
927
|
+
Description: Don't use assignment in conditions.
|
928
|
+
StyleGuide: "#safe-assignment-in-condition"
|
929
|
+
Enabled: true
|
930
|
+
AllowSafeAssignment: true
|
931
|
+
Lint/ConditionPosition:
|
932
|
+
Description: Checks for condition placed in a confusing position relative to the
|
933
|
+
keyword.
|
934
|
+
StyleGuide: "#same-line-condition"
|
935
|
+
Enabled: true
|
936
|
+
Lint/EnsureReturn:
|
937
|
+
Description: Do not use return in an ensure block.
|
938
|
+
StyleGuide: "#no-return-ensure"
|
939
|
+
Enabled: true
|
940
|
+
Lint/HandleExceptions:
|
941
|
+
Description: Don't suppress exception.
|
942
|
+
StyleGuide: "#dont-hide-exceptions"
|
943
|
+
Enabled: true
|
944
|
+
Lint/Loop:
|
945
|
+
Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
|
946
|
+
for post-loop tests.
|
947
|
+
StyleGuide: "#loop-with-break"
|
948
|
+
Enabled: true
|
949
|
+
Lint/NestedMethodDefinition:
|
950
|
+
Description: Do not use nested method definitions.
|
951
|
+
StyleGuide: "#no-nested-methods"
|
952
|
+
Enabled: true
|
953
|
+
Lint/ParenthesesAsGroupedExpression:
|
954
|
+
Description: Checks for method calls with a space before the opening parenthesis.
|
955
|
+
StyleGuide: "#parens-no-spaces"
|
956
|
+
Enabled: true
|
957
|
+
Lint/RescueException:
|
958
|
+
Description: Avoid rescuing the Exception class.
|
959
|
+
StyleGuide: "#no-blind-rescues"
|
960
|
+
Enabled: true
|
961
|
+
Lint/StringConversionInInterpolation:
|
962
|
+
Description: Checks for Object#to_s usage in string interpolation.
|
963
|
+
StyleGuide: "#no-to-s"
|
964
|
+
Enabled: true
|
965
|
+
Lint/UnusedBlockArgument:
|
966
|
+
Description: Checks for unused block arguments.
|
967
|
+
StyleGuide: "#underscore-unused-vars"
|
968
|
+
Enabled: true
|
969
|
+
IgnoreEmptyBlocks: true
|
970
|
+
AllowUnusedKeywordArguments: false
|
971
|
+
Lint/UnusedMethodArgument:
|
972
|
+
Description: Checks for unused method arguments.
|
973
|
+
StyleGuide: "#underscore-unused-vars"
|
974
|
+
Enabled: true
|
975
|
+
AllowUnusedKeywordArguments: false
|
976
|
+
IgnoreEmptyMethods: true
|
977
|
+
Lint/UselessAssignment:
|
978
|
+
Description: Checks for useless assignment to a local variable.
|
979
|
+
StyleGuide: "#underscore-unused-vars"
|
980
|
+
Enabled: true
|
981
|
+
Performance/HashEachMethods:
|
982
|
+
Description: Use `Hash#each_key` and `Hash#each_value` instead of `Hash#keys.each`
|
983
|
+
and `Hash#values.each`.
|
984
|
+
StyleGuide: "#hash-each"
|
985
|
+
Enabled: true
|
986
|
+
AutoCorrect: false
|
data/config/rubocop.yml
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
module TheBathOfZahn
|
2
|
+
module Utility
|
3
|
+
class Extractor
|
4
|
+
def rules_rails
|
5
|
+
@rules_rails ||=
|
6
|
+
rules_styleguide.select { |key, _value| key =~ %r{^Rails/} }
|
7
|
+
end
|
8
|
+
|
9
|
+
def rules_plain
|
10
|
+
@rules_plain ||=
|
11
|
+
rules_styleguide.reject { |key, _value| key =~ %r{^Rails/} }
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def rules_settings
|
17
|
+
@rules_settings ||=
|
18
|
+
begin
|
19
|
+
path = File.join(path_to_rubocop, "config", "default.yml")
|
20
|
+
YAML.load_file(path)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def rules_enabled
|
25
|
+
@rules_enabled ||=
|
26
|
+
begin
|
27
|
+
path = File.join(path_to_rubocop, "config", "enabled.yml")
|
28
|
+
YAML.load_file(path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def rules_styleguide
|
33
|
+
@rules_styleguide ||=
|
34
|
+
rules_enabled.select { |_, v| v["StyleGuide"] }
|
35
|
+
.map { |name, config| [name, config.merge(settings_for(name))] }
|
36
|
+
.to_h
|
37
|
+
end
|
38
|
+
|
39
|
+
def settings_for(name)
|
40
|
+
rules_settings[name] || {}
|
41
|
+
end
|
42
|
+
|
43
|
+
def path_to_rubocop
|
44
|
+
`bundle show rubocop`.chomp
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/the_bath_of_zahn.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "the_bath_of_zahn"
|
5
|
-
spec.version = "0.0.
|
5
|
+
spec.version = "0.0.3"
|
6
6
|
spec.authors = ["Zach Ahn"]
|
7
7
|
spec.email = ["engineering@zachahn.com"]
|
8
8
|
|
@@ -21,5 +21,5 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.15"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency "minitest", "~> 5.0"
|
24
|
-
spec.add_development_dependency "rubocop"
|
24
|
+
spec.add_development_dependency "rubocop", "~> 0.49"
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_bath_of_zahn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zach Ahn
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,16 +56,16 @@ dependencies:
|
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '0.49'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '0.49'
|
69
69
|
description: These are some Rubocop configs that I use in my new personal projects
|
70
70
|
email:
|
71
71
|
- engineering@zachahn.com
|
@@ -83,8 +83,12 @@ files:
|
|
83
83
|
- bin/rake
|
84
84
|
- bin/rubocop
|
85
85
|
- bin/setup
|
86
|
-
-
|
87
|
-
-
|
86
|
+
- config/internal/overrides.yml
|
87
|
+
- config/internal/rails_style_guide.yml
|
88
|
+
- config/internal/style_guide.yml
|
89
|
+
- config/rubocop-rails.yml
|
90
|
+
- config/rubocop.yml
|
91
|
+
- lib/the_bath_of_zahn/utility/extractor.rb
|
88
92
|
- the_bath_of_zahn.gemspec
|
89
93
|
homepage:
|
90
94
|
licenses:
|
@@ -106,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
110
|
version: '0'
|
107
111
|
requirements: []
|
108
112
|
rubyforge_project:
|
109
|
-
rubygems_version: 2.6.
|
113
|
+
rubygems_version: 2.6.13
|
110
114
|
signing_key:
|
111
115
|
specification_version: 4
|
112
116
|
summary: Some rubocop configs I like
|