pusher-rubocop 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +4 -0
- data/Gemfile +2 -0
- data/History.md +5 -0
- data/LICENSE.txt +20 -0
- data/README.md +22 -0
- data/bin/pusher-rubocop +17 -0
- data/config/default.yml +671 -0
- data/config/disabled.yml +30 -0
- data/config/enabled.yml +1006 -0
- data/config/pusher.yml +74 -0
- data/lib/pusher_rubocop.rb +17 -0
- data/pusher-rubocop.gemspec +25 -0
- metadata +74 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 58b44dbb99064914aee64d2b60c345e424063855
|
|
4
|
+
data.tar.gz: b07567d451beb38602a312b64de470b6f5f47851
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: aa9023d8e7994d4f83eeb70550424339c4bd7728609bb57955bd2c68124ff0cb069b51143211d6e5413fdb1b076227874cba32137621092f5cd9d951584a1806
|
|
7
|
+
data.tar.gz: 0304e12222b3059ef7295c02c5cc9e4249578ef3c3ebee4e359cbfd706cc8de5b280c6bb91049a3dd16971da83b4b5603d9e78da2f98b0cab602792ed5ed4950
|
data/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Gemfile.lock
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/History.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2015 Pusher
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Pusher RuboCop - Enforcing our internal ruby styleguide
|
|
2
|
+
=======================================================
|
|
3
|
+
|
|
4
|
+
Use with discretion. This is a hack on top of the wonderful
|
|
5
|
+
[rubocop](https://rubygems.org/gems/rubocop) gem to
|
|
6
|
+
enforce our ruby style internally.
|
|
7
|
+
|
|
8
|
+
Usage
|
|
9
|
+
-----
|
|
10
|
+
|
|
11
|
+
The `pusher-rubocop` executable should behave exactly as the `rubocop`
|
|
12
|
+
executable but with our own styleguide applied.
|
|
13
|
+
|
|
14
|
+
Upgrade rubocop
|
|
15
|
+
---------------
|
|
16
|
+
|
|
17
|
+
pusher-rubocop is pinning a specific rubocop gem version to avoid ambiguity.
|
|
18
|
+
|
|
19
|
+
To update the rubocop version:
|
|
20
|
+
* change the version specified in the `pusher-rubocop.gemspec` file
|
|
21
|
+
* copy the `config/{default,disabled,enabled}.yml` from the rubocop project
|
|
22
|
+
|
data/bin/pusher-rubocop
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
$LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + "/../lib")
|
|
5
|
+
|
|
6
|
+
require "pusher_rubocop"
|
|
7
|
+
require "benchmark"
|
|
8
|
+
|
|
9
|
+
cli = PusherRubocop::CLI.new
|
|
10
|
+
result = 0
|
|
11
|
+
|
|
12
|
+
time = Benchmark.realtime do
|
|
13
|
+
result = cli.run
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
puts "Finished in #{time} seconds" if cli.options[:debug]
|
|
17
|
+
exit result
|
data/config/default.yml
ADDED
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
# This is the default configuration file. Enabling and disabling is configured
|
|
2
|
+
# in separate files. This file adds all other parameters apart from Enabled.
|
|
3
|
+
|
|
4
|
+
inherit_from:
|
|
5
|
+
- enabled.yml
|
|
6
|
+
- disabled.yml
|
|
7
|
+
|
|
8
|
+
# Common configuration.
|
|
9
|
+
AllCops:
|
|
10
|
+
# Include gemspec and Rakefile
|
|
11
|
+
Include:
|
|
12
|
+
- '**/*.gemspec'
|
|
13
|
+
- '**/*.podspec'
|
|
14
|
+
- '**/*.jbuilder'
|
|
15
|
+
- '**/*.rake'
|
|
16
|
+
- '**/*.opal'
|
|
17
|
+
- '**/Gemfile'
|
|
18
|
+
- '**/Rakefile'
|
|
19
|
+
- '**/Capfile'
|
|
20
|
+
- '**/Guardfile'
|
|
21
|
+
- '**/Podfile'
|
|
22
|
+
- '**/Thorfile'
|
|
23
|
+
- '**/Vagrantfile'
|
|
24
|
+
- '**/Berksfile'
|
|
25
|
+
- '**/Cheffile'
|
|
26
|
+
- '**/Vagabondfile'
|
|
27
|
+
Exclude:
|
|
28
|
+
- 'vendor/**/*'
|
|
29
|
+
# By default, the rails cops are not run. Override in project or home
|
|
30
|
+
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
|
31
|
+
RunRailsCops: false
|
|
32
|
+
# Cop names are not displayed in offense messages by default. Change behavior
|
|
33
|
+
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
|
34
|
+
# option.
|
|
35
|
+
DisplayCopNames: false
|
|
36
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
|
37
|
+
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
|
38
|
+
# the --only-guide-cops option.
|
|
39
|
+
StyleGuideCopsOnly: false
|
|
40
|
+
|
|
41
|
+
# Indent private/protected/public as deep as method definitions
|
|
42
|
+
Style/AccessModifierIndentation:
|
|
43
|
+
EnforcedStyle: indent
|
|
44
|
+
SupportedStyles:
|
|
45
|
+
- outdent
|
|
46
|
+
- indent
|
|
47
|
+
|
|
48
|
+
# Align the elements of a hash literal if they span more than one line.
|
|
49
|
+
Style/AlignHash:
|
|
50
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
|
51
|
+
#
|
|
52
|
+
# key - left alignment of keys
|
|
53
|
+
# 'a' => 2
|
|
54
|
+
# 'bb' => 3
|
|
55
|
+
# separator - alignment of hash rockets, keys are right aligned
|
|
56
|
+
# 'a' => 2
|
|
57
|
+
# 'bb' => 3
|
|
58
|
+
# table - left alignment of keys, hash rockets, and values
|
|
59
|
+
# 'a' => 2
|
|
60
|
+
# 'bb' => 3
|
|
61
|
+
EnforcedHashRocketStyle: key
|
|
62
|
+
# Alignment of entries using colon as separator. Valid values are:
|
|
63
|
+
#
|
|
64
|
+
# key - left alignment of keys
|
|
65
|
+
# a: 0
|
|
66
|
+
# bb: 1
|
|
67
|
+
# separator - alignment of colons, keys are right aligned
|
|
68
|
+
# a: 0
|
|
69
|
+
# bb: 1
|
|
70
|
+
# table - left alignment of keys and values
|
|
71
|
+
# a: 0
|
|
72
|
+
# bb: 1
|
|
73
|
+
EnforcedColonStyle: key
|
|
74
|
+
# Select whether hashes that are the last argument in a method call should be
|
|
75
|
+
# inspected? Valid values are:
|
|
76
|
+
#
|
|
77
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
|
78
|
+
# Registers an offense for:
|
|
79
|
+
# function(a: 1,
|
|
80
|
+
# b: 2)
|
|
81
|
+
# Registers an offense for:
|
|
82
|
+
# function({a: 1,
|
|
83
|
+
# b: 2})
|
|
84
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
|
85
|
+
# Accepts:
|
|
86
|
+
# function(a: 1,
|
|
87
|
+
# b: 2)
|
|
88
|
+
# Accepts:
|
|
89
|
+
# function({a: 1,
|
|
90
|
+
# b: 2})
|
|
91
|
+
# ignore_implicit - Ignore only implicit hashes.
|
|
92
|
+
# Accepts:
|
|
93
|
+
# function(a: 1,
|
|
94
|
+
# b: 2)
|
|
95
|
+
# Registers an offense for:
|
|
96
|
+
# function({a: 1,
|
|
97
|
+
# b: 2})
|
|
98
|
+
# ignore_explicit - Ignore only explicit hashes.
|
|
99
|
+
# Accepts:
|
|
100
|
+
# function({a: 1,
|
|
101
|
+
# b: 2})
|
|
102
|
+
# Registers an offense for:
|
|
103
|
+
# function(a: 1,
|
|
104
|
+
# b: 2)
|
|
105
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
|
106
|
+
SupportedLastArgumentHashStyles:
|
|
107
|
+
- always_inspect
|
|
108
|
+
- always_ignore
|
|
109
|
+
- ignore_implicit
|
|
110
|
+
- ignore_explicit
|
|
111
|
+
|
|
112
|
+
Style/AlignParameters:
|
|
113
|
+
# Alignment of parameters in multi-line method calls.
|
|
114
|
+
#
|
|
115
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
|
116
|
+
# column as the first parameter.
|
|
117
|
+
#
|
|
118
|
+
# method_call(a,
|
|
119
|
+
# b)
|
|
120
|
+
#
|
|
121
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
|
122
|
+
# level of indentation relative to the start of the line with the method call.
|
|
123
|
+
#
|
|
124
|
+
# method_call(a,
|
|
125
|
+
# b)
|
|
126
|
+
EnforcedStyle: with_first_parameter
|
|
127
|
+
SupportedStyles:
|
|
128
|
+
- with_first_parameter
|
|
129
|
+
- with_fixed_indentation
|
|
130
|
+
|
|
131
|
+
Style/AndOr:
|
|
132
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
|
133
|
+
# or completely (always).
|
|
134
|
+
EnforcedStyle: always
|
|
135
|
+
SupportedStyles:
|
|
136
|
+
- always
|
|
137
|
+
- conditionals
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# Checks if usage of %() or %Q() matches configuration.
|
|
141
|
+
Style/BarePercentLiterals:
|
|
142
|
+
EnforcedStyle: bare_percent
|
|
143
|
+
SupportedStyles:
|
|
144
|
+
- percent_q
|
|
145
|
+
- bare_percent
|
|
146
|
+
|
|
147
|
+
Style/BracesAroundHashParameters:
|
|
148
|
+
EnforcedStyle: no_braces
|
|
149
|
+
SupportedStyles:
|
|
150
|
+
# The `braces` style enforces braces around all method parameters that are
|
|
151
|
+
# hashes.
|
|
152
|
+
- braces
|
|
153
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
|
154
|
+
# around it.
|
|
155
|
+
- no_braces
|
|
156
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
|
157
|
+
# braces around it, but requires braces if the second to last parameter is
|
|
158
|
+
# also a hash literal.
|
|
159
|
+
- context_dependent
|
|
160
|
+
|
|
161
|
+
# Indentation of `when`.
|
|
162
|
+
Style/CaseIndentation:
|
|
163
|
+
IndentWhenRelativeTo: case
|
|
164
|
+
SupportedStyles:
|
|
165
|
+
- case
|
|
166
|
+
- end
|
|
167
|
+
IndentOneStep: false
|
|
168
|
+
|
|
169
|
+
Style/ClassAndModuleChildren:
|
|
170
|
+
# Checks the style of children definitions at classes and modules.
|
|
171
|
+
#
|
|
172
|
+
# Basically there are two different styles:
|
|
173
|
+
#
|
|
174
|
+
# `nested` - have each child on a separate line
|
|
175
|
+
# class Foo
|
|
176
|
+
# class Bar
|
|
177
|
+
# end
|
|
178
|
+
# end
|
|
179
|
+
#
|
|
180
|
+
# `compact` - combine definitions as much as possible
|
|
181
|
+
# class Foo::Bar
|
|
182
|
+
# end
|
|
183
|
+
#
|
|
184
|
+
# The compact style is only forced, for classes / modules with one child.
|
|
185
|
+
EnforcedStyle: nested
|
|
186
|
+
SupportedStyles:
|
|
187
|
+
- nested
|
|
188
|
+
- compact
|
|
189
|
+
|
|
190
|
+
Style/ClassCheck:
|
|
191
|
+
EnforcedStyle: is_a?
|
|
192
|
+
SupportedStyles:
|
|
193
|
+
- is_a?
|
|
194
|
+
- kind_of?
|
|
195
|
+
|
|
196
|
+
# Align with the style guide.
|
|
197
|
+
Style/CollectionMethods:
|
|
198
|
+
# Mapping from undesired method to desired_method
|
|
199
|
+
# e.g. to use `detect` over `find`:
|
|
200
|
+
#
|
|
201
|
+
# CollectionMethods:
|
|
202
|
+
# PreferredMethods:
|
|
203
|
+
# find: detect
|
|
204
|
+
PreferredMethods:
|
|
205
|
+
collect: 'map'
|
|
206
|
+
collect!: 'map!'
|
|
207
|
+
inject: 'reduce'
|
|
208
|
+
detect: 'find'
|
|
209
|
+
find_all: 'select'
|
|
210
|
+
|
|
211
|
+
# Checks formatting of special comments
|
|
212
|
+
Style/CommentAnnotation:
|
|
213
|
+
Keywords:
|
|
214
|
+
- TODO
|
|
215
|
+
- FIXME
|
|
216
|
+
- OPTIMIZE
|
|
217
|
+
- HACK
|
|
218
|
+
- REVIEW
|
|
219
|
+
|
|
220
|
+
# Multi-line method chaining should be done with leading dots.
|
|
221
|
+
Style/DotPosition:
|
|
222
|
+
EnforcedStyle: leading
|
|
223
|
+
SupportedStyles:
|
|
224
|
+
- leading
|
|
225
|
+
- trailing
|
|
226
|
+
|
|
227
|
+
# Use empty lines between defs.
|
|
228
|
+
Style/EmptyLineBetweenDefs:
|
|
229
|
+
# If true, this parameter means that single line method definitions don't
|
|
230
|
+
# need an empty line between them.
|
|
231
|
+
AllowAdjacentOneLineDefs: false
|
|
232
|
+
|
|
233
|
+
Style/EmptyLinesAroundBlockBody:
|
|
234
|
+
EnforcedStyle: no_empty_lines
|
|
235
|
+
SupportedStyles:
|
|
236
|
+
- empty_lines
|
|
237
|
+
- no_empty_lines
|
|
238
|
+
|
|
239
|
+
Style/EmptyLinesAroundClassBody:
|
|
240
|
+
EnforcedStyle: no_empty_lines
|
|
241
|
+
SupportedStyles:
|
|
242
|
+
- empty_lines
|
|
243
|
+
- no_empty_lines
|
|
244
|
+
|
|
245
|
+
Style/EmptyLinesAroundModuleBody:
|
|
246
|
+
EnforcedStyle: no_empty_lines
|
|
247
|
+
SupportedStyles:
|
|
248
|
+
- empty_lines
|
|
249
|
+
- no_empty_lines
|
|
250
|
+
|
|
251
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
|
252
|
+
Style/Encoding:
|
|
253
|
+
EnforcedStyle: always
|
|
254
|
+
SupportedStyles:
|
|
255
|
+
- when_needed
|
|
256
|
+
- always
|
|
257
|
+
|
|
258
|
+
Style/FileName:
|
|
259
|
+
# File names listed in AllCops:Include are excluded by default. Add extra
|
|
260
|
+
# excludes here.
|
|
261
|
+
Exclude: []
|
|
262
|
+
|
|
263
|
+
Style/FirstParameterIndentation:
|
|
264
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
|
265
|
+
SupportedStyles:
|
|
266
|
+
# The first parameter should always be indented one step more than the
|
|
267
|
+
# preceding line.
|
|
268
|
+
- consistent
|
|
269
|
+
# The first parameter should normally be indented one step more than the
|
|
270
|
+
# preceding line, but if it's a parameter for a method call that is itself
|
|
271
|
+
# a parameter in a method call, then the inner parameter should be indented
|
|
272
|
+
# relative to the inner method.
|
|
273
|
+
- special_for_inner_method_call
|
|
274
|
+
# Same as special_for_inner_method_call except that the special rule only
|
|
275
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
|
276
|
+
- special_for_inner_method_call_in_parentheses
|
|
277
|
+
|
|
278
|
+
# Checks use of for or each in multiline loops.
|
|
279
|
+
Style/For:
|
|
280
|
+
EnforcedStyle: each
|
|
281
|
+
SupportedStyles:
|
|
282
|
+
- for
|
|
283
|
+
- each
|
|
284
|
+
|
|
285
|
+
# Enforce the method used for string formatting.
|
|
286
|
+
Style/FormatString:
|
|
287
|
+
EnforcedStyle: format
|
|
288
|
+
SupportedStyles:
|
|
289
|
+
- format
|
|
290
|
+
- sprintf
|
|
291
|
+
- percent
|
|
292
|
+
|
|
293
|
+
# Built-in global variables are allowed by default.
|
|
294
|
+
Style/GlobalVars:
|
|
295
|
+
AllowedVariables: []
|
|
296
|
+
|
|
297
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
|
298
|
+
# needs to have to trigger this cop
|
|
299
|
+
Style/GuardClause:
|
|
300
|
+
MinBodyLength: 1
|
|
301
|
+
|
|
302
|
+
Style/HashSyntax:
|
|
303
|
+
EnforcedStyle: ruby19
|
|
304
|
+
SupportedStyles:
|
|
305
|
+
- ruby19
|
|
306
|
+
- ruby19_no_mixed_keys
|
|
307
|
+
- hash_rockets
|
|
308
|
+
|
|
309
|
+
Style/IfUnlessModifier:
|
|
310
|
+
MaxLineLength: 80
|
|
311
|
+
|
|
312
|
+
Style/IndentationWidth:
|
|
313
|
+
# Number of spaces for each indentation level.
|
|
314
|
+
Width: 2
|
|
315
|
+
|
|
316
|
+
# Checks the indentation of the first key in a hash literal.
|
|
317
|
+
Style/IndentHash:
|
|
318
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
|
319
|
+
# that have their opening brace on the same line as a surrounding opening
|
|
320
|
+
# round parenthesis, shall have their first key indented relative to the
|
|
321
|
+
# first position inside the parenthesis.
|
|
322
|
+
# The value `consistent` means that the indentation of the first key shall
|
|
323
|
+
# always be relative to the first position of the line where the opening
|
|
324
|
+
# brace is.
|
|
325
|
+
EnforcedStyle: special_inside_parentheses
|
|
326
|
+
SupportedStyles:
|
|
327
|
+
- special_inside_parentheses
|
|
328
|
+
- consistent
|
|
329
|
+
|
|
330
|
+
Style/LambdaCall:
|
|
331
|
+
EnforcedStyle: call
|
|
332
|
+
SupportedStyles:
|
|
333
|
+
- call
|
|
334
|
+
- braces
|
|
335
|
+
|
|
336
|
+
Style/Next:
|
|
337
|
+
# With `always` all conditions at the end of an iteration needs to be
|
|
338
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
|
339
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
|
340
|
+
EnforcedStyle: skip_modifier_ifs
|
|
341
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
|
342
|
+
# needs to have to trigger this cop
|
|
343
|
+
MinBodyLength: 3
|
|
344
|
+
SupportedStyles:
|
|
345
|
+
- skip_modifier_ifs
|
|
346
|
+
- always
|
|
347
|
+
|
|
348
|
+
Style/NonNilCheck:
|
|
349
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
|
350
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
|
351
|
+
# **usually** OK, but might change behavior.
|
|
352
|
+
#
|
|
353
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
|
354
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
|
355
|
+
IncludeSemanticChanges: false
|
|
356
|
+
|
|
357
|
+
Style/MethodDefParentheses:
|
|
358
|
+
EnforcedStyle: require_parentheses
|
|
359
|
+
SupportedStyles:
|
|
360
|
+
- require_parentheses
|
|
361
|
+
- require_no_parentheses
|
|
362
|
+
|
|
363
|
+
Style/MethodName:
|
|
364
|
+
EnforcedStyle: snake_case
|
|
365
|
+
SupportedStyles:
|
|
366
|
+
- snake_case
|
|
367
|
+
- camelCase
|
|
368
|
+
|
|
369
|
+
Style/MultilineOperationIndentation:
|
|
370
|
+
EnforcedStyle: aligned
|
|
371
|
+
SupportedStyles:
|
|
372
|
+
- aligned
|
|
373
|
+
- indented
|
|
374
|
+
|
|
375
|
+
Style/NumericLiterals:
|
|
376
|
+
MinDigits: 5
|
|
377
|
+
|
|
378
|
+
# Allow safe assignment in conditions.
|
|
379
|
+
Style/ParenthesesAroundCondition:
|
|
380
|
+
AllowSafeAssignment: true
|
|
381
|
+
|
|
382
|
+
Style/PercentLiteralDelimiters:
|
|
383
|
+
PreferredDelimiters:
|
|
384
|
+
'%': ()
|
|
385
|
+
'%i': ()
|
|
386
|
+
'%q': ()
|
|
387
|
+
'%Q': ()
|
|
388
|
+
'%r': '{}'
|
|
389
|
+
'%s': ()
|
|
390
|
+
'%w': ()
|
|
391
|
+
'%W': ()
|
|
392
|
+
'%x': ()
|
|
393
|
+
|
|
394
|
+
Style/PercentQLiterals:
|
|
395
|
+
EnforcedStyle: lower_case_q
|
|
396
|
+
SupportedStyles:
|
|
397
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
|
398
|
+
- upper_case_q # Always use %Q
|
|
399
|
+
|
|
400
|
+
Style/PredicateName:
|
|
401
|
+
# Predicate name prefices.
|
|
402
|
+
NamePrefix:
|
|
403
|
+
- is_
|
|
404
|
+
- has_
|
|
405
|
+
- have_
|
|
406
|
+
# Predicate name prefices that should be removed.
|
|
407
|
+
NamePrefixBlacklist:
|
|
408
|
+
- is_
|
|
409
|
+
- has_
|
|
410
|
+
- have_
|
|
411
|
+
|
|
412
|
+
Style/RaiseArgs:
|
|
413
|
+
EnforcedStyle: exploded
|
|
414
|
+
SupportedStyles:
|
|
415
|
+
- compact # raise Exception.new(msg)
|
|
416
|
+
- exploded # raise Exception, msg
|
|
417
|
+
|
|
418
|
+
Style/RedundantReturn:
|
|
419
|
+
# When true allows code like `return x, y`.
|
|
420
|
+
AllowMultipleReturnValues: false
|
|
421
|
+
|
|
422
|
+
Style/RegexpLiteral:
|
|
423
|
+
# The maximum number of (escaped) slashes that a slash-delimited regexp is
|
|
424
|
+
# allowed to have. If there are more slashes, a %r regexp shall be used.
|
|
425
|
+
MaxSlashes: 1
|
|
426
|
+
|
|
427
|
+
Style/Semicolon:
|
|
428
|
+
# Allow ; to separate several expressions on the same line.
|
|
429
|
+
AllowAsExpressionSeparator: false
|
|
430
|
+
|
|
431
|
+
Style/SignalException:
|
|
432
|
+
EnforcedStyle: semantic
|
|
433
|
+
SupportedStyles:
|
|
434
|
+
- only_raise
|
|
435
|
+
- only_fail
|
|
436
|
+
- semantic
|
|
437
|
+
|
|
438
|
+
Style/SingleLineBlockParams:
|
|
439
|
+
Methods:
|
|
440
|
+
- reduce:
|
|
441
|
+
- a
|
|
442
|
+
- e
|
|
443
|
+
- inject:
|
|
444
|
+
- a
|
|
445
|
+
- e
|
|
446
|
+
|
|
447
|
+
Style/SingleLineMethods:
|
|
448
|
+
AllowIfMethodIsEmpty: true
|
|
449
|
+
|
|
450
|
+
Style/StringLiterals:
|
|
451
|
+
EnforcedStyle: single_quotes
|
|
452
|
+
SupportedStyles:
|
|
453
|
+
- single_quotes
|
|
454
|
+
- double_quotes
|
|
455
|
+
|
|
456
|
+
Style/StringLiteralsInInterpolation:
|
|
457
|
+
EnforcedStyle: single_quotes
|
|
458
|
+
SupportedStyles:
|
|
459
|
+
- single_quotes
|
|
460
|
+
- double_quotes
|
|
461
|
+
|
|
462
|
+
Style/SpaceAroundBlockParameters:
|
|
463
|
+
EnforcedStyleInsidePipes: no_space
|
|
464
|
+
SupportedStyles:
|
|
465
|
+
- space
|
|
466
|
+
- no_space
|
|
467
|
+
|
|
468
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
|
469
|
+
EnforcedStyle: space
|
|
470
|
+
SupportedStyles:
|
|
471
|
+
- space
|
|
472
|
+
- no_space
|
|
473
|
+
|
|
474
|
+
Style/SpaceAroundOperators:
|
|
475
|
+
MultiSpaceAllowedForOperators:
|
|
476
|
+
- '='
|
|
477
|
+
- '=>'
|
|
478
|
+
|
|
479
|
+
Style/SpaceBeforeBlockBraces:
|
|
480
|
+
EnforcedStyle: space
|
|
481
|
+
SupportedStyles:
|
|
482
|
+
- space
|
|
483
|
+
- no_space
|
|
484
|
+
|
|
485
|
+
Style/SpaceInsideBlockBraces:
|
|
486
|
+
EnforcedStyle: space
|
|
487
|
+
SupportedStyles:
|
|
488
|
+
- space
|
|
489
|
+
- no_space
|
|
490
|
+
# Valid values are: space, no_space
|
|
491
|
+
EnforcedStyleForEmptyBraces: no_space
|
|
492
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
|
493
|
+
SpaceBeforeBlockParameters: true
|
|
494
|
+
|
|
495
|
+
Style/SpaceInsideHashLiteralBraces:
|
|
496
|
+
EnforcedStyle: space
|
|
497
|
+
EnforcedStyleForEmptyBraces: no_space
|
|
498
|
+
SupportedStyles:
|
|
499
|
+
- space
|
|
500
|
+
- no_space
|
|
501
|
+
|
|
502
|
+
Style/SymbolProc:
|
|
503
|
+
# A list of method names to be ignored by the check.
|
|
504
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
|
505
|
+
IgnoredMethods:
|
|
506
|
+
- respond_to
|
|
507
|
+
|
|
508
|
+
Style/TrailingBlankLines:
|
|
509
|
+
EnforcedStyle: final_newline
|
|
510
|
+
SupportedStyles:
|
|
511
|
+
- final_newline
|
|
512
|
+
- final_blank_line
|
|
513
|
+
|
|
514
|
+
Style/TrailingComma:
|
|
515
|
+
# If EnforcedStyleForMultiline is comma, the cop allows a comma after the
|
|
516
|
+
# last item of a list, but only for lists where each item is on its own line.
|
|
517
|
+
EnforcedStyleForMultiline: no_comma
|
|
518
|
+
SupportedStyles:
|
|
519
|
+
- comma
|
|
520
|
+
- no_comma
|
|
521
|
+
|
|
522
|
+
# TrivialAccessors doesn't require exact name matches and doesn't allow
|
|
523
|
+
# predicated methods by default.
|
|
524
|
+
Style/TrivialAccessors:
|
|
525
|
+
ExactNameMatch: false
|
|
526
|
+
AllowPredicates: false
|
|
527
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
|
528
|
+
#
|
|
529
|
+
# def on_exception(action)
|
|
530
|
+
# @on_exception=action
|
|
531
|
+
# end
|
|
532
|
+
# on_exception :restart
|
|
533
|
+
#
|
|
534
|
+
# Commonly used in DSLs
|
|
535
|
+
AllowDSLWriters: false
|
|
536
|
+
IgnoreClassMethods: false
|
|
537
|
+
Whitelist:
|
|
538
|
+
- to_ary
|
|
539
|
+
- to_a
|
|
540
|
+
- to_c
|
|
541
|
+
- to_enum
|
|
542
|
+
- to_h
|
|
543
|
+
- to_hash
|
|
544
|
+
- to_i
|
|
545
|
+
- to_int
|
|
546
|
+
- to_io
|
|
547
|
+
- to_open
|
|
548
|
+
- to_path
|
|
549
|
+
- to_proc
|
|
550
|
+
- to_r
|
|
551
|
+
- to_regexp
|
|
552
|
+
- to_str
|
|
553
|
+
- to_s
|
|
554
|
+
- to_sym
|
|
555
|
+
|
|
556
|
+
Style/VariableName:
|
|
557
|
+
EnforcedStyle: snake_case
|
|
558
|
+
SupportedStyles:
|
|
559
|
+
- snake_case
|
|
560
|
+
- camelCase
|
|
561
|
+
|
|
562
|
+
Style/WhileUntilModifier:
|
|
563
|
+
MaxLineLength: 80
|
|
564
|
+
|
|
565
|
+
Style/WordArray:
|
|
566
|
+
MinSize: 0
|
|
567
|
+
# The regular expression WordRegex decides what is considered a word.
|
|
568
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
|
|
569
|
+
|
|
570
|
+
##################### Metrics ##################################
|
|
571
|
+
|
|
572
|
+
Metrics/AbcSize:
|
|
573
|
+
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
|
|
574
|
+
# a Float.
|
|
575
|
+
Max: 15
|
|
576
|
+
|
|
577
|
+
Metrics/BlockNesting:
|
|
578
|
+
Max: 3
|
|
579
|
+
|
|
580
|
+
Metrics/ClassLength:
|
|
581
|
+
CountComments: false # count full line comments?
|
|
582
|
+
Max: 100
|
|
583
|
+
|
|
584
|
+
# Avoid complex methods.
|
|
585
|
+
Metrics/CyclomaticComplexity:
|
|
586
|
+
Max: 6
|
|
587
|
+
|
|
588
|
+
Metrics/LineLength:
|
|
589
|
+
Max: 80
|
|
590
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
|
591
|
+
# contaning a URI to be longer than Max.
|
|
592
|
+
AllowURI: true
|
|
593
|
+
URISchemes:
|
|
594
|
+
- http
|
|
595
|
+
- https
|
|
596
|
+
|
|
597
|
+
Metrics/MethodLength:
|
|
598
|
+
CountComments: false # count full line comments?
|
|
599
|
+
Max: 10
|
|
600
|
+
|
|
601
|
+
Metrics/ParameterLists:
|
|
602
|
+
Max: 5
|
|
603
|
+
CountKeywordArgs: true
|
|
604
|
+
|
|
605
|
+
Metrics/PerceivedComplexity:
|
|
606
|
+
Max: 7
|
|
607
|
+
|
|
608
|
+
##################### Lint ##################################
|
|
609
|
+
|
|
610
|
+
# Allow safe assignment in conditions.
|
|
611
|
+
Lint/AssignmentInCondition:
|
|
612
|
+
AllowSafeAssignment: true
|
|
613
|
+
|
|
614
|
+
# Align ends correctly.
|
|
615
|
+
Lint/EndAlignment:
|
|
616
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
|
617
|
+
# keyword (if, while, etc.).
|
|
618
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
|
619
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
|
620
|
+
# situations, `end` should still be aligned with the keyword.
|
|
621
|
+
AlignWith: keyword
|
|
622
|
+
SupportedStyles:
|
|
623
|
+
- keyword
|
|
624
|
+
- variable
|
|
625
|
+
|
|
626
|
+
Lint/DefEndAlignment:
|
|
627
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
|
628
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
|
629
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
|
630
|
+
# keyword on the same line.
|
|
631
|
+
AlignWith: start_of_line
|
|
632
|
+
SupportedStyles:
|
|
633
|
+
- start_of_line
|
|
634
|
+
- def
|
|
635
|
+
|
|
636
|
+
##################### Rails ##################################
|
|
637
|
+
|
|
638
|
+
Rails/ActionFilter:
|
|
639
|
+
EnforcedStyle: action
|
|
640
|
+
SupportedStyles:
|
|
641
|
+
- action
|
|
642
|
+
- filter
|
|
643
|
+
Include:
|
|
644
|
+
- app/controllers/**/*.rb
|
|
645
|
+
|
|
646
|
+
Rails/DefaultScope:
|
|
647
|
+
Include:
|
|
648
|
+
- app/models/**/*.rb
|
|
649
|
+
|
|
650
|
+
Rails/HasAndBelongsToMany:
|
|
651
|
+
Include:
|
|
652
|
+
- app/models/**/*.rb
|
|
653
|
+
|
|
654
|
+
Rails/Output:
|
|
655
|
+
Include:
|
|
656
|
+
- app/**/*.rb
|
|
657
|
+
- config/**/*.rb
|
|
658
|
+
- db/**/*.rb
|
|
659
|
+
- lib/**/*.rb
|
|
660
|
+
|
|
661
|
+
Rails/ReadWriteAttribute:
|
|
662
|
+
Include:
|
|
663
|
+
- app/models/**/*.rb
|
|
664
|
+
|
|
665
|
+
Rails/ScopeArgs:
|
|
666
|
+
Include:
|
|
667
|
+
- app/models/**/*.rb
|
|
668
|
+
|
|
669
|
+
Rails/Validation:
|
|
670
|
+
Include:
|
|
671
|
+
- app/models/**/*.rb
|