fuli_the_guard 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b8d8e3747344f74bcad6d3816564af493cded0f0a1a7fc63e9ad031b19928c88
4
+ data.tar.gz: d1e401de850b649a993c158a6dc22954247c58b2bd283c420d70a8e6f008dc85
5
+ SHA512:
6
+ metadata.gz: caa8b30160e409c3f7da0982568b52b1e64233c7717d3a07bb03bd251e621f9e5711e7c4d194909ae3c3d92eb95d0057c5954b32ebbdd75308efcf2db3fab52b
7
+ data.tar.gz: 896a50c8db5f8032740a669097b21a52a9727364a1b79d2e80251c01d40dd01e7306efc9c0d9f752cd1a811ae33dcd6423a6eaeb4df1eb89c3ab2ac9ec6e44ba
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "http://rubygems.org"
4
+ gemspec
5
+
6
+ gem "rake"
7
+
8
+ group :test do
9
+ gem "rspec", "3.8.0"
10
+ end
11
+
12
+ group :development, :test do
13
+ gem 'pry'
14
+ gem 'pry-nav'
15
+ gem 'rubocop'
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fuli_the_guard (0.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ ast (2.4.0)
10
+ coderay (1.1.2)
11
+ diff-lcs (1.3)
12
+ jaro_winkler (1.5.2)
13
+ method_source (0.8.2)
14
+ parallel (1.17.0)
15
+ parser (2.6.3.0)
16
+ ast (~> 2.4.0)
17
+ powerpack (0.1.2)
18
+ pry (0.10.4)
19
+ coderay (~> 1.1.0)
20
+ method_source (~> 0.8.1)
21
+ slop (~> 3.4)
22
+ pry-nav (0.2.4)
23
+ pry (>= 0.9.10, < 0.11.0)
24
+ rainbow (3.0.0)
25
+ rake (12.3.2)
26
+ rspec (3.8.0)
27
+ rspec-core (~> 3.8.0)
28
+ rspec-expectations (~> 3.8.0)
29
+ rspec-mocks (~> 3.8.0)
30
+ rspec-core (3.8.0)
31
+ rspec-support (~> 3.8.0)
32
+ rspec-expectations (3.8.2)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.8.0)
35
+ rspec-mocks (3.8.0)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.8.0)
38
+ rspec-support (3.8.0)
39
+ rubocop (0.62.0)
40
+ jaro_winkler (~> 1.5.1)
41
+ parallel (~> 1.10)
42
+ parser (>= 2.5, != 2.5.1.1)
43
+ powerpack (~> 0.1)
44
+ rainbow (>= 2.2.2, < 4.0)
45
+ ruby-progressbar (~> 1.7)
46
+ unicode-display_width (~> 1.4.0)
47
+ ruby-progressbar (1.10.0)
48
+ slop (3.6.0)
49
+ unicode-display_width (1.4.1)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ fuli_the_guard!
56
+ pry
57
+ pry-nav
58
+ rake
59
+ rspec (= 3.8.0)
60
+ rubocop
61
+
62
+ BUNDLED WITH
63
+ 2.0.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Cheetah
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # fuli
2
+ Respond to application errors with configurable notifiers
3
+
4
+ ### Install
5
+
6
+ ```ruby
7
+ gem install fuli
8
+ ```
9
+
10
+ ### Configuration
11
+
12
+ ```ruby
13
+ # Notifier could be any callable object that gets error param
14
+ Fuli.configure do |config|
15
+ config.logger = YourLogger
16
+ config.warn_notifiers = [
17
+ ->(error, message){ do_something_with(error, message) }]
18
+ config.error_notifiers = [
19
+ proc { |error, message| do_something_with(error, message) }]
20
+ end
21
+
22
+ # Or using class instead of proc / lambda
23
+ class SomeNotifier
24
+ class << self
25
+ def call(error, message)
26
+ # notify some service
27
+ end
28
+ end
29
+ end
30
+
31
+ Fuli.configure do |config|
32
+ config.logger = YourLogger
33
+ config.warn_notifiers = [SomeNotifier]
34
+ end
35
+ ```
36
+
37
+ ### Example
38
+
39
+ ```ruby
40
+ class Cheetah
41
+ def hunt_em
42
+ # do things
43
+ rescue => e
44
+ context_message = { custom: 'context', more: :things }
45
+ Fuli.notify_error(e, context_message)
46
+ end
47
+
48
+ def follow_em
49
+ # do more things
50
+ warn_message = 'May be something gonna brake..'
51
+ Fuli.notify_warning(warn_message)
52
+ end
53
+ end
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+ rescue LoadError
7
+ end
8
+
9
+ task(default: [:spec])
data/fuli.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("../lib/fuli/version", __FILE__)
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "fuli_the_guard"
7
+ s.version = Fuli::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.licenses = %w(MIT)
10
+ s.authors = ["Anton Magids"]
11
+ s.email = ["evnomadx@gmail.com"]
12
+ s.homepage = "https://github.com/restaurant-cheetah/fuli"
13
+ s.summary = "Respond to application errors with configurable notifiers."
14
+ s.description = "Respond to application errors with configurable notifiers."
15
+
16
+ all_files = %x(git ls-files).split("\n")
17
+ test_files = %x(git ls-files -- {test,spec,features}/*).split("\n")
18
+
19
+ s.files = all_files - test_files
20
+ s.test_files = test_files
21
+ s.require_paths = %w(lib)
22
+ end
data/lib/fuli.rb ADDED
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'fuli/config'
4
+ require 'fuli/version'
5
+
6
+ module Fuli
7
+ Error = Class.new(StandardError)
8
+
9
+ class << self
10
+ attr_writer :config
11
+
12
+ # Logs warn level and calls warn notifiers.
13
+ #
14
+ # Example:
15
+ # class Cheetah
16
+ # def hunt
17
+ # # do things
18
+ # rescue => e
19
+ # Fuli.notify_warning(e, key: :value)
20
+ # end
21
+ # end
22
+ # Arguments:
23
+ # object: Object that responds to to_s method
24
+ # object: Object that responds to inspect method
25
+ def notify_warning(error, context_message = nil)
26
+ log(error, level: :warn) do
27
+ @config.warn_notifiers&.map { |notifier| notifier.call(error, context_message) }
28
+ end
29
+ end
30
+
31
+ # Logs error level and calls error notifiers.
32
+ #
33
+ # Example:
34
+ # class Cheetah
35
+ # def hunt
36
+ # # do things
37
+ # rescue => e
38
+ # Fuli.notify_error(e, key: :value)
39
+ # end
40
+ # end
41
+ # Arguments:
42
+ # object: Object that responds to to_s method
43
+ # object: Object that responds to inspect method
44
+ def notify_error(error, context_message = nil)
45
+ log(error, level: :error) do
46
+ @config.error_notifiers&.map { |notifier| notifier.call(error, context_message) }
47
+ end
48
+ end
49
+
50
+ def log(message_or_error, level: :info)
51
+ yield if block_given?
52
+ logger.public_send(level, message_or_error)
53
+ end
54
+
55
+ def configure
56
+ yield @config = Fuli::Config.instance if block_given?
57
+ raise Fuli::Error, 'logger is a mandatory configuration' unless @config.logger
58
+ end
59
+
60
+ private
61
+
62
+ def logger
63
+ @config.logger
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fuli
4
+ class Config
5
+ attr_accessor :logger, :warn_notifiers, :error_notifiers
6
+
7
+ def initialize(config_hash = {})
8
+ self.logger = config_hash[:logger]
9
+ self.warn_notifiers = config_hash[:warn_notifiers]
10
+ self.error_notifiers = config_hash[:error_notifiers]
11
+ merge(config_hash)
12
+ end
13
+
14
+ class << self
15
+ attr_writer :instance
16
+
17
+ def instance
18
+ @instance ||= new
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def merge(config_hash)
25
+ config_hash.each_pair(&method(:set_option))
26
+ self
27
+ end
28
+
29
+ def set_option(option, value)
30
+ __send__("#{option}=", value)
31
+ rescue NoMethodError
32
+ raise Fuli::Error, "unknown config option '#{option}'"
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fuli
4
+ VERSION = '0.1.0'
5
+ end
data/rubocop.yml ADDED
@@ -0,0 +1,1201 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5.1
3
+ Exclude:
4
+ - take2.gemspec
5
+ - Rakefile
6
+ DisabledByDefault: true
7
+
8
+ Layout/AccessModifierIndentation:
9
+ EnforcedStyle: indent
10
+ SupportedStyles:
11
+ - outdent
12
+ - indent
13
+ IndentationWidth:
14
+
15
+ Style/Alias:
16
+ EnforcedStyle: prefer_alias_method
17
+ SupportedStyles:
18
+ - prefer_alias
19
+ - prefer_alias_method
20
+
21
+ Layout/AlignHash:
22
+ EnforcedHashRocketStyle: key
23
+ EnforcedColonStyle: key
24
+ EnforcedLastArgumentHashStyle: ignore_implicit
25
+ SupportedLastArgumentHashStyles:
26
+ - always_inspect
27
+ - always_ignore
28
+ - ignore_implicit
29
+ - ignore_explicit
30
+
31
+ Layout/AlignParameters:
32
+ EnforcedStyle: with_fixed_indentation
33
+ SupportedStyles:
34
+ - with_first_parameter
35
+ - with_fixed_indentation
36
+ IndentationWidth:
37
+
38
+ Style/AndOr:
39
+ EnforcedStyle: always
40
+ SupportedStyles:
41
+ - always
42
+ - conditionals
43
+
44
+ Style/BarePercentLiterals:
45
+ EnforcedStyle: bare_percent
46
+ SupportedStyles:
47
+ - percent_q
48
+ - bare_percent
49
+
50
+ Style/BlockDelimiters:
51
+ EnforcedStyle: line_count_based
52
+ SupportedStyles:
53
+ - line_count_based
54
+ - semantic
55
+ - braces_for_chaining
56
+ ProceduralMethods:
57
+ - benchmark
58
+ - bm
59
+ - bmbm
60
+ - create
61
+ - each_with_object
62
+ - measure
63
+ - new
64
+ - realtime
65
+ - tap
66
+ - with_object
67
+ FunctionalMethods:
68
+ - let
69
+ - let!
70
+ - subject
71
+ - watch
72
+ IgnoredMethods:
73
+ - lambda
74
+ - proc
75
+ - it
76
+
77
+ Style/BracesAroundHashParameters:
78
+ EnforcedStyle: no_braces
79
+ SupportedStyles:
80
+ - braces
81
+ - no_braces
82
+ - context_dependent
83
+
84
+ Layout/CaseIndentation:
85
+ EnforcedStyle: end
86
+ SupportedStyles:
87
+ - case
88
+ - end
89
+ IndentOneStep: false
90
+ IndentationWidth:
91
+
92
+ Style/ClassAndModuleChildren:
93
+ EnforcedStyle: nested
94
+ SupportedStyles:
95
+ - nested
96
+ - compact
97
+
98
+ Style/ClassCheck:
99
+ EnforcedStyle: is_a?
100
+ SupportedStyles:
101
+ - is_a?
102
+ - kind_of?
103
+
104
+ Style/CommandLiteral:
105
+ EnforcedStyle: percent_x
106
+ SupportedStyles:
107
+ - backticks
108
+ - percent_x
109
+ - mixed
110
+ AllowInnerBackticks: false
111
+
112
+ Style/CommentAnnotation:
113
+ Keywords:
114
+ - TODO
115
+ - FIXME
116
+ - OPTIMIZE
117
+ - HACK
118
+ - REVIEW
119
+
120
+ Style/ConditionalAssignment:
121
+ EnforcedStyle: assign_to_condition
122
+ SupportedStyles:
123
+ - assign_to_condition
124
+ - assign_inside_condition
125
+ SingleLineConditionsOnly: true
126
+
127
+ Layout/DotPosition:
128
+ EnforcedStyle: leading
129
+ SupportedStyles:
130
+ - leading
131
+ - trailing
132
+
133
+ Style/EmptyElse:
134
+ EnforcedStyle: both
135
+ SupportedStyles:
136
+ - empty
137
+ - nil
138
+ - both
139
+
140
+ Layout/EmptyLineBetweenDefs:
141
+ AllowAdjacentOneLineDefs: false
142
+
143
+ Layout/EmptyLinesAroundBlockBody:
144
+ EnforcedStyle: no_empty_lines
145
+ SupportedStyles:
146
+ - empty_lines
147
+ - no_empty_lines
148
+
149
+ Layout/EmptyLinesAroundClassBody:
150
+ EnforcedStyle: no_empty_lines
151
+ SupportedStyles:
152
+ - empty_lines
153
+ - empty_lines_except_namespace
154
+ - no_empty_lines
155
+
156
+ Layout/EmptyLinesAroundModuleBody:
157
+ EnforcedStyle: no_empty_lines
158
+ SupportedStyles:
159
+ - empty_lines
160
+ - empty_lines_except_namespace
161
+ - no_empty_lines
162
+
163
+ Layout/ExtraSpacing:
164
+ AllowForAlignment: true
165
+ ForceEqualSignAlignment: false
166
+
167
+ Naming/FileName:
168
+ Exclude: []
169
+ ExpectMatchingDefinition: false
170
+ Regex:
171
+ IgnoreExecutableScripts: true
172
+
173
+ Layout/FirstParameterIndentation:
174
+ EnforcedStyle: consistent
175
+ SupportedStyles:
176
+ - consistent
177
+ - special_for_inner_method_call
178
+ - special_for_inner_method_call_in_parentheses
179
+ IndentationWidth:
180
+
181
+ Style/For:
182
+ EnforcedStyle: each
183
+ SupportedStyles:
184
+ - for
185
+ - each
186
+
187
+ Style/FormatString:
188
+ EnforcedStyle: format
189
+ SupportedStyles:
190
+ - format
191
+ - sprintf
192
+ - percent
193
+
194
+ Style/FrozenStringLiteralComment:
195
+ Details: >-
196
+ Add `# frozen_string_literal: true` to the top of the file. Frozen string
197
+ literals will become the default in a future Ruby version, and we want to
198
+ make sure we're ready.
199
+ EnforcedStyle: when_needed
200
+ SupportedStyles:
201
+ - when_needed
202
+ - always
203
+ - never
204
+
205
+ Style/GlobalVars:
206
+ AllowedVariables: []
207
+
208
+ Style/HashSyntax:
209
+ EnforcedStyle: ruby19
210
+ SupportedStyles:
211
+ - ruby19
212
+ - hash_rockets
213
+ - no_mixed_keys
214
+ - ruby19_no_mixed_keys
215
+ UseHashRocketsWithSymbolValues: false
216
+ PreferHashRocketsForNonAlnumEndingSymbols: false
217
+
218
+ Layout/IndentationConsistency:
219
+ EnforcedStyle: normal
220
+ SupportedStyles:
221
+ - normal
222
+ - rails
223
+
224
+ Layout/IndentationWidth:
225
+ Width: 2
226
+
227
+ Layout/IndentArray:
228
+ EnforcedStyle: consistent
229
+ SupportedStyles:
230
+ - special_inside_parentheses
231
+ - consistent
232
+ - align_brackets
233
+ IndentationWidth:
234
+
235
+ Layout/IndentAssignment:
236
+ IndentationWidth:
237
+
238
+ Layout/IndentHash:
239
+ EnforcedStyle: consistent
240
+ SupportedStyles:
241
+ - special_inside_parentheses
242
+ - consistent
243
+ - align_braces
244
+ IndentationWidth:
245
+
246
+ Style/LambdaCall:
247
+ EnforcedStyle: call
248
+ SupportedStyles:
249
+ - call
250
+ - braces
251
+
252
+ Style/Next:
253
+ EnforcedStyle: skip_modifier_ifs
254
+ MinBodyLength: 3
255
+ SupportedStyles:
256
+ - skip_modifier_ifs
257
+ - always
258
+
259
+ Style/NonNilCheck:
260
+ IncludeSemanticChanges: false
261
+
262
+ Style/MethodCallWithArgsParentheses:
263
+ Enabled: true
264
+ IgnoreMacros: true
265
+ IgnoredMethods:
266
+ - require
267
+ - require_relative
268
+ - require_dependency
269
+ - yield
270
+ - raise
271
+ - puts
272
+ - error
273
+ - run
274
+ - to
275
+ - describe
276
+ - eql
277
+ Exclude:
278
+ - Gemfile
279
+
280
+ Style/MethodDefParentheses:
281
+ EnforcedStyle: require_parentheses
282
+ SupportedStyles:
283
+ - require_parentheses
284
+ - require_no_parentheses
285
+ - require_no_parentheses_except_multiline
286
+
287
+ Naming/MethodName:
288
+ EnforcedStyle: snake_case
289
+ SupportedStyles:
290
+ - snake_case
291
+ - camelCase
292
+
293
+ Layout/MultilineArrayBraceLayout:
294
+ EnforcedStyle: symmetrical
295
+ SupportedStyles:
296
+ - symmetrical
297
+ - new_line
298
+ - same_line
299
+
300
+ Layout/MultilineHashBraceLayout:
301
+ EnforcedStyle: symmetrical
302
+ SupportedStyles:
303
+ - symmetrical
304
+ - new_line
305
+ - same_line
306
+
307
+ Layout/MultilineMethodCallBraceLayout:
308
+ EnforcedStyle: symmetrical
309
+ SupportedStyles:
310
+ - symmetrical
311
+ - new_line
312
+ - same_line
313
+
314
+ Layout/MultilineMethodCallIndentation:
315
+ EnforcedStyle: indented
316
+ SupportedStyles:
317
+ - aligned
318
+ - indented
319
+ - indented_relative_to_receiver
320
+ IndentationWidth: 2
321
+
322
+ Layout/MultilineMethodDefinitionBraceLayout:
323
+ EnforcedStyle: symmetrical
324
+ SupportedStyles:
325
+ - symmetrical
326
+ - new_line
327
+ - same_line
328
+
329
+ Style/NumericLiteralPrefix:
330
+ EnforcedOctalStyle: zero_only
331
+ SupportedOctalStyles:
332
+ - zero_with_o
333
+ - zero_only
334
+
335
+ Style/ParenthesesAroundCondition:
336
+ AllowSafeAssignment: true
337
+
338
+ Style/PercentLiteralDelimiters:
339
+ PreferredDelimiters:
340
+ '%': '()'
341
+ '%i': '()'
342
+ '%q': '()'
343
+ '%Q': '()'
344
+ '%r': '{}'
345
+ '%s': '()'
346
+ '%w': '()'
347
+ '%W': '()'
348
+ '%x': '()'
349
+
350
+ Style/PercentQLiterals:
351
+ EnforcedStyle: lower_case_q
352
+ SupportedStyles:
353
+ - lower_case_q
354
+ - upper_case_q
355
+
356
+ Naming/PredicateName:
357
+ NamePrefix:
358
+ - is_
359
+ NamePrefixBlacklist:
360
+ - is_
361
+ NameWhitelist:
362
+ - is_a?
363
+ Exclude:
364
+ - 'spec/**/*'
365
+
366
+ Style/PreferredHashMethods:
367
+ EnforcedStyle: short
368
+ SupportedStyles:
369
+ - short
370
+ - verbose
371
+
372
+ Style/RaiseArgs:
373
+ EnforcedStyle: exploded
374
+ SupportedStyles:
375
+ - compact
376
+ - exploded
377
+
378
+ Style/RedundantReturn:
379
+ AllowMultipleReturnValues: false
380
+
381
+ Style/RegexpLiteral:
382
+ EnforcedStyle: mixed
383
+ SupportedStyles:
384
+ - slashes
385
+ - percent_r
386
+ - mixed
387
+ AllowInnerSlashes: false
388
+
389
+ Style/SafeNavigation:
390
+ ConvertCodeThatCanStartToReturnNil: false
391
+ Enabled: true
392
+
393
+ Lint/SafeNavigationChain:
394
+ Enabled: true
395
+
396
+ Style/Semicolon:
397
+ AllowAsExpressionSeparator: false
398
+
399
+ Style/SignalException:
400
+ EnforcedStyle: only_raise
401
+ SupportedStyles:
402
+ - only_raise
403
+ - only_fail
404
+ - semantic
405
+
406
+ Style/SingleLineMethods:
407
+ AllowIfMethodIsEmpty: true
408
+
409
+ Layout/SpaceBeforeFirstArg:
410
+ AllowForAlignment: true
411
+
412
+ Style/SpecialGlobalVars:
413
+ EnforcedStyle: use_english_names
414
+ SupportedStyles:
415
+ - use_perl_names
416
+ - use_english_names
417
+
418
+ Style/StabbyLambdaParentheses:
419
+ EnforcedStyle: require_parentheses
420
+ SupportedStyles:
421
+ - require_parentheses
422
+ - require_no_parentheses
423
+
424
+ Style/StringLiteralsInInterpolation:
425
+ EnforcedStyle: single_quotes
426
+ SupportedStyles:
427
+ - single_quotes
428
+ - double_quotes
429
+
430
+ Layout/SpaceAroundBlockParameters:
431
+ EnforcedStyleInsidePipes: no_space
432
+ SupportedStylesInsidePipes:
433
+ - space
434
+ - no_space
435
+
436
+ Layout/SpaceAroundEqualsInParameterDefault:
437
+ EnforcedStyle: space
438
+ SupportedStyles:
439
+ - space
440
+ - no_space
441
+
442
+ Layout/SpaceAroundOperators:
443
+ AllowForAlignment: true
444
+
445
+ Layout/SpaceBeforeBlockBraces:
446
+ EnforcedStyle: space
447
+ EnforcedStyleForEmptyBraces: space
448
+ SupportedStyles:
449
+ - space
450
+ - no_space
451
+
452
+ Layout/SpaceInsideBlockBraces:
453
+ EnforcedStyle: space
454
+ SupportedStyles:
455
+ - space
456
+ - no_space
457
+ EnforcedStyleForEmptyBraces: no_space
458
+ SpaceBeforeBlockParameters: true
459
+
460
+ Layout/SpaceInsideHashLiteralBraces:
461
+ EnforcedStyle: space
462
+ EnforcedStyleForEmptyBraces: no_space
463
+ SupportedStyles:
464
+ - space
465
+ - no_space
466
+ - compact
467
+
468
+ Layout/SpaceInsideStringInterpolation:
469
+ EnforcedStyle: no_space
470
+ SupportedStyles:
471
+ - space
472
+ - no_space
473
+
474
+ Style/SymbolProc:
475
+ IgnoredMethods:
476
+ - respond_to
477
+ - define_method
478
+
479
+ Style/TernaryParentheses:
480
+ EnforcedStyle: require_no_parentheses
481
+ SupportedStyles:
482
+ - require_parentheses
483
+ - require_no_parentheses
484
+ AllowSafeAssignment: true
485
+
486
+ Layout/TrailingBlankLines:
487
+ EnforcedStyle: final_newline
488
+ SupportedStyles:
489
+ - final_newline
490
+ - final_blank_line
491
+
492
+ Style/TrivialAccessors:
493
+ ExactNameMatch: true
494
+ AllowPredicates: true
495
+ AllowDSLWriters: false
496
+ IgnoreClassMethods: false
497
+ Whitelist:
498
+ - to_ary
499
+ - to_a
500
+ - to_c
501
+ - to_enum
502
+ - to_h
503
+ - to_hash
504
+ - to_i
505
+ - to_int
506
+ - to_io
507
+ - to_open
508
+ - to_path
509
+ - to_proc
510
+ - to_r
511
+ - to_regexp
512
+ - to_str
513
+ - to_s
514
+ - to_sym
515
+
516
+ Naming/VariableName:
517
+ EnforcedStyle: snake_case
518
+ SupportedStyles:
519
+ - snake_case
520
+ - camelCase
521
+
522
+ Style/WhileUntilModifier:
523
+ Enabled: true
524
+
525
+ Style/WordArray:
526
+ EnforcedStyle: percent
527
+ SupportedStyles:
528
+ - percent
529
+ - brackets
530
+ MinSize: 0
531
+ WordRegex: !ruby/regexp /\A[\p{Word}\n\t]+\z/
532
+
533
+ Metrics/BlockNesting:
534
+ Max: 3
535
+
536
+ Metrics/LineLength:
537
+ Max: 120
538
+ AllowHeredoc: true
539
+ AllowURI: true
540
+ URISchemes:
541
+ - http
542
+ - https
543
+ IgnoreCopDirectives: false
544
+ IgnoredPatterns:
545
+ - '\A\s*(remote_)?test(_\w+)?\s.*(do|->)(\s|\Z)'
546
+
547
+ Metrics/ParameterLists:
548
+ Max: 5
549
+ CountKeywordArgs: false
550
+
551
+ Layout/BlockAlignment:
552
+ EnforcedStyleAlignWith: either
553
+ SupportedStylesAlignWith:
554
+ - either
555
+ - start_of_block
556
+ - start_of_line
557
+
558
+ Layout/EndAlignment:
559
+ EnforcedStyleAlignWith: variable
560
+ SupportedStylesAlignWith:
561
+ - keyword
562
+ - variable
563
+ - start_of_line
564
+
565
+ Layout/DefEndAlignment:
566
+ EnforcedStyleAlignWith: start_of_line
567
+ SupportedStylesAlignWith:
568
+ - start_of_line
569
+ - def
570
+
571
+ Lint/InheritException:
572
+ EnforcedStyle: runtime_error
573
+ SupportedStyles:
574
+ - runtime_error
575
+ - standard_error
576
+
577
+ Lint/UnusedBlockArgument:
578
+ IgnoreEmptyBlocks: true
579
+ AllowUnusedKeywordArguments: false
580
+
581
+ Lint/UnusedMethodArgument:
582
+ AllowUnusedKeywordArguments: false
583
+ IgnoreEmptyMethods: true
584
+
585
+ Performance/RedundantMerge:
586
+ MaxKeyValuePairs: 2
587
+
588
+ Rails/ActionFilter:
589
+ EnforcedStyle: action
590
+ SupportedStyles:
591
+ - action
592
+ - filter
593
+ Include:
594
+ - app/controllers/**/*.rb
595
+
596
+ Rails/Date:
597
+ EnforcedStyle: flexible
598
+ SupportedStyles:
599
+ - strict
600
+ - flexible
601
+
602
+ Rails/DynamicFindBy:
603
+ Whitelist:
604
+ - find_by_sql
605
+
606
+ Rails/Exit:
607
+ Include:
608
+ - app/**/*.rb
609
+ - config/**/*.rb
610
+ - lib/**/*.rb
611
+ Exclude:
612
+ - 'lib/**/*.rake'
613
+
614
+ Rails/FindBy:
615
+ Include:
616
+ - app/models/**/*.rb
617
+
618
+ Rails/FindEach:
619
+ Include:
620
+ - app/models/**/*.rb
621
+
622
+ Rails/HasAndBelongsToMany:
623
+ Include:
624
+ - app/models/**/*.rb
625
+
626
+ Rails/NotNullColumn:
627
+ Include:
628
+ - db/migrate/*.rb
629
+
630
+ Rails/Output:
631
+ Include:
632
+ - app/**/*.rb
633
+ - config/**/*.rb
634
+ - db/**/*.rb
635
+ - lib/**/*.rb
636
+
637
+ Rails/ReadWriteAttribute:
638
+ Include:
639
+ - app/models/**/*.rb
640
+
641
+ Rails/RequestReferer:
642
+ EnforcedStyle: referer
643
+ SupportedStyles:
644
+ - referer
645
+ - referrer
646
+
647
+ Rails/SafeNavigation:
648
+ ConvertTry: false
649
+
650
+ Rails/ScopeArgs:
651
+ Include:
652
+ - app/models/**/*.rb
653
+
654
+ Rails/TimeZone:
655
+ EnforcedStyle: flexible
656
+ SupportedStyles:
657
+ - strict
658
+ - flexible
659
+
660
+ Rails/UniqBeforePluck:
661
+ EnforcedStyle: conservative
662
+ SupportedStyles:
663
+ - conservative
664
+ - aggressive
665
+
666
+ Rails/Validation:
667
+ Include:
668
+ - app/models/**/*.rb
669
+
670
+ Naming/AccessorMethodName:
671
+ Enabled: true
672
+
673
+ Layout/AlignArray:
674
+ Enabled: true
675
+
676
+ Style/ArrayJoin:
677
+ Enabled: true
678
+
679
+ Naming/AsciiIdentifiers:
680
+ Enabled: true
681
+
682
+ Style/Attr:
683
+ Enabled: true
684
+
685
+ Style/BeginBlock:
686
+ Enabled: true
687
+
688
+ Style/BlockComments:
689
+ Enabled: true
690
+
691
+ Layout/BlockEndNewline:
692
+ Enabled: true
693
+
694
+ Style/CaseEquality:
695
+ Enabled: true
696
+
697
+ Style/CharacterLiteral:
698
+ Enabled: true
699
+
700
+ Naming/ClassAndModuleCamelCase:
701
+ Enabled: true
702
+
703
+ Style/ClassMethods:
704
+ Enabled: true
705
+
706
+ Style/ClassVars:
707
+ Enabled: true
708
+
709
+ Layout/ClosingParenthesisIndentation:
710
+ Enabled: true
711
+
712
+ Style/ColonMethodCall:
713
+ Enabled: true
714
+
715
+ Layout/CommentIndentation:
716
+ Enabled: true
717
+
718
+ Naming/ConstantName:
719
+ Enabled: true
720
+
721
+ Style/DateTime:
722
+ Enabled: true
723
+
724
+ Style/DefWithParentheses:
725
+ Enabled: true
726
+
727
+ Style/EachForSimpleLoop:
728
+ Enabled: true
729
+
730
+ Style/EachWithObject:
731
+ Enabled: true
732
+
733
+ Layout/ElseAlignment:
734
+ Enabled: true
735
+
736
+ Style/EmptyCaseCondition:
737
+ Enabled: true
738
+
739
+ Layout/EmptyLines:
740
+ Enabled: true
741
+
742
+ Layout/EmptyLinesAroundAccessModifier:
743
+ Enabled: true
744
+
745
+ Layout/EmptyLinesAroundMethodBody:
746
+ Enabled: true
747
+
748
+ Style/EmptyLiteral:
749
+ Enabled: true
750
+
751
+ Style/EndBlock:
752
+ Enabled: true
753
+
754
+ Layout/EndOfLine:
755
+ Enabled: true
756
+
757
+ Style/EvenOdd:
758
+ Enabled: true
759
+
760
+ Layout/InitialIndentation:
761
+ Enabled: true
762
+
763
+ Style/FlipFlop:
764
+ Enabled: true
765
+
766
+ Style/IfInsideElse:
767
+ Enabled: true
768
+
769
+ Style/IfUnlessModifierOfIfUnless:
770
+ Enabled: true
771
+
772
+ Style/IfWithSemicolon:
773
+ Enabled: true
774
+
775
+ Style/IdenticalConditionalBranches:
776
+ Enabled: true
777
+
778
+ Style/InfiniteLoop:
779
+ Enabled: true
780
+
781
+ Layout/LeadingCommentSpace:
782
+ Enabled: true
783
+
784
+ Style/LineEndConcatenation:
785
+ Enabled: true
786
+
787
+ Style/MethodCallWithoutArgsParentheses:
788
+ Enabled: true
789
+
790
+ Style/MethodMissingSuper:
791
+ Enabled: true
792
+
793
+ Style/MissingRespondToMissing:
794
+ Enabled: true
795
+
796
+ Layout/MultilineBlockLayout:
797
+ Enabled: true
798
+
799
+ Style/MultilineIfThen:
800
+ Enabled: true
801
+
802
+ Style/MultilineMemoization:
803
+ Enabled: true
804
+
805
+ Style/MultilineTernaryOperator:
806
+ Enabled: true
807
+
808
+ Style/NegatedIf:
809
+ Enabled: true
810
+
811
+ Style/NegatedWhile:
812
+ Enabled: true
813
+
814
+ Style/NestedModifier:
815
+ Enabled: true
816
+
817
+ Style/NestedParenthesizedCalls:
818
+ Enabled: true
819
+
820
+ Style/NestedTernaryOperator:
821
+ Enabled: true
822
+
823
+ Style/NilComparison:
824
+ Enabled: true
825
+
826
+ Style/Not:
827
+ Enabled: true
828
+
829
+ Style/OneLineConditional:
830
+ Enabled: true
831
+
832
+ Naming/BinaryOperatorParameterName:
833
+ Enabled: true
834
+
835
+ Style/OptionalArguments:
836
+ Enabled: true
837
+
838
+ Style/ParallelAssignment:
839
+ Enabled: true
840
+
841
+ Style/PerlBackrefs:
842
+ Enabled: true
843
+
844
+ Style/Proc:
845
+ Enabled: true
846
+
847
+ Style/RedundantBegin:
848
+ Enabled: false
849
+
850
+ Style/RedundantException:
851
+ Enabled: true
852
+
853
+ Style/RedundantFreeze:
854
+ Enabled: true
855
+
856
+ Style/RedundantParentheses:
857
+ Enabled: true
858
+
859
+ Style/RedundantSelf:
860
+ Enabled: true
861
+
862
+ Layout/RescueEnsureAlignment:
863
+ Enabled: true
864
+
865
+ Style/RescueModifier:
866
+ Enabled: true
867
+
868
+ Style/SelfAssignment:
869
+ Enabled: true
870
+
871
+ Layout/SpaceAfterColon:
872
+ Enabled: true
873
+
874
+ Layout/SpaceAfterComma:
875
+ Enabled: true
876
+
877
+ Layout/SpaceAfterMethodName:
878
+ Enabled: true
879
+
880
+ Layout/SpaceAfterNot:
881
+ Enabled: true
882
+
883
+ Layout/SpaceAfterSemicolon:
884
+ Enabled: true
885
+
886
+ Layout/SpaceBeforeComma:
887
+ Enabled: true
888
+
889
+ Layout/SpaceBeforeComment:
890
+ Enabled: true
891
+
892
+ Layout/SpaceBeforeSemicolon:
893
+ Enabled: true
894
+
895
+ Layout/SpaceAroundKeyword:
896
+ Enabled: true
897
+
898
+ Layout/SpaceInsideArrayPercentLiteral:
899
+ Enabled: true
900
+
901
+ Layout/SpaceInsidePercentLiteralDelimiters:
902
+ Enabled: true
903
+
904
+ Layout/SpaceInsideArrayLiteralBrackets:
905
+ Enabled: true
906
+
907
+ Layout/SpaceInsideParens:
908
+ Enabled: true
909
+
910
+ Layout/SpaceInsideRangeLiteral:
911
+ Enabled: true
912
+
913
+ Style/SymbolLiteral:
914
+ Enabled: true
915
+
916
+ Layout/Tab:
917
+ Enabled: true
918
+
919
+ Layout/TrailingWhitespace:
920
+ Enabled: true
921
+
922
+ Style/UnlessElse:
923
+ Enabled: true
924
+
925
+ Style/UnneededCapitalW:
926
+ Enabled: true
927
+
928
+ Style/UnneededInterpolation:
929
+ Enabled: true
930
+
931
+ Style/UnneededPercentQ:
932
+ Enabled: true
933
+
934
+ Style/VariableInterpolation:
935
+ Enabled: true
936
+
937
+ Style/WhenThen:
938
+ Enabled: true
939
+
940
+ Style/WhileUntilDo:
941
+ Enabled: true
942
+
943
+ Style/ZeroLengthPredicate:
944
+ Enabled: true
945
+
946
+ Layout/IndentHeredoc:
947
+ EnforcedStyle: squiggly
948
+
949
+ Lint/AmbiguousOperator:
950
+ Enabled: true
951
+
952
+ Lint/AmbiguousRegexpLiteral:
953
+ Enabled: true
954
+
955
+ Lint/CircularArgumentReference:
956
+ Enabled: true
957
+
958
+ Layout/ConditionPosition:
959
+ Enabled: true
960
+
961
+ Lint/Debugger:
962
+ Enabled: true
963
+
964
+ Lint/DeprecatedClassMethods:
965
+ Enabled: true
966
+
967
+ Lint/DuplicateMethods:
968
+ Enabled: true
969
+
970
+ Lint/DuplicatedKey:
971
+ Enabled: true
972
+
973
+ Lint/EachWithObjectArgument:
974
+ Enabled: true
975
+
976
+ Lint/ElseLayout:
977
+ Enabled: true
978
+
979
+ Lint/EmptyEnsure:
980
+ Enabled: true
981
+
982
+ Lint/EmptyInterpolation:
983
+ Enabled: true
984
+
985
+ Lint/EndInMethod:
986
+ Enabled: true
987
+
988
+ Lint/EnsureReturn:
989
+ Enabled: true
990
+
991
+ Lint/FloatOutOfRange:
992
+ Enabled: true
993
+
994
+ Lint/FormatParameterMismatch:
995
+ Enabled: true
996
+
997
+ Lint/HandleExceptions:
998
+ Enabled: true
999
+
1000
+ Lint/ImplicitStringConcatenation:
1001
+ Description: Checks for adjacent string literals on the same line, which could
1002
+ better be represented as a single string literal.
1003
+
1004
+ Lint/IneffectiveAccessModifier:
1005
+ Description: Checks for attempts to use `private` or `protected` to set the visibility
1006
+ of a class method, which does not work.
1007
+
1008
+ Lint/LiteralAsCondition:
1009
+ Enabled: true
1010
+
1011
+ Lint/LiteralInInterpolation:
1012
+ Enabled: true
1013
+
1014
+ Lint/Loop:
1015
+ Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
1016
+ for post-loop tests.
1017
+
1018
+ Lint/NestedMethodDefinition:
1019
+ Enabled: true
1020
+
1021
+ Lint/NextWithoutAccumulator:
1022
+ Description: Do not omit the accumulator when calling `next` in a `reduce`/`inject`
1023
+ block.
1024
+
1025
+ Lint/NonLocalExitFromIterator:
1026
+ Enabled: true
1027
+
1028
+ Lint/ParenthesesAsGroupedExpression:
1029
+ Enabled: true
1030
+
1031
+ Lint/PercentStringArray:
1032
+ Enabled: true
1033
+
1034
+ Lint/PercentSymbolArray:
1035
+ Enabled: true
1036
+
1037
+ Lint/RandOne:
1038
+ Description: Checks for `rand(1)` calls. Such calls always return `0` and most
1039
+ likely a mistake.
1040
+
1041
+ Lint/RequireParentheses:
1042
+ Enabled: true
1043
+
1044
+ Lint/RescueException:
1045
+ Enabled: true
1046
+
1047
+ Lint/ShadowedException:
1048
+ Enabled: true
1049
+
1050
+ Lint/ShadowingOuterLocalVariable:
1051
+ Enabled: true
1052
+
1053
+ Lint/StringConversionInInterpolation:
1054
+ Enabled: true
1055
+
1056
+ Lint/UnderscorePrefixedVariableName:
1057
+ Enabled: true
1058
+
1059
+ Lint/UnifiedInteger:
1060
+ Enabled: true
1061
+
1062
+ Lint/UnneededCopDisableDirective:
1063
+ Enabled: true
1064
+
1065
+ Lint/UnneededCopEnableDirective:
1066
+ Enabled: true
1067
+
1068
+ Lint/UnneededSplatExpansion:
1069
+ Enabled: true
1070
+
1071
+ Lint/UnreachableCode:
1072
+ Enabled: true
1073
+
1074
+ Lint/UselessAccessModifier:
1075
+ ContextCreatingMethods: []
1076
+
1077
+ Lint/UselessAssignment:
1078
+ Enabled: true
1079
+
1080
+ Lint/UselessComparison:
1081
+ Enabled: true
1082
+
1083
+ Lint/UselessElseWithoutRescue:
1084
+ Enabled: true
1085
+
1086
+ Lint/UselessSetterCall:
1087
+ Enabled: true
1088
+
1089
+ Lint/Void:
1090
+ Enabled: true
1091
+
1092
+ Performance/CaseWhenSplat:
1093
+ Enabled: true
1094
+
1095
+ Performance/Count:
1096
+ SafeMode: true
1097
+
1098
+ Performance/Detect:
1099
+ SafeMode: true
1100
+
1101
+ Performance/DoubleStartEndWith:
1102
+ Enabled: true
1103
+
1104
+ Performance/EndWith:
1105
+ Enabled: true
1106
+
1107
+ Performance/FixedSize:
1108
+ Enabled: true
1109
+
1110
+ Performance/FlatMap:
1111
+ EnabledForFlattenWithoutParams: false
1112
+
1113
+ Performance/LstripRstrip:
1114
+ Enabled: true
1115
+
1116
+ Performance/RangeInclude:
1117
+ Enabled: true
1118
+
1119
+ Performance/RedundantBlockCall:
1120
+ Enabled: true
1121
+
1122
+ Performance/RedundantMatch:
1123
+ Enabled: true
1124
+
1125
+ Performance/RedundantSortBy:
1126
+ Enabled: true
1127
+
1128
+ Performance/RegexpMatch:
1129
+ Enabled: true
1130
+
1131
+ Performance/ReverseEach:
1132
+ Enabled: true
1133
+
1134
+ Performance/Sample:
1135
+ Enabled: true
1136
+
1137
+ Performance/Size:
1138
+ Enabled: true
1139
+
1140
+ Performance/CompareWithBlock:
1141
+ Enabled: true
1142
+
1143
+ Performance/StartWith:
1144
+ Enabled: true
1145
+
1146
+ Performance/StringReplacement:
1147
+ Enabled: true
1148
+
1149
+ Rails/DelegateAllowBlank:
1150
+ Enabled: true
1151
+
1152
+ Rails/HttpPositionalArguments:
1153
+ Include:
1154
+ - spec/**/*
1155
+ - test/**/*
1156
+
1157
+ Rails/InverseOf:
1158
+ Enabled: true
1159
+
1160
+ Rails/OutputSafety:
1161
+ Enabled: true
1162
+
1163
+ Rails/PluralizationGrammar:
1164
+ Enabled: true
1165
+
1166
+ Security/Eval:
1167
+ Enabled: true
1168
+
1169
+ Security/JSONLoad:
1170
+ Enabled: true
1171
+
1172
+ Security/Open:
1173
+ Enabled: true
1174
+
1175
+ Lint/BigDecimalNew:
1176
+ Enabled: true
1177
+
1178
+ Style/TrailingBodyOnClass:
1179
+ Enabled: true
1180
+
1181
+ Style/TrailingBodyOnModule:
1182
+ Enabled: true
1183
+
1184
+ Style/TrailingCommaInArrayLiteral:
1185
+ EnforcedStyleForMultiline: comma
1186
+ Enabled: true
1187
+
1188
+ Style/TrailingCommaInHashLiteral:
1189
+ EnforcedStyleForMultiline: comma
1190
+ Enabled: false
1191
+
1192
+ Layout/SpaceInsideReferenceBrackets:
1193
+ EnforcedStyle: no_space
1194
+ EnforcedStyleForEmptyBrackets: no_space
1195
+ Enabled: true
1196
+
1197
+ Style/ModuleFunction:
1198
+ EnforcedStyle: extend_self
1199
+
1200
+ Lint/OrderedMagicComments:
1201
+ Enabled: true