decidim-dev 0.27.6 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +0 -1
- data/app/events/decidim/dummy_resources/dummy_resource_event.rb +10 -0
- data/app/jobs/decidim/dummy_resources/hide_all_created_by_author_job.rb +13 -0
- data/app/models/decidim/dummy_resources/application_record.rb +9 -0
- data/app/models/decidim/dummy_resources/coauthorable_dummy_resource.rb +10 -0
- data/app/models/decidim/dummy_resources/dummy_resource.rb +93 -0
- data/app/models/decidim/dummy_resources/nested_dummy_resource.rb +10 -0
- data/app/packs/src/decidim/dev/accessibility.js +3 -3
- data/app/packs/src/decidim/dev/test/custom_map_factory.js +1 -1
- data/app/packs/stylesheets/decidim/dev/_accessibility.scss +24 -24
- data/app/packs/stylesheets/decidim/dev/_map.scss +10 -0
- data/app/packs/stylesheets/decidim/dev.scss +1 -0
- data/app/presenters/decidim/dummy_resources/official_author_presenter.rb +33 -0
- data/app/serializers/decidim/dummy_resources/dummy_serializer.rb +21 -0
- data/app/views/decidim/dummy_resources/dummy_resources/show.html.erb +22 -12
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +0 -1
- data/config/locales/de.yml +1 -1
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +1 -1
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/eu.yml +3 -3
- data/config/locales/gl.yml +0 -1
- data/config/locales/hu.yml +2 -3
- data/config/locales/id-ID.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/locales/lv.yml +0 -1
- data/config/locales/nl.yml +0 -1
- data/config/locales/no.yml +0 -1
- data/config/locales/pl.yml +0 -9
- data/config/locales/pt-BR.yml +0 -9
- data/config/locales/pt.yml +0 -1
- data/config/locales/ru.yml +0 -1
- data/config/locales/sk.yml +0 -1
- data/config/locales/sv.yml +0 -1
- data/config/locales/tr-TR.yml +0 -1
- data/config/locales/zh-CN.yml +0 -1
- data/config/rubocop/disabled.yml +11 -0
- data/config/rubocop/faker.yml +480 -0
- data/config/rubocop/rails.yml +105 -0
- data/config/rubocop/rspec.yml +69 -0
- data/config/rubocop/ruby.yml +1207 -0
- data/lib/decidim/dev/assets/import_participatory_space_private_users.csv +2 -2
- data/lib/decidim/dev/assets/import_participatory_space_private_users_invalid_col_sep.csv +2 -0
- data/lib/decidim/dev/assets/import_participatory_space_private_users_nok.csv +2 -2
- data/lib/decidim/dev/assets/import_participatory_space_private_users_with_bom.csv +1 -1
- data/lib/decidim/dev/assets/iso-8859-15.md +1 -1
- data/lib/decidim/dev/assets/participatory_text.md +4 -2
- data/lib/decidim/dev/assets/verify_user_groups.csv +22 -22
- data/lib/decidim/dev/engine.rb +4 -3
- data/lib/decidim/dev/test/factories.rb +3 -5
- data/lib/decidim/dev/test/form_to_param_shared_examples.rb +1 -1
- data/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb +9 -9
- data/lib/decidim/dev/test/rspec_support/accessibility_examples.rb +119 -1
- data/lib/decidim/dev/test/rspec_support/attachment_helpers.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/bullet.rb +32 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +26 -25
- data/lib/decidim/dev/test/rspec_support/cell_matchers.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/component.rb +1 -311
- data/lib/decidim/dev/test/rspec_support/component_context.rb +10 -10
- data/lib/decidim/dev/test/rspec_support/confirmation_helpers.rb +18 -14
- data/lib/decidim/dev/test/rspec_support/data_consent.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/dynamic_attach.rb +19 -4
- data/lib/decidim/dev/test/rspec_support/editor_context.rb +35 -0
- data/lib/decidim/dev/test/rspec_support/engine_examples.rb +15 -0
- data/lib/decidim/dev/test/rspec_support/filters.rb +11 -0
- data/lib/decidim/dev/test/rspec_support/forms_validations.rb +20 -0
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +3 -3
- data/lib/decidim/dev/test/rspec_support/helpers.rb +187 -34
- data/lib/decidim/dev/test/rspec_support/imports_controller_shared_examples.rb +11 -11
- data/lib/decidim/dev/test/rspec_support/tom_select.rb +26 -0
- data/lib/decidim/dev/test/rspec_support/translation_helpers.rb +8 -8
- data/lib/decidim/dev/test/rspec_support/warden.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/webpacker.rb +4 -22
- data/lib/decidim/dev/test/spec_helper.rb +14 -3
- data/lib/decidim/dev/test/w3c_rspec_validators_overrides.rb +1 -5
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/decidim/dev.rb +9 -0
- data/lib/decidim/dummy_resources/admin.rb +8 -0
- data/lib/decidim/dummy_resources/admin_engine.rb +43 -0
- data/lib/decidim/dummy_resources/component.rb +94 -0
- data/lib/decidim/dummy_resources/engine.rb +28 -0
- data/lib/decidim/dummy_resources.rb +20 -0
- data/lib/tasks/lighthouse_report.rake +29 -7
- data/rubocop-decidim.yml +13 -0
- metadata +122 -70
- data/config/locales/he-IL.yml +0 -1
- data/decidim-dev.gemspec +0 -56
- data/lib/decidim/dev/test/rspec_support/capybara_data_picker.rb +0 -36
- data/lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb +0 -92
- data/lib/decidim/dev/test/rspec_support/concurrency.rb +0 -23
- data/lib/decidim/dev/test/rspec_support/decidim_sanitization.rb +0 -5
@@ -0,0 +1,1207 @@
|
|
1
|
+
# Common configuration.
|
2
|
+
AllCops:
|
3
|
+
Include:
|
4
|
+
- .simplecov
|
5
|
+
- "**/*.rb"
|
6
|
+
- "**/*.rake"
|
7
|
+
- "**/*.gemspec"
|
8
|
+
- "**/*.ru"
|
9
|
+
- "**/Capfile"
|
10
|
+
- "**/Gemfile"
|
11
|
+
- "**/Rakefile"
|
12
|
+
Exclude:
|
13
|
+
- db/schema.rb
|
14
|
+
- "**/node_modules/**/*"
|
15
|
+
- "**/vendor/**/*"
|
16
|
+
- "development_app*/**/*"
|
17
|
+
- "spec/decidim_dummy_app/**/*"
|
18
|
+
- "node_modules/**/*"
|
19
|
+
# Default formatter will be used if no -f/--format option is given.
|
20
|
+
DefaultFormatter: progress
|
21
|
+
# Cop names are not displayed in offense messages by default. Change behavior
|
22
|
+
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
23
|
+
# option.
|
24
|
+
DisplayCopNames: true
|
25
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
26
|
+
# behavior by overriding DisplayStyleGuide, or by giving the
|
27
|
+
# -S/--display-style-guide option.
|
28
|
+
DisplayStyleGuide: false
|
29
|
+
# Extra details are not displayed in offense messages by default. Change
|
30
|
+
# behavior by overriding ExtraDetails, or by giving the
|
31
|
+
# -E/--extra-details option.
|
32
|
+
ExtraDetails: false
|
33
|
+
NewCops: enable
|
34
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
35
|
+
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
36
|
+
# the --only-guide-cops option.
|
37
|
+
StyleGuideCopsOnly: false
|
38
|
+
# All cops except the ones in disabled.yml are enabled by default. Change
|
39
|
+
# this behavior by overriding DisabledByDefault. When DisabledByDefault is
|
40
|
+
# true, all cops in the default configuration are disabled, and and only cops
|
41
|
+
# in user configuration are enabled. This makes cops opt-in instead of
|
42
|
+
# opt-out. Note that when DisabledByDefault is true, cops in user
|
43
|
+
# configuration will be enabled even if they do not set the Enabled parameter.
|
44
|
+
DisabledByDefault: false
|
45
|
+
# Enables the result cache if true. Can be overridden by the --cache command
|
46
|
+
# line option.
|
47
|
+
UseCache: true
|
48
|
+
# Threshold for how many files can be stored in the result cache before some
|
49
|
+
# of the files are automatically removed.
|
50
|
+
MaxFilesInCache: 20000
|
51
|
+
# The cache will be stored in "rubocop_cache" under this directory. The name
|
52
|
+
# "/tmp" is special and will be converted to the system temporary directory,
|
53
|
+
# which is "/tmp" on Unix-like systems, but could be something else on other
|
54
|
+
# systems.
|
55
|
+
CacheRootDirectory: /tmp
|
56
|
+
# The default cache root directory is /tmp, which on most systems is
|
57
|
+
# writable by any system user. This means that it is possible for a
|
58
|
+
# malicious user to anticipate the location of Rubocop's cache directory,
|
59
|
+
# and create a symlink in its place that could cause Rubocop to overwrite
|
60
|
+
# unintended files, or read malicious input. If you are certain that your
|
61
|
+
# cache location is secure from this kind of attack, and wish to use a
|
62
|
+
# symlinked cache location, set this value to "true".
|
63
|
+
AllowSymlinksInCacheRootDirectory: true
|
64
|
+
# What MRI version of the Ruby interpreter is the inspected code intended to
|
65
|
+
# run on? (If there is more than one, set this to the lowest version.)
|
66
|
+
# If a value is specified for TargetRubyVersion then it is used.
|
67
|
+
# Else if .ruby-version exists and it contains an MRI version it is used.
|
68
|
+
# Otherwise we fallback to the oldest officially supported Ruby version (2.0).
|
69
|
+
TargetRubyVersion: 3.1
|
70
|
+
|
71
|
+
# Indent private/protected/public as deep as method definitions
|
72
|
+
Layout/AccessModifierIndentation:
|
73
|
+
EnforcedStyle: indent
|
74
|
+
SupportedStyles:
|
75
|
+
- outdent
|
76
|
+
- indent
|
77
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
78
|
+
# But it can be overridden by setting this parameter
|
79
|
+
IndentationWidth: ~
|
80
|
+
|
81
|
+
Style/Alias:
|
82
|
+
EnforcedStyle: prefer_alias
|
83
|
+
SupportedStyles:
|
84
|
+
- prefer_alias
|
85
|
+
- prefer_alias_method
|
86
|
+
|
87
|
+
# Align the elements of a hash literal if they span more than one line.
|
88
|
+
Layout/HashAlignment:
|
89
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
90
|
+
#
|
91
|
+
# key - left alignment of keys
|
92
|
+
# "a" => 2
|
93
|
+
# "bb" => 3
|
94
|
+
# separator - alignment of hash rockets, keys are right aligned
|
95
|
+
# "a" => 2
|
96
|
+
# "bb" => 3
|
97
|
+
# table - left alignment of keys, hash rockets, and values
|
98
|
+
# "a" => 2
|
99
|
+
# "bb" => 3
|
100
|
+
EnforcedHashRocketStyle: key
|
101
|
+
# Alignment of entries using colon as separator. Valid values are:
|
102
|
+
#
|
103
|
+
# key - left alignment of keys
|
104
|
+
# a: 0
|
105
|
+
# bb: 1
|
106
|
+
# separator - alignment of colons, keys are right aligned
|
107
|
+
# a: 0
|
108
|
+
# bb: 1
|
109
|
+
# table - left alignment of keys and values
|
110
|
+
# a: 0
|
111
|
+
# bb: 1
|
112
|
+
EnforcedColonStyle: key
|
113
|
+
# Select whether hashes that are the last argument in a method call should be
|
114
|
+
# inspected? Valid values are:
|
115
|
+
#
|
116
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
117
|
+
# Registers an offense for:
|
118
|
+
# function(a: 1,
|
119
|
+
# b: 2)
|
120
|
+
# Registers an offense for:
|
121
|
+
# function({a: 1,
|
122
|
+
# b: 2})
|
123
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
124
|
+
# Accepts:
|
125
|
+
# function(a: 1,
|
126
|
+
# b: 2)
|
127
|
+
# Accepts:
|
128
|
+
# function({a: 1,
|
129
|
+
# b: 2})
|
130
|
+
# ignore_implicit - Ignore only implicit hashes.
|
131
|
+
# Accepts:
|
132
|
+
# function(a: 1,
|
133
|
+
# b: 2)
|
134
|
+
# Registers an offense for:
|
135
|
+
# function({a: 1,
|
136
|
+
# b: 2})
|
137
|
+
# ignore_explicit - Ignore only explicit hashes.
|
138
|
+
# Accepts:
|
139
|
+
# function({a: 1,
|
140
|
+
# b: 2})
|
141
|
+
# Registers an offense for:
|
142
|
+
# function(a: 1,
|
143
|
+
# b: 2)
|
144
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
145
|
+
SupportedLastArgumentHashStyles:
|
146
|
+
- always_inspect
|
147
|
+
- always_ignore
|
148
|
+
- ignore_implicit
|
149
|
+
- ignore_explicit
|
150
|
+
|
151
|
+
Layout/ParameterAlignment:
|
152
|
+
# Alignment of parameters in multi-line method calls.
|
153
|
+
#
|
154
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
155
|
+
# column as the first parameter.
|
156
|
+
#
|
157
|
+
# method_call(a,
|
158
|
+
# b)
|
159
|
+
#
|
160
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
161
|
+
# level of indentation relative to the start of the line with the method call.
|
162
|
+
#
|
163
|
+
# method_call(a,
|
164
|
+
# b)
|
165
|
+
EnforcedStyle: with_first_parameter
|
166
|
+
SupportedStyles:
|
167
|
+
- with_first_parameter
|
168
|
+
- with_fixed_indentation
|
169
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
170
|
+
# But it can be overridden by setting this parameter
|
171
|
+
IndentationWidth: ~
|
172
|
+
|
173
|
+
Style/ArrayCoercion:
|
174
|
+
Description: >-
|
175
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
176
|
+
with a variable you want to treat as an Array, but you are not certain it is an array.
|
177
|
+
StyleGuide: '#array-coercion'
|
178
|
+
Safe: false
|
179
|
+
Enabled: false
|
180
|
+
VersionAdded: '0.88'
|
181
|
+
|
182
|
+
Style/AndOr:
|
183
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
184
|
+
# or completely (always).
|
185
|
+
EnforcedStyle: always
|
186
|
+
SupportedStyles:
|
187
|
+
- always
|
188
|
+
- conditionals
|
189
|
+
|
190
|
+
Style/AsciiComments:
|
191
|
+
Enabled: false
|
192
|
+
|
193
|
+
# Checks if usage of %() or %Q() matches configuration.
|
194
|
+
Style/BarePercentLiterals:
|
195
|
+
EnforcedStyle: bare_percent
|
196
|
+
SupportedStyles:
|
197
|
+
- percent_q
|
198
|
+
- bare_percent
|
199
|
+
|
200
|
+
Style/BlockDelimiters:
|
201
|
+
EnforcedStyle: line_count_based
|
202
|
+
SupportedStyles:
|
203
|
+
# The `line_count_based` style enforces braces around single line blocks and
|
204
|
+
# do..end around multi-line blocks.
|
205
|
+
- line_count_based
|
206
|
+
# The `semantic` style enforces braces around functional blocks, where the
|
207
|
+
# primary purpose of the block is to return a value and do..end for
|
208
|
+
# procedural blocks, where the primary purpose of the block is its
|
209
|
+
# side-effects.
|
210
|
+
#
|
211
|
+
# This looks at the usage of a block's method to determine its type (e.g. is
|
212
|
+
# the result of a `map` assigned to a variable or passed to another
|
213
|
+
# method) but exceptions are permitted in the `ProceduralMethods`,
|
214
|
+
# `FunctionalMethods` and `AllowedMethods` sections below.
|
215
|
+
- semantic
|
216
|
+
# The `braces_for_chaining` style enforces braces around single line blocks
|
217
|
+
# and do..end around multi-line blocks, except for multi-line blocks whose
|
218
|
+
# return value is being chained with another method (in which case braces
|
219
|
+
# are enforced).
|
220
|
+
- braces_for_chaining
|
221
|
+
ProceduralMethods:
|
222
|
+
# Methods that are known to be procedural in nature but look functional from
|
223
|
+
# their usage, e.g.
|
224
|
+
#
|
225
|
+
# time = Benchmark.realtime do
|
226
|
+
# foo.bar
|
227
|
+
# end
|
228
|
+
#
|
229
|
+
# Here, the return value of the block is discarded but the return value of
|
230
|
+
# `Benchmark.realtime` is used.
|
231
|
+
- benchmark
|
232
|
+
- bm
|
233
|
+
- bmbm
|
234
|
+
- create
|
235
|
+
- each_with_object
|
236
|
+
- measure
|
237
|
+
- new
|
238
|
+
- realtime
|
239
|
+
- tap
|
240
|
+
- with_object
|
241
|
+
FunctionalMethods:
|
242
|
+
# Methods that are known to be functional in nature but look procedural from
|
243
|
+
# their usage, e.g.
|
244
|
+
#
|
245
|
+
# let(:foo) { Foo.new }
|
246
|
+
#
|
247
|
+
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
248
|
+
# does not appear to be used from the return value of `let`.
|
249
|
+
- let
|
250
|
+
- let!
|
251
|
+
- subject
|
252
|
+
- watch
|
253
|
+
AllowedMethods:
|
254
|
+
# Methods that can be either procedural or functional and cannot be
|
255
|
+
# categorised from their usage alone, e.g.
|
256
|
+
#
|
257
|
+
# foo = lambda do |x|
|
258
|
+
# puts "Hello, #{x}"
|
259
|
+
# end
|
260
|
+
#
|
261
|
+
# foo = lambda do |x|
|
262
|
+
# x * 100
|
263
|
+
# end
|
264
|
+
#
|
265
|
+
# Here, it is impossible to tell from the return value of `lambda` whether
|
266
|
+
# the inner block's return value is significant.
|
267
|
+
- lambda
|
268
|
+
- proc
|
269
|
+
- it
|
270
|
+
|
271
|
+
Style/ExplicitBlockArgument:
|
272
|
+
Enabled: false
|
273
|
+
|
274
|
+
Style/HashEachMethods:
|
275
|
+
Enabled: false
|
276
|
+
|
277
|
+
Style/HashLikeCase:
|
278
|
+
MinBranchesCount: 5
|
279
|
+
|
280
|
+
# Indentation of `when`.
|
281
|
+
Layout/CaseIndentation:
|
282
|
+
EnforcedStyle: case
|
283
|
+
SupportedStyles:
|
284
|
+
- case
|
285
|
+
- end
|
286
|
+
IndentOneStep: false
|
287
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
288
|
+
# But it can be overridden by setting this parameter
|
289
|
+
# This only matters if IndentOneStep is true
|
290
|
+
IndentationWidth: ~
|
291
|
+
|
292
|
+
Style/ClassAndModuleChildren:
|
293
|
+
Enabled: false
|
294
|
+
# Checks the style of children definitions at classes and modules.
|
295
|
+
#
|
296
|
+
# Basically there are two different styles:
|
297
|
+
#
|
298
|
+
# `nested` - have each child on a separate line
|
299
|
+
# class Foo
|
300
|
+
# class Bar
|
301
|
+
# end
|
302
|
+
# end
|
303
|
+
#
|
304
|
+
# `compact` - combine definitions as much as possible
|
305
|
+
# class Foo::Bar
|
306
|
+
# end
|
307
|
+
#
|
308
|
+
# The compact style is only forced, for classes / modules with one child.
|
309
|
+
EnforcedStyle: nested
|
310
|
+
SupportedStyles:
|
311
|
+
- nested
|
312
|
+
- compact
|
313
|
+
|
314
|
+
Style/ClassCheck:
|
315
|
+
EnforcedStyle: is_a?
|
316
|
+
SupportedStyles:
|
317
|
+
- is_a?
|
318
|
+
- kind_of?
|
319
|
+
|
320
|
+
# Align with the style guide.
|
321
|
+
Style/CollectionMethods:
|
322
|
+
# Mapping from undesired method to desired_method
|
323
|
+
# e.g. to use `detect` over `find`:
|
324
|
+
#
|
325
|
+
# CollectionMethods:
|
326
|
+
# PreferredMethods:
|
327
|
+
# find: detect
|
328
|
+
PreferredMethods:
|
329
|
+
collect: "map"
|
330
|
+
collect!: "map!"
|
331
|
+
inject: "reduce"
|
332
|
+
detect: "find"
|
333
|
+
find_all: "select"
|
334
|
+
|
335
|
+
# Use ` or %x around command literals.
|
336
|
+
Style/CommandLiteral:
|
337
|
+
EnforcedStyle: backticks
|
338
|
+
# backticks: Always use backticks.
|
339
|
+
# percent_x: Always use %x.
|
340
|
+
# mixed: Use backticks on single-line commands, and %x on multi-line commands.
|
341
|
+
SupportedStyles:
|
342
|
+
- backticks
|
343
|
+
- percent_x
|
344
|
+
- mixed
|
345
|
+
# If false, the cop will always recommend using %x if one or more backticks
|
346
|
+
# are found in the command string.
|
347
|
+
AllowInnerBackticks: false
|
348
|
+
|
349
|
+
# Checks formatting of special comments
|
350
|
+
Style/CommentAnnotation:
|
351
|
+
Keywords:
|
352
|
+
- TODO
|
353
|
+
- FIXME
|
354
|
+
- OPTIMIZE
|
355
|
+
- HACK
|
356
|
+
- REVIEW
|
357
|
+
|
358
|
+
Style/ConditionalAssignment:
|
359
|
+
EnforcedStyle: assign_to_condition
|
360
|
+
SupportedStyles:
|
361
|
+
- assign_to_condition
|
362
|
+
- assign_inside_condition
|
363
|
+
# When configured to `assign_to_condition`, `SingleLineConditionsOnly`
|
364
|
+
# will only register an offense when all branches of a condition are
|
365
|
+
# a single line.
|
366
|
+
# When configured to `assign_inside_condition`, `SingleLineConditionsOnly`
|
367
|
+
# will only register an offense for assignment to a condition that has
|
368
|
+
# at least one multiline branch.
|
369
|
+
SingleLineConditionsOnly: true
|
370
|
+
|
371
|
+
# Checks that you have put a copyright in a comment before any code.
|
372
|
+
#
|
373
|
+
# You can override the default Notice in your .rubocop.yml file.
|
374
|
+
#
|
375
|
+
# In order to use autocorrect, you must supply a value for the
|
376
|
+
# AutocorrectNotice key that matches the regexp Notice. A blank
|
377
|
+
# AutocorrectNotice will cause an error during autocorrect.
|
378
|
+
#
|
379
|
+
# Autocorrect will add a copyright notice in a comment at the top
|
380
|
+
# of the file immediately after any shebang or encoding comments.
|
381
|
+
#
|
382
|
+
# Example rubocop.yml:
|
383
|
+
#
|
384
|
+
# Style/Copyright:
|
385
|
+
# Enabled: true
|
386
|
+
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
387
|
+
# AutocorrectNotice: "# Copyright (c) 2015 Yahoo! Inc."
|
388
|
+
#
|
389
|
+
Style/Copyright:
|
390
|
+
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
391
|
+
AutocorrectNotice: ""
|
392
|
+
|
393
|
+
Style/DocumentationMethod:
|
394
|
+
RequireForNonPublicMethods: false
|
395
|
+
|
396
|
+
# Multi-line method chaining should be done with leading dots.
|
397
|
+
Layout/DotPosition:
|
398
|
+
EnforcedStyle: leading
|
399
|
+
SupportedStyles:
|
400
|
+
- leading
|
401
|
+
- trailing
|
402
|
+
|
403
|
+
# Warn on empty else statements
|
404
|
+
# empty - warn only on empty else
|
405
|
+
# nil - warn on else with nil in it
|
406
|
+
# both - warn on empty else and else with nil in it
|
407
|
+
Style/EmptyElse:
|
408
|
+
EnforcedStyle: both
|
409
|
+
SupportedStyles:
|
410
|
+
- empty
|
411
|
+
- nil
|
412
|
+
- both
|
413
|
+
|
414
|
+
# Use empty lines between defs.
|
415
|
+
Layout/EmptyLineBetweenDefs:
|
416
|
+
# If true, this parameter means that single line method definitions do not
|
417
|
+
# need an empty line between them.
|
418
|
+
AllowAdjacentOneLineDefs: false
|
419
|
+
|
420
|
+
Layout/EmptyLineAfterMagicComment:
|
421
|
+
Exclude:
|
422
|
+
- db/migrate/*.rb
|
423
|
+
|
424
|
+
Layout/EmptyLinesAroundBlockBody:
|
425
|
+
EnforcedStyle: no_empty_lines
|
426
|
+
SupportedStyles:
|
427
|
+
- empty_lines
|
428
|
+
- no_empty_lines
|
429
|
+
|
430
|
+
Layout/EmptyLinesAroundClassBody:
|
431
|
+
EnforcedStyle: no_empty_lines
|
432
|
+
SupportedStyles:
|
433
|
+
- empty_lines
|
434
|
+
- no_empty_lines
|
435
|
+
|
436
|
+
Layout/EmptyLinesAroundModuleBody:
|
437
|
+
EnforcedStyle: no_empty_lines
|
438
|
+
SupportedStyles:
|
439
|
+
- empty_lines
|
440
|
+
- no_empty_lines
|
441
|
+
|
442
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
443
|
+
# AutoCorrectEncodingComment must match the regex
|
444
|
+
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
445
|
+
Style/Encoding:
|
446
|
+
Enabled: true
|
447
|
+
|
448
|
+
Layout/ExtraSpacing:
|
449
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
450
|
+
# things with the previous or next line, not counting empty lines or comment
|
451
|
+
# lines.
|
452
|
+
AllowForAlignment: false
|
453
|
+
# When true, forces the alignment of = in assignments on consecutive lines.
|
454
|
+
ForceEqualSignAlignment: false
|
455
|
+
|
456
|
+
Naming/FileName:
|
457
|
+
Exclude:
|
458
|
+
- "**/Capfile"
|
459
|
+
- "**/Gemfile"
|
460
|
+
- "**/Rakefile"
|
461
|
+
- "**/*.gemspec"
|
462
|
+
# When true, requires that each source file should define a class or module
|
463
|
+
# with a name which matches the file name (converted to ... case).
|
464
|
+
# It further expects it to be nested inside modules which match the names
|
465
|
+
# of subdirectories in its path.
|
466
|
+
ExpectMatchingDefinition: false
|
467
|
+
# If non-nil, expect all source file names to match the following regex.
|
468
|
+
# Only the file name itself is matched, not the entire file path.
|
469
|
+
# Use anchors as necessary if you want to match the entire name rather than
|
470
|
+
# just a part of it.
|
471
|
+
Regex: ~
|
472
|
+
# With `IgnoreExecutableScripts` set to `true`, this cop does not
|
473
|
+
# report offending filenames for executable scripts (i.e. source
|
474
|
+
# files with a shebang in the first line).
|
475
|
+
IgnoreExecutableScripts: true
|
476
|
+
|
477
|
+
Layout/FirstArgumentIndentation:
|
478
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
479
|
+
SupportedStyles:
|
480
|
+
# The first parameter should always be indented one step more than the
|
481
|
+
# preceding line.
|
482
|
+
- consistent
|
483
|
+
# The first parameter should normally be indented one step more than the
|
484
|
+
# preceding line, but if it is a parameter for a method call that is itself
|
485
|
+
# a parameter in a method call, then the inner parameter should be indented
|
486
|
+
# relative to the inner method.
|
487
|
+
- special_for_inner_method_call
|
488
|
+
# Same as special_for_inner_method_call except that the special rule only
|
489
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
490
|
+
- special_for_inner_method_call_in_parentheses
|
491
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
492
|
+
# But it can be overridden by setting this parameter
|
493
|
+
IndentationWidth: ~
|
494
|
+
|
495
|
+
# Checks use of for or each in multiline loops.
|
496
|
+
Style/For:
|
497
|
+
EnforcedStyle: each
|
498
|
+
SupportedStyles:
|
499
|
+
- for
|
500
|
+
- each
|
501
|
+
|
502
|
+
# Enforce the method used for string formatting.
|
503
|
+
Style/FormatString:
|
504
|
+
EnforcedStyle: format
|
505
|
+
SupportedStyles:
|
506
|
+
- format
|
507
|
+
- sprintf
|
508
|
+
- percent
|
509
|
+
|
510
|
+
Style/FormatStringToken:
|
511
|
+
EnforcedStyle: template
|
512
|
+
|
513
|
+
Style/FrozenStringLiteralComment:
|
514
|
+
EnforcedStyle: always
|
515
|
+
SupportedStyles:
|
516
|
+
- never
|
517
|
+
# `always` will always add the frozen string literal comment to a file
|
518
|
+
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
519
|
+
# string literal. If you run code against multiple versions of Ruby, it is
|
520
|
+
# possible that this will create errors in Ruby 2.3.0+.
|
521
|
+
- always
|
522
|
+
|
523
|
+
# Built-in global variables are allowed by default.
|
524
|
+
Style/GlobalVars:
|
525
|
+
AllowedVariables: []
|
526
|
+
|
527
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
528
|
+
# needs to have to trigger this cop
|
529
|
+
Style/GuardClause:
|
530
|
+
MinBodyLength: 6
|
531
|
+
|
532
|
+
Style/HashSyntax:
|
533
|
+
EnforcedStyle: ruby19
|
534
|
+
SupportedStyles:
|
535
|
+
# checks for 1.9 syntax (e.g. {a: 1}) for all symbol keys
|
536
|
+
- ruby19
|
537
|
+
# checks for hash rocket syntax for all hashes
|
538
|
+
- hash_rockets
|
539
|
+
# forbids mixed key syntaxes (e.g. {a: 1, :b => 2})
|
540
|
+
- no_mixed_keys
|
541
|
+
# enforces both ruby19 and no_mixed_keys styles
|
542
|
+
- ruby19_no_mixed_keys
|
543
|
+
# Force hashes that have a symbol value to use hash rockets
|
544
|
+
UseHashRocketsWithSymbolValues: false
|
545
|
+
# Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
|
546
|
+
PreferHashRocketsForNonAlnumEndingSymbols: false
|
547
|
+
|
548
|
+
Layout/IndentationConsistency:
|
549
|
+
# The difference between `rails` and `normal` is that the `rails` style
|
550
|
+
# prescribes that in classes and modules the `protected` and `private`
|
551
|
+
# modifier keywords shall be indented the same as public methods and that
|
552
|
+
# protected and private members shall be indented one step more than the
|
553
|
+
# modifiers. Other than that, both styles mean that entities on the same
|
554
|
+
# logical depth shall have the same indentation.
|
555
|
+
EnforcedStyle: normal
|
556
|
+
SupportedStyles:
|
557
|
+
- normal
|
558
|
+
- rails
|
559
|
+
|
560
|
+
Layout/IndentationWidth:
|
561
|
+
# Number of spaces for each indentation level.
|
562
|
+
Width: 2
|
563
|
+
|
564
|
+
# Checks the indentation of the first element in an array literal.
|
565
|
+
Layout/FirstArrayElementIndentation:
|
566
|
+
# The value `special_inside_parentheses` means that array literals with
|
567
|
+
# brackets that have their opening bracket on the same line as a surrounding
|
568
|
+
# opening round parenthesis, shall have their first element indented relative
|
569
|
+
# to the first position inside the parenthesis.
|
570
|
+
#
|
571
|
+
# The value `consistent` means that the indentation of the first element shall
|
572
|
+
# always be relative to the first position of the line where the opening
|
573
|
+
# bracket is.
|
574
|
+
#
|
575
|
+
# The value `align_brackets` means that the indentation of the first element
|
576
|
+
# shall always be relative to the position of the opening bracket.
|
577
|
+
EnforcedStyle: special_inside_parentheses
|
578
|
+
SupportedStyles:
|
579
|
+
- special_inside_parentheses
|
580
|
+
- consistent
|
581
|
+
- align_brackets
|
582
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
583
|
+
# But it can be overridden by setting this parameter
|
584
|
+
IndentationWidth: ~
|
585
|
+
|
586
|
+
# Checks the indentation of assignment RHS, when on a different line from LHS
|
587
|
+
Layout/AssignmentIndentation:
|
588
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
589
|
+
# But it can be overridden by setting this parameter
|
590
|
+
IndentationWidth: ~
|
591
|
+
|
592
|
+
# Checks the indentation of the first key in a hash literal.
|
593
|
+
Layout/FirstHashElementIndentation:
|
594
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
595
|
+
# that have their opening brace on the same line as a surrounding opening
|
596
|
+
# round parenthesis, shall have their first key indented relative to the
|
597
|
+
# first position inside the parenthesis.
|
598
|
+
#
|
599
|
+
# The value `consistent` means that the indentation of the first key shall
|
600
|
+
# always be relative to the first position of the line where the opening
|
601
|
+
# brace is.
|
602
|
+
#
|
603
|
+
# The value `align_braces` means that the indentation of the first key shall
|
604
|
+
# always be relative to the position of the opening brace.
|
605
|
+
EnforcedStyle: special_inside_parentheses
|
606
|
+
SupportedStyles:
|
607
|
+
- special_inside_parentheses
|
608
|
+
- consistent
|
609
|
+
- align_braces
|
610
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
611
|
+
# But it can be overridden by setting this parameter
|
612
|
+
IndentationWidth: ~
|
613
|
+
|
614
|
+
Style/Lambda:
|
615
|
+
EnforcedStyle: line_count_dependent
|
616
|
+
SupportedStyles:
|
617
|
+
- line_count_dependent
|
618
|
+
- lambda
|
619
|
+
- literal
|
620
|
+
Exclude:
|
621
|
+
- "**/types/**/*"
|
622
|
+
- "**/*_interface.rb"
|
623
|
+
|
624
|
+
Style/LambdaCall:
|
625
|
+
EnforcedStyle: call
|
626
|
+
SupportedStyles:
|
627
|
+
- call
|
628
|
+
- braces
|
629
|
+
|
630
|
+
Style/Next:
|
631
|
+
# With `always` all conditions at the end of an iteration needs to be
|
632
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
633
|
+
# are ignored: [1, 2].each { |a| return "yes" if a == 1 }
|
634
|
+
EnforcedStyle: skip_modifier_ifs
|
635
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
636
|
+
# needs to have to trigger this cop
|
637
|
+
MinBodyLength: 3
|
638
|
+
SupportedStyles:
|
639
|
+
- skip_modifier_ifs
|
640
|
+
- always
|
641
|
+
|
642
|
+
Style/NonNilCheck:
|
643
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
644
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
645
|
+
# **usually** OK, but might change behavior.
|
646
|
+
#
|
647
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
648
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
649
|
+
IncludeSemanticChanges: false
|
650
|
+
|
651
|
+
Style/NumericPredicate:
|
652
|
+
EnforcedStyle: predicate
|
653
|
+
SupportedStyles:
|
654
|
+
- predicate
|
655
|
+
- comparison
|
656
|
+
|
657
|
+
Style/MethodDefParentheses:
|
658
|
+
EnforcedStyle: require_parentheses
|
659
|
+
SupportedStyles:
|
660
|
+
- require_parentheses
|
661
|
+
- require_no_parentheses
|
662
|
+
- require_no_parentheses_except_multiline
|
663
|
+
|
664
|
+
Naming/MethodName:
|
665
|
+
EnforcedStyle: snake_case
|
666
|
+
SupportedStyles:
|
667
|
+
- snake_case
|
668
|
+
- camelCase
|
669
|
+
|
670
|
+
Style/ModuleFunction:
|
671
|
+
EnforcedStyle: module_function
|
672
|
+
SupportedStyles:
|
673
|
+
- module_function
|
674
|
+
- extend_self
|
675
|
+
|
676
|
+
Layout/MultilineArrayBraceLayout:
|
677
|
+
EnforcedStyle: symmetrical
|
678
|
+
SupportedStyles:
|
679
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
680
|
+
# new_line: closing brace is always on a new line
|
681
|
+
# same_line: closing brace is always on the same line as last element
|
682
|
+
- symmetrical
|
683
|
+
- new_line
|
684
|
+
- same_line
|
685
|
+
|
686
|
+
Layout/MultilineAssignmentLayout:
|
687
|
+
# The types of assignments which are subject to this rule.
|
688
|
+
SupportedTypes:
|
689
|
+
- block
|
690
|
+
- case
|
691
|
+
- class
|
692
|
+
- if
|
693
|
+
- kwbegin
|
694
|
+
- module
|
695
|
+
EnforcedStyle: new_line
|
696
|
+
SupportedStyles:
|
697
|
+
# Ensures that the assignment operator and the rhs are on the same line for
|
698
|
+
# the set of supported types.
|
699
|
+
- same_line
|
700
|
+
# Ensures that the assignment operator and the rhs are on separate lines
|
701
|
+
# for the set of supported types.
|
702
|
+
- new_line
|
703
|
+
|
704
|
+
Layout/MultilineHashBraceLayout:
|
705
|
+
EnforcedStyle: symmetrical
|
706
|
+
SupportedStyles:
|
707
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
708
|
+
# new_line: closing brace is always on a new line
|
709
|
+
# same_line: closing brace is always on same line as last element
|
710
|
+
- symmetrical
|
711
|
+
- new_line
|
712
|
+
- same_line
|
713
|
+
|
714
|
+
Layout/MultilineMethodCallBraceLayout:
|
715
|
+
EnforcedStyle: symmetrical
|
716
|
+
SupportedStyles:
|
717
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
718
|
+
# new_line: closing brace is always on a new line
|
719
|
+
# same_line: closing brace is always on the same line as last argument
|
720
|
+
- symmetrical
|
721
|
+
- new_line
|
722
|
+
- same_line
|
723
|
+
|
724
|
+
Layout/MultilineMethodCallIndentation:
|
725
|
+
EnforcedStyle: aligned
|
726
|
+
SupportedStyles:
|
727
|
+
- aligned
|
728
|
+
- indented
|
729
|
+
- indented_relative_to_receiver
|
730
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
731
|
+
# But it can be overridden by setting this parameter
|
732
|
+
IndentationWidth: ~
|
733
|
+
|
734
|
+
Layout/MultilineMethodDefinitionBraceLayout:
|
735
|
+
EnforcedStyle: symmetrical
|
736
|
+
SupportedStyles:
|
737
|
+
# symmetrical: closing brace is positioned in same way as opening brace
|
738
|
+
# new_line: closing brace is always on a new line
|
739
|
+
# same_line: closing brace is always on the same line as last parameter
|
740
|
+
- symmetrical
|
741
|
+
- new_line
|
742
|
+
- same_line
|
743
|
+
|
744
|
+
Layout/MultilineOperationIndentation:
|
745
|
+
EnforcedStyle: aligned
|
746
|
+
SupportedStyles:
|
747
|
+
- aligned
|
748
|
+
- indented
|
749
|
+
# By default, the indentation width from Style/IndentationWidth is used
|
750
|
+
# But it can be overridden by setting this parameter
|
751
|
+
IndentationWidth: ~
|
752
|
+
|
753
|
+
Style/NumericLiterals:
|
754
|
+
MinDigits: 5
|
755
|
+
|
756
|
+
Style/NumericLiteralPrefix:
|
757
|
+
EnforcedOctalStyle: zero_with_o
|
758
|
+
SupportedOctalStyles:
|
759
|
+
- zero_with_o
|
760
|
+
- zero_only
|
761
|
+
|
762
|
+
Style/OptionHash:
|
763
|
+
# A list of parameter names that will be flagged by this cop.
|
764
|
+
SuspiciousParamNames:
|
765
|
+
- options
|
766
|
+
- opts
|
767
|
+
- args
|
768
|
+
- params
|
769
|
+
- parameters
|
770
|
+
|
771
|
+
# Allow safe assignment in conditions.
|
772
|
+
Style/ParenthesesAroundCondition:
|
773
|
+
AllowSafeAssignment: true
|
774
|
+
|
775
|
+
Style/PercentLiteralDelimiters:
|
776
|
+
PreferredDelimiters:
|
777
|
+
"%": ()
|
778
|
+
"%i": ()
|
779
|
+
"%q": ()
|
780
|
+
"%Q": ()
|
781
|
+
"%r": "{}"
|
782
|
+
"%s": ()
|
783
|
+
"%w": ()
|
784
|
+
"%W": ()
|
785
|
+
"%x": ()
|
786
|
+
|
787
|
+
Style/PercentQLiterals:
|
788
|
+
EnforcedStyle: lower_case_q
|
789
|
+
SupportedStyles:
|
790
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
791
|
+
- upper_case_q # Always use %Q
|
792
|
+
|
793
|
+
Style/SlicingWithRange:
|
794
|
+
Enabled: false
|
795
|
+
|
796
|
+
Naming/PredicateName:
|
797
|
+
# Predicate name prefixes.
|
798
|
+
NamePrefix:
|
799
|
+
- is_
|
800
|
+
- has_
|
801
|
+
- have_
|
802
|
+
# Predicate name prefixes that should be removed.
|
803
|
+
ForbiddenPrefixes:
|
804
|
+
- is_
|
805
|
+
- have_
|
806
|
+
# Predicate names which, despite having a blacklisted prefix, or no ?,
|
807
|
+
# should still be accepted
|
808
|
+
AllowedMethods:
|
809
|
+
- is_a?
|
810
|
+
# Exclude Rspec specs because there is a strong convetion to write spec
|
811
|
+
# helpers in the form of `have_something` or `be_something`.
|
812
|
+
Exclude:
|
813
|
+
- "**/spec/**/*"
|
814
|
+
- "**/test/**/*"
|
815
|
+
|
816
|
+
Style/PreferredHashMethods:
|
817
|
+
Enabled: true
|
818
|
+
EnforcedStyle: verbose
|
819
|
+
|
820
|
+
Style/DateTime:
|
821
|
+
Enabled: true
|
822
|
+
|
823
|
+
Style/Documentation:
|
824
|
+
Enabled: false
|
825
|
+
|
826
|
+
Style/RaiseArgs:
|
827
|
+
EnforcedStyle: exploded
|
828
|
+
SupportedStyles:
|
829
|
+
- compact # raise Exception.new(msg)
|
830
|
+
- exploded # raise Exception, msg
|
831
|
+
|
832
|
+
Style/RedundantReturn:
|
833
|
+
# When true allows code like `return x, y`.
|
834
|
+
AllowMultipleReturnValues: false
|
835
|
+
|
836
|
+
# Use / or %r around regular expressions.
|
837
|
+
Style/RegexpLiteral:
|
838
|
+
EnforcedStyle: slashes
|
839
|
+
# slashes: Always use slashes.
|
840
|
+
# percent_r: Always use %r.
|
841
|
+
# mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
|
842
|
+
SupportedStyles:
|
843
|
+
- slashes
|
844
|
+
- percent_r
|
845
|
+
- mixed
|
846
|
+
# If false, the cop will always recommend using %r if one or more slashes
|
847
|
+
# are found in the regexp string.
|
848
|
+
AllowInnerSlashes: false
|
849
|
+
|
850
|
+
Style/SafeNavigation:
|
851
|
+
Enabled: false
|
852
|
+
|
853
|
+
Style/Semicolon:
|
854
|
+
# Allow ; to separate several expressions on the same line.
|
855
|
+
AllowAsExpressionSeparator: false
|
856
|
+
|
857
|
+
Style/SignalException:
|
858
|
+
EnforcedStyle: only_raise
|
859
|
+
SupportedStyles:
|
860
|
+
- only_raise
|
861
|
+
- only_fail
|
862
|
+
- semantic
|
863
|
+
|
864
|
+
Style/SingleLineBlockParams:
|
865
|
+
Methods:
|
866
|
+
- reduce:
|
867
|
+
- a
|
868
|
+
- e
|
869
|
+
- inject:
|
870
|
+
- a
|
871
|
+
- e
|
872
|
+
|
873
|
+
Style/SingleLineMethods:
|
874
|
+
AllowIfMethodIsEmpty: true
|
875
|
+
|
876
|
+
Layout/SpaceBeforeFirstArg:
|
877
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
878
|
+
# things with the previous or next line, not counting empty lines or comment
|
879
|
+
# lines.
|
880
|
+
AllowForAlignment: true
|
881
|
+
|
882
|
+
Style/SpecialGlobalVars:
|
883
|
+
EnforcedStyle: use_english_names
|
884
|
+
SupportedStyles:
|
885
|
+
- use_perl_names
|
886
|
+
- use_english_names
|
887
|
+
|
888
|
+
Style/StabbyLambdaParentheses:
|
889
|
+
EnforcedStyle: require_parentheses
|
890
|
+
SupportedStyles:
|
891
|
+
- require_parentheses
|
892
|
+
- require_no_parentheses
|
893
|
+
|
894
|
+
Style/StringLiterals:
|
895
|
+
EnforcedStyle: double_quotes
|
896
|
+
SupportedStyles:
|
897
|
+
- single_quotes
|
898
|
+
- double_quotes
|
899
|
+
# If true, strings which span multiple lines using \ for continuation must
|
900
|
+
# use the same type of quotes on each line.
|
901
|
+
ConsistentQuotesInMultiline: false
|
902
|
+
|
903
|
+
Style/StringLiteralsInInterpolation:
|
904
|
+
EnforcedStyle: double_quotes
|
905
|
+
SupportedStyles:
|
906
|
+
- single_quotes
|
907
|
+
- double_quotes
|
908
|
+
|
909
|
+
Style/StringMethods:
|
910
|
+
# Mapping from undesired method to desired_method
|
911
|
+
# e.g. to use `to_sym` over `intern`:
|
912
|
+
#
|
913
|
+
# StringMethods:
|
914
|
+
# PreferredMethods:
|
915
|
+
# intern: to_sym
|
916
|
+
PreferredMethods:
|
917
|
+
intern: to_sym
|
918
|
+
|
919
|
+
Layout/SpaceAroundBlockParameters:
|
920
|
+
EnforcedStyleInsidePipes: no_space
|
921
|
+
|
922
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
923
|
+
EnforcedStyle: space
|
924
|
+
SupportedStyles:
|
925
|
+
- space
|
926
|
+
- no_space
|
927
|
+
|
928
|
+
Layout/SpaceAroundOperators:
|
929
|
+
# When true, allows most uses of extra spacing if the intent is to align
|
930
|
+
# with an operator on the previous or next line, not counting empty lines
|
931
|
+
# or comment lines.
|
932
|
+
AllowForAlignment: true
|
933
|
+
|
934
|
+
Layout/SpaceBeforeBlockBraces:
|
935
|
+
EnforcedStyle: space
|
936
|
+
SupportedStyles:
|
937
|
+
- space
|
938
|
+
- no_space
|
939
|
+
|
940
|
+
Layout/SpaceInsideBlockBraces:
|
941
|
+
EnforcedStyle: space
|
942
|
+
SupportedStyles:
|
943
|
+
- space
|
944
|
+
- no_space
|
945
|
+
# Valid values are: space, no_space
|
946
|
+
EnforcedStyleForEmptyBraces: no_space
|
947
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
948
|
+
SpaceBeforeBlockParameters: true
|
949
|
+
|
950
|
+
Layout/SpaceInsideHashLiteralBraces:
|
951
|
+
EnforcedStyle: space
|
952
|
+
EnforcedStyleForEmptyBraces: no_space
|
953
|
+
SupportedStyles:
|
954
|
+
- space
|
955
|
+
- no_space
|
956
|
+
# "compact" normally requires a space inside hash braces, with the exception
|
957
|
+
# that successive left braces or right braces are collapsed together
|
958
|
+
- compact
|
959
|
+
|
960
|
+
Layout/SpaceInsideStringInterpolation:
|
961
|
+
EnforcedStyle: no_space
|
962
|
+
SupportedStyles:
|
963
|
+
- space
|
964
|
+
- no_space
|
965
|
+
|
966
|
+
Style/AccessModifierDeclarations:
|
967
|
+
Enabled: false
|
968
|
+
|
969
|
+
Style/SymbolArray:
|
970
|
+
EnforcedStyle: brackets
|
971
|
+
SupportedStyles:
|
972
|
+
- percent
|
973
|
+
- brackets
|
974
|
+
|
975
|
+
Style/SymbolProc:
|
976
|
+
# A list of method names to be ignored by the check.
|
977
|
+
# The names should be fairly unique, otherwise you will end up ignoring lots of code.
|
978
|
+
AllowedMethods:
|
979
|
+
- respond_to
|
980
|
+
- define_method
|
981
|
+
|
982
|
+
Style/TernaryParentheses:
|
983
|
+
EnforcedStyle: require_no_parentheses
|
984
|
+
SupportedStyles:
|
985
|
+
- require_parentheses
|
986
|
+
- require_no_parentheses
|
987
|
+
AllowSafeAssignment: true
|
988
|
+
|
989
|
+
Layout/TrailingEmptyLines:
|
990
|
+
EnforcedStyle: final_newline
|
991
|
+
SupportedStyles:
|
992
|
+
- final_newline
|
993
|
+
- final_blank_line
|
994
|
+
|
995
|
+
Style/TrailingCommaInArguments:
|
996
|
+
# If `comma`, the cop requires a comma after the last argument, but only for
|
997
|
+
# parenthesized method calls where each argument is on its own line.
|
998
|
+
# If `consistent_comma`, the cop requires a comma after the last argument,
|
999
|
+
# for all parenthesized method calls with arguments.
|
1000
|
+
EnforcedStyleForMultiline: no_comma
|
1001
|
+
|
1002
|
+
Style/TrailingCommaInArrayLiteral:
|
1003
|
+
# If `comma`, the cop requires a comma after the last item in an array or
|
1004
|
+
# hash, but only when each item is on its own line.
|
1005
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1006
|
+
# non-empty array and hash literals.
|
1007
|
+
EnforcedStyleForMultiline: no_comma
|
1008
|
+
|
1009
|
+
Style/TrailingCommaInHashLiteral:
|
1010
|
+
# If `comma`, the cop requires a comma after the last item in an array or
|
1011
|
+
# hash, but only when each item is on its own line.
|
1012
|
+
# If `consistent_comma`, the cop requires a comma after the last item of all
|
1013
|
+
# non-empty array and hash literals.
|
1014
|
+
EnforcedStyleForMultiline: no_comma
|
1015
|
+
|
1016
|
+
# TrivialAccessors requires exact name matches and does not allow
|
1017
|
+
# predicated methods by default.
|
1018
|
+
Style/TrivialAccessors:
|
1019
|
+
# When set to false the cop will suggest the use of accessor methods
|
1020
|
+
# in situations like:
|
1021
|
+
#
|
1022
|
+
# def name
|
1023
|
+
# @other_name
|
1024
|
+
# end
|
1025
|
+
#
|
1026
|
+
# This way you can uncover "hidden" attributes in your code.
|
1027
|
+
ExactNameMatch: true
|
1028
|
+
AllowPredicates: true
|
1029
|
+
# Allows trivial writers that do not end in an equal sign. e.g.
|
1030
|
+
#
|
1031
|
+
# def on_exception(action)
|
1032
|
+
# @on_exception=action
|
1033
|
+
# end
|
1034
|
+
# on_exception :restart
|
1035
|
+
#
|
1036
|
+
# Commonly used in DSLs
|
1037
|
+
AllowDSLWriters: false
|
1038
|
+
IgnoreClassMethods: false
|
1039
|
+
AllowedMethods:
|
1040
|
+
- to_ary
|
1041
|
+
- to_a
|
1042
|
+
- to_c
|
1043
|
+
- to_enum
|
1044
|
+
- to_h
|
1045
|
+
- to_hash
|
1046
|
+
- to_i
|
1047
|
+
- to_int
|
1048
|
+
- to_io
|
1049
|
+
- to_open
|
1050
|
+
- to_path
|
1051
|
+
- to_proc
|
1052
|
+
- to_r
|
1053
|
+
- to_regexp
|
1054
|
+
- to_str
|
1055
|
+
- to_s
|
1056
|
+
- to_sym
|
1057
|
+
|
1058
|
+
Naming/VariableName:
|
1059
|
+
EnforcedStyle: snake_case
|
1060
|
+
SupportedStyles:
|
1061
|
+
- snake_case
|
1062
|
+
- camelCase
|
1063
|
+
|
1064
|
+
Naming/VariableNumber:
|
1065
|
+
EnforcedStyle: normalcase
|
1066
|
+
SupportedStyles:
|
1067
|
+
- snake_case
|
1068
|
+
- normalcase
|
1069
|
+
- non_integer
|
1070
|
+
|
1071
|
+
# WordArray enforces how array literals of word-like strings should be expressed.
|
1072
|
+
Style/WordArray:
|
1073
|
+
EnforcedStyle: percent
|
1074
|
+
SupportedStyles:
|
1075
|
+
# percent style: %w(word1 word2)
|
1076
|
+
- percent
|
1077
|
+
# bracket style: ["word1", "word2"]
|
1078
|
+
- brackets
|
1079
|
+
# The MinSize option causes the WordArray rule to be ignored for arrays
|
1080
|
+
# smaller than a certain size. The rule is only applied to arrays
|
1081
|
+
# whose element count is greater than or equal to MinSize.
|
1082
|
+
MinSize: 2
|
1083
|
+
# The regular expression WordRegex decides what is considered a word.
|
1084
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
|
1085
|
+
|
1086
|
+
##################### Metrics ##################################
|
1087
|
+
|
1088
|
+
Metrics/AbcSize:
|
1089
|
+
# The ABC size is a calculated magnitude, so this number can be an Integer or
|
1090
|
+
# a Float.
|
1091
|
+
Max: 15
|
1092
|
+
Enabled: false
|
1093
|
+
|
1094
|
+
Metrics/BlockLength:
|
1095
|
+
Enabled: false
|
1096
|
+
|
1097
|
+
Metrics/BlockNesting:
|
1098
|
+
Max: 3
|
1099
|
+
|
1100
|
+
Metrics/ClassLength:
|
1101
|
+
CountComments: false # count full line comments?
|
1102
|
+
Max: 100
|
1103
|
+
Enabled: false
|
1104
|
+
|
1105
|
+
Metrics/ModuleLength:
|
1106
|
+
CountComments: false # count full line comments?
|
1107
|
+
Max: 100
|
1108
|
+
Enabled: false
|
1109
|
+
|
1110
|
+
# Avoid complex methods.
|
1111
|
+
Metrics/CyclomaticComplexity:
|
1112
|
+
Max: 9
|
1113
|
+
Exclude:
|
1114
|
+
- "bin/bundle"
|
1115
|
+
- "**/*/dummy_authorization_handler.rb"
|
1116
|
+
- "**/*/permissions.rb"
|
1117
|
+
|
1118
|
+
Metrics/MethodLength:
|
1119
|
+
CountComments: false # count full line comments?
|
1120
|
+
Max: 15
|
1121
|
+
Enabled: false
|
1122
|
+
|
1123
|
+
Metrics/ParameterLists:
|
1124
|
+
Max: 5
|
1125
|
+
CountKeywordArgs: true
|
1126
|
+
|
1127
|
+
Metrics/PerceivedComplexity:
|
1128
|
+
Max: 10
|
1129
|
+
Exclude:
|
1130
|
+
- "**/*/dummy_authorization_handler.rb"
|
1131
|
+
- "**/*/permissions.rb"
|
1132
|
+
|
1133
|
+
##################### Lint ##################################
|
1134
|
+
|
1135
|
+
Lint/AmbiguousBlockAssociation:
|
1136
|
+
Enabled: true
|
1137
|
+
Exclude:
|
1138
|
+
- "**/abilities/**/*"
|
1139
|
+
|
1140
|
+
# Allow safe assignment in conditions.
|
1141
|
+
Lint/AssignmentInCondition:
|
1142
|
+
AllowSafeAssignment: true
|
1143
|
+
|
1144
|
+
Lint/ConstantDefinitionInBlock:
|
1145
|
+
Enabled: false
|
1146
|
+
|
1147
|
+
# Call super to initialize state of the parent class.
|
1148
|
+
Lint/MissingSuper:
|
1149
|
+
Enabled: false
|
1150
|
+
|
1151
|
+
# checks whether the end keywords are aligned properly for `do` `end` blocks.
|
1152
|
+
Layout/BlockAlignment:
|
1153
|
+
# The value `start_of_block` means that the `end` should be aligned with line
|
1154
|
+
# where the `do` keyword appears.
|
1155
|
+
# The value `start_of_line` means it should be aligned with the whole
|
1156
|
+
# expression's starting line.
|
1157
|
+
# The value `either` means both are allowed.
|
1158
|
+
EnforcedStyleAlignWith: either
|
1159
|
+
|
1160
|
+
# Align ends correctly.
|
1161
|
+
Layout/EndAlignment:
|
1162
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
1163
|
+
# keyword (if, while, etc.).
|
1164
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
1165
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
1166
|
+
# situations, `end` should still be aligned with the keyword.
|
1167
|
+
# The value `start_of_line` means that `end` should be aligned with the start
|
1168
|
+
# of the line which the matching keyword appears on.
|
1169
|
+
EnforcedStyleAlignWith: keyword
|
1170
|
+
AutoCorrect: false
|
1171
|
+
|
1172
|
+
Layout/DefEndAlignment:
|
1173
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
1174
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
1175
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
1176
|
+
# keyword on the same line.
|
1177
|
+
EnforcedStyleAlignWith: start_of_line
|
1178
|
+
AutoCorrect: false
|
1179
|
+
|
1180
|
+
Lint/InheritException:
|
1181
|
+
# The default base class in favour of `Exception`.
|
1182
|
+
EnforcedStyle: runtime_error
|
1183
|
+
SupportedStyles:
|
1184
|
+
- runtime_error
|
1185
|
+
- standard_error
|
1186
|
+
|
1187
|
+
Layout/LineLength:
|
1188
|
+
Max: 180
|
1189
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
1190
|
+
# containing a URI to be longer than Max.
|
1191
|
+
AllowHeredoc: true
|
1192
|
+
AllowURI: true
|
1193
|
+
URISchemes:
|
1194
|
+
- http
|
1195
|
+
- https
|
1196
|
+
Exclude:
|
1197
|
+
- "**/spec/**/*"
|
1198
|
+
|
1199
|
+
# Checks for unused block arguments
|
1200
|
+
Lint/UnusedBlockArgument:
|
1201
|
+
IgnoreEmptyBlocks: true
|
1202
|
+
AllowUnusedKeywordArguments: false
|
1203
|
+
|
1204
|
+
# Checks for unused method arguments.
|
1205
|
+
Lint/UnusedMethodArgument:
|
1206
|
+
AllowUnusedKeywordArguments: false
|
1207
|
+
IgnoreEmptyMethods: true
|