loba 0.3.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ require_relative 'internal/platform'
2
+ require_relative 'internal/time_keeper'
3
+ require_relative 'internal/value'
4
+
5
+ module Loba
6
+ # @api private
7
+ module Internal
8
+ end
9
+ end
@@ -0,0 +1,34 @@
1
+ module Loba
2
+ module Internal
3
+ # Internal class for managing logging across Rails and non-Rails applications
4
+ class Platform
5
+ class << self
6
+ # Returns true if Rails appears to be available
7
+ def rails?
8
+ defined?(Rails) ? true : false
9
+ end
10
+
11
+ # Returns true if logging is to be allowed
12
+ def logging_ok?(force_true = false)
13
+ return true if force_true
14
+ return true unless rails?
15
+
16
+ begin
17
+ !Rails.env.production?
18
+ rescue StandardError
19
+ true # let it attempt to log anyway
20
+ end
21
+ end
22
+
23
+ # Returns a logging mechanism appropriate for the application
24
+ def logger
25
+ if rails? && Rails.logger.present?
26
+ ->(arg) { Rails.logger.debug arg }
27
+ else
28
+ ->(arg) { puts arg }
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,33 @@
1
+ require 'singleton'
2
+
3
+ module Loba
4
+ module Internal
5
+ # Internal class for tracking time stamps; should not be used directly
6
+ # @!attribute [r] timewas
7
+ # Previous timestamped Time value
8
+ # @!attribute [r] timenum
9
+ # Count of timestamping occurances so far
10
+ class TimeKeeper
11
+ include Singleton
12
+ attr_reader :timewas, :timenum
13
+
14
+ def initialize
15
+ reset!
16
+ end
17
+
18
+ def ping
19
+ @timenum += 1
20
+ now = Time.now
21
+ change = now - @timewas
22
+ @timewas = now
23
+
24
+ { number: @timenum, now: now, change: change }
25
+ end
26
+
27
+ def reset!
28
+ @timewas = Time.now
29
+ @timenum = 0
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,40 @@
1
+ require_relative 'value/value_helper'
2
+
3
+ module Loba
4
+ module Internal
5
+ # Internal module for examining a value in support of Loba.value
6
+ module Value
7
+ module_function
8
+
9
+ # Retrieve a value used in code.
10
+ #
11
+ # @param argument [Symbol, Object] the value or variable for which information is
12
+ # to be retrieved
13
+ # * If a symbol, it is assumed to be a reference to a variable
14
+ # and a label can be inferred.
15
+ # * If any other type, it is assumed to be a literal value to
16
+ # and a label should be supplied when instantiated.
17
+ # @param label [String] when provided, an explicit label to use; will override any
18
+ # possible inferred label
19
+ # @param inspect [Boolean] when true, force #inspect to be called against
20
+ # `argument` when evaluating
21
+ # @param depth_offset [Integer] depth in call stack to start evaluation from
22
+ #
23
+ # @return [Hash] various detail about the value being analyzed
24
+ # * :tag => [String] method name (wrapped in square brackets)
25
+ # * :line => [String] code line reference
26
+ # * :value => [String] value of argument (if nil, '-nil-' is returned)
27
+ # * :label => [String] label, ending with ":"
28
+ # (if not possible to infer, '[unknown value]' is returned)
29
+ def phrases(argument:, label: nil, inspect: true, depth_offset: 0)
30
+ depth = depth_offset&.to_i || 0
31
+ {
32
+ tag: ValueHelper.tag(depth: depth + 1),
33
+ line: ValueHelper.line(depth: depth + 1),
34
+ value: ValueHelper.value(argument: argument, inspect: inspect, depth: depth + 1),
35
+ label: ValueHelper.label(argument: argument, explicit_label: label)
36
+ }
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,126 @@
1
+ require 'binding_of_caller'
2
+
3
+ module Loba
4
+ module Internal
5
+ module Value
6
+ # Internal helper functions for Value.phrases
7
+ module ValueHelper
8
+ module_function
9
+
10
+ # Assemble display that shows the method invoking Loba
11
+ # @param depth [Integer] depth in call stack to retrieve tag from
12
+ # @return [String] tag for where Loba was invoked, wrapped in "[" and "]"
13
+ def tag(depth: 0)
14
+ delim = { class: '.', instance: '#' }
15
+ '[' \
16
+ "#{class_name(depth: depth + 1)}" \
17
+ "#{delim[method_type(depth: depth + 1)]}" \
18
+ "#{method_name(depth: depth + 1)}" \
19
+ ']'
20
+ end
21
+
22
+ # Identify source code line from where Loba was invoked
23
+ # @param depth [Integer] depth in call stack to retrieve source code line from
24
+ # @return [Integer] source code line number where Loba was invoked
25
+ def line(depth: 0)
26
+ caller[depth]
27
+ end
28
+
29
+ # Prepare display of an argument's value.
30
+ # @param argument [Symbol, Object] the value or variable for which information is
31
+ # to be retrieved
32
+ # @param inspect [Boolean] when true, force #inspect to be called against
33
+ # `argument` when evaluating
34
+ # @param depth [Integer] depth in call stack to start evaluation from
35
+ # @return [String] value representation of argument for display
36
+ def value(argument:, inspect: true, depth: 0)
37
+ val = evaluate(argument: argument, inspect: inspect, depth: depth + 1)
38
+
39
+ # #inspect adds explicit quotes to strings, so strip back off since #inspect
40
+ # always returns a String
41
+ if inspect && val.respond_to?(:delete_prefix)
42
+ val = val.delete_prefix('"').delete_suffix('"')
43
+ end
44
+
45
+ # make nils obvious
46
+ val.nil? ? '-nil-' : val.to_s
47
+ end
48
+
49
+ # Builds a label for display based on the argument when instantiated.
50
+ # If the argument (when instantiated) is not a symbol, it may not be possible
51
+ # to infer a label; in that case, '[unknown value]' is returned.
52
+ #
53
+ # @param argument [Symbol, Object] the value or variable for which information is
54
+ # to be retrieved
55
+ # * If a symbol, it is assumed to be a reference to a variable
56
+ # and a label can be inferred.
57
+ # * If any other type, it is assumed to be a literal value to
58
+ # and a label should be supplied when instantiated.
59
+ # @param label [String] when provided, an explicit label to use; will override any
60
+ # possible inferred label
61
+ #
62
+ # @return [String] label
63
+ def label(argument:, explicit_label: nil)
64
+ text = if explicit_label.nil?
65
+ argument.is_a?(Symbol) ? "#{argument}:" : nil
66
+ elsif explicit_label.respond_to?(:strip)
67
+ s = explicit_label.strip
68
+ s += ':' unless s[-1] == ':'
69
+ s
70
+ end
71
+
72
+ text.nil? ? '[unknown value]:' : text.to_s
73
+ end
74
+
75
+ # Evaluate an arguments value from where it's bound.
76
+ # @param argument [Symbol, Object] the value or variable for which information is
77
+ # to be retrieved
78
+ # @param inspect [Boolean] when true, force #inspect to be called against
79
+ # `argument` when evaluating
80
+ # @param depth [Integer] depth in call stack to start evaluation from
81
+ # @return [Object] value of the argument when Loba was invoked
82
+ def evaluate(argument:, inspect: true, depth: 0)
83
+ return inspect ? argument.inspect : argument unless argument.is_a?(Symbol)
84
+
85
+ evaluation = binding.of_caller(depth + 1).eval(argument.to_s)
86
+ inspect ? evaluation.inspect : evaluation
87
+ end
88
+
89
+ # Prepare display of class name from where Loba was invoked
90
+ # @param depth [Integer] depth in call stack to retrieve class name from
91
+ # @return [String] name of class where Loba was invoked
92
+ def class_name(depth: 0)
93
+ m = binding.of_caller(depth + 1).eval('self.class.name')
94
+ if m.nil? || m.empty?
95
+ '<anonymous class>'
96
+ elsif m == 'Class'
97
+ binding.of_caller(depth + 1).eval('self.name')
98
+ else
99
+ m
100
+ end
101
+ end
102
+
103
+ # Prepare display of whether the method from where Loba was invoked is
104
+ # for a class or an instance
105
+ # @param depth [Integer] depth in call stack
106
+ # @return [:class] if method in call stack is a class method
107
+ # @return [:instance] if method in call stack is an instance method
108
+ def method_type(depth: 0)
109
+ if binding.of_caller(depth + 1).eval('self.class.name') == 'Class'
110
+ :class
111
+ else
112
+ :instance
113
+ end
114
+ end
115
+
116
+ # Prepare display of method name from where Loba was invoked
117
+ # @param depth [Integer] depth in call stack to retrieve method name from
118
+ # @return [Symbol, String] name of class where Loba was invoked
119
+ def method_name(depth: 0)
120
+ m = binding.of_caller(depth + 1).eval('self.send(:__method__)')
121
+ m.nil? || m.empty? ? '<anonymous method>' : m
122
+ end
123
+ end
124
+ end
125
+ end
126
+ end
data/lib/loba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Loba
2
- VERSION = "0.3.1"
2
+ VERSION = '1.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loba
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Newman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-08 00:00:00.000000000 Z
11
+ date: 2021-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,70 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.11'
19
+ version: '2.2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.11'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rspec
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
26
+ version: '2.2'
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: binding_of_caller
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
31
  - - "~>"
60
32
  - !ruby/object:Gem::Version
61
- version: '0.7'
33
+ version: '1.0'
62
34
  type: :runtime
63
35
  prerelease: false
64
36
  version_requirements: !ruby/object:Gem::Requirement
65
37
  requirements:
66
38
  - - "~>"
67
39
  - !ruby/object:Gem::Version
68
- version: '0.7'
40
+ version: '1.0'
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: colorize
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - "~>"
74
46
  - !ruby/object:Gem::Version
75
- version: '0.7'
47
+ version: '0.8'
76
48
  type: :runtime
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
52
  - - "~>"
81
53
  - !ruby/object:Gem::Version
82
- version: '0.7'
54
+ version: '0.8'
83
55
  description: Handy methods for adding trace lines to output or Rails logs.
84
56
  email:
85
57
  - richard@newmanworks.com
@@ -87,28 +59,22 @@ executables: []
87
59
  extensions: []
88
60
  extra_rdoc_files: []
89
61
  files:
90
- - ".codeclimate.yml"
91
- - ".gitignore"
92
- - ".rspec"
93
- - ".rubocop.yml"
94
- - ".travis.yml"
95
62
  - CODE_OF_CONDUCT.md
96
- - Gemfile
97
- - LICENSE.txt
63
+ - LICENSE
98
64
  - README.md
99
- - Rakefile
100
- - bin/console
101
- - bin/setup
102
65
  - lib/loba.rb
66
+ - lib/loba/internal.rb
67
+ - lib/loba/internal/platform.rb
68
+ - lib/loba/internal/time_keeper.rb
69
+ - lib/loba/internal/value.rb
70
+ - lib/loba/internal/value/value_helper.rb
103
71
  - lib/loba/version.rb
104
- - loba.gemspec
105
- - readme/ts.md
106
- - readme/val.md
107
- - readme/zulu.png
108
72
  homepage: https://github.com/rdnewman/loba
109
73
  licenses:
110
74
  - MIT
111
- metadata: {}
75
+ metadata:
76
+ source_code_uri: https://github.com/rdnewman/loba
77
+ bug_tracker_uri: https://github.com/rdnewman/loba/issues
112
78
  post_install_message:
113
79
  rdoc_options: []
114
80
  require_paths:
@@ -117,15 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
83
  requirements:
118
84
  - - ">="
119
85
  - !ruby/object:Gem::Version
120
- version: 2.1.0
86
+ version: '2.5'
121
87
  required_rubygems_version: !ruby/object:Gem::Requirement
122
88
  requirements:
123
89
  - - ">="
124
90
  - !ruby/object:Gem::Version
125
91
  version: '0'
126
92
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.6.11
93
+ rubygems_version: 3.0.8
129
94
  signing_key:
130
95
  specification_version: 4
131
96
  summary: 'Loba: Easy tracing for debugging.'
data/.codeclimate.yml DELETED
@@ -1,21 +0,0 @@
1
- ---
2
- engines:
3
- duplication:
4
- enabled: true
5
- config:
6
- languages:
7
- - ruby
8
- - javascript
9
- fixme:
10
- enabled: true
11
- rubocop:
12
- enabled: true
13
- ratings:
14
- paths:
15
- - "**.inc"
16
- - "**.js"
17
- - "**.jsx"
18
- - "**.module"
19
- - "**.rb"
20
- exclude_paths:
21
- - spec/**/*
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /loba-?.?.?.gem
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.rubocop.yml DELETED
@@ -1,1168 +0,0 @@
1
- AllCops:
2
- DisabledByDefault: true
3
-
4
- #################### Lint ################################
5
-
6
- Lint/AmbiguousOperator:
7
- Description: >-
8
- Checks for ambiguous operators in the first argument of a
9
- method invocation without parentheses.
10
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
11
- Enabled: true
12
-
13
- Lint/AmbiguousRegexpLiteral:
14
- Description: >-
15
- Checks for ambiguous regexp literals in the first argument of
16
- a method invocation without parenthesis.
17
- Enabled: true
18
-
19
- Lint/AssignmentInCondition:
20
- Description: "Don't use assignment in conditions."
21
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
22
- Enabled: true
23
-
24
- Lint/BlockAlignment:
25
- Description: 'Align block ends correctly.'
26
- Enabled: true
27
-
28
- Lint/CircularArgumentReference:
29
- Description: "Don't refer to the keyword argument in the default value."
30
- Enabled: true
31
-
32
- Lint/ConditionPosition:
33
- Description: >-
34
- Checks for condition placed in a confusing position relative to
35
- the keyword.
36
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
37
- Enabled: true
38
-
39
- Lint/Debugger:
40
- Description: 'Check for debugger calls.'
41
- Enabled: true
42
-
43
- Lint/DefEndAlignment:
44
- Description: 'Align ends corresponding to defs correctly.'
45
- Enabled: true
46
-
47
- Lint/DeprecatedClassMethods:
48
- Description: 'Check for deprecated class method calls.'
49
- Enabled: true
50
-
51
- Lint/DuplicateMethods:
52
- Description: 'Check for duplicate methods calls.'
53
- Enabled: true
54
-
55
- Lint/EachWithObjectArgument:
56
- Description: 'Check for immutable argument given to each_with_object.'
57
- Enabled: true
58
-
59
- Lint/ElseLayout:
60
- Description: 'Check for odd code arrangement in an else block.'
61
- Enabled: true
62
-
63
- Lint/EmptyEnsure:
64
- Description: 'Checks for empty ensure block.'
65
- Enabled: true
66
-
67
- Lint/EmptyInterpolation:
68
- Description: 'Checks for empty string interpolation.'
69
- Enabled: true
70
-
71
- Lint/EndAlignment:
72
- Description: 'Align ends correctly.'
73
- Enabled: true
74
-
75
- Lint/EndInMethod:
76
- Description: 'END blocks should not be placed inside method definitions.'
77
- Enabled: true
78
-
79
- Lint/EnsureReturn:
80
- Description: 'Do not use return in an ensure block.'
81
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
82
- Enabled: true
83
-
84
- Lint/Eval:
85
- Description: 'The use of eval represents a serious security risk.'
86
- Enabled: true
87
-
88
- Lint/FormatParameterMismatch:
89
- Description: 'The number of parameters to format/sprint must match the fields.'
90
- Enabled: true
91
-
92
- Lint/HandleExceptions:
93
- Description: "Don't suppress exception."
94
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
95
- Enabled: true
96
-
97
- Lint/InvalidCharacterLiteral:
98
- Description: >-
99
- Checks for invalid character literals with a non-escaped
100
- whitespace character.
101
- Enabled: true
102
-
103
- Lint/LiteralInCondition:
104
- Description: 'Checks of literals used in conditions.'
105
- Enabled: true
106
-
107
- Lint/LiteralInInterpolation:
108
- Description: 'Checks for literals used in interpolation.'
109
- Enabled: true
110
-
111
- Lint/Loop:
112
- Description: >-
113
- Use Kernel#loop with break rather than begin/end/until or
114
- begin/end/while for post-loop tests.
115
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
116
- Enabled: true
117
-
118
- Lint/NestedMethodDefinition:
119
- Description: 'Do not use nested method definitions.'
120
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
121
- Enabled: true
122
-
123
- Lint/NonLocalExitFromIterator:
124
- Description: 'Do not use return in iterator to cause non-local exit.'
125
- Enabled: true
126
-
127
- Lint/ParenthesesAsGroupedExpression:
128
- Description: >-
129
- Checks for method calls with a space before the opening
130
- parenthesis.
131
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
132
- Enabled: true
133
-
134
- Lint/RequireParentheses:
135
- Description: >-
136
- Use parentheses in the method call to avoid confusion
137
- about precedence.
138
- Enabled: true
139
-
140
- Lint/RescueException:
141
- Description: 'Avoid rescuing the Exception class.'
142
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
143
- Enabled: true
144
-
145
- Lint/ShadowingOuterLocalVariable:
146
- Description: >-
147
- Do not use the same name as outer local variable
148
- for block arguments or block local variables.
149
- Enabled: true
150
-
151
- Lint/SpaceBeforeFirstArg:
152
- Description: >-
153
- Put a space between a method name and the first argument
154
- in a method call without parentheses.
155
- Enabled: true
156
-
157
- Lint/StringConversionInInterpolation:
158
- Description: 'Checks for Object#to_s usage in string interpolation.'
159
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
160
- Enabled: true
161
-
162
- Lint/UnderscorePrefixedVariableName:
163
- Description: 'Do not use prefix `_` for a variable that is used.'
164
- Enabled: true
165
-
166
- Lint/UnneededDisable:
167
- Description: >-
168
- Checks for rubocop:disable comments that can be removed.
169
- Note: this cop is not disabled when disabling all cops.
170
- It must be explicitly disabled.
171
- Enabled: true
172
-
173
- Lint/UnusedBlockArgument:
174
- Description: 'Checks for unused block arguments.'
175
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
176
- Enabled: true
177
-
178
- Lint/UnusedMethodArgument:
179
- Description: 'Checks for unused method arguments.'
180
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
181
- Enabled: true
182
-
183
- Lint/UnreachableCode:
184
- Description: 'Unreachable code.'
185
- Enabled: true
186
-
187
- Lint/UselessAccessModifier:
188
- Description: 'Checks for useless access modifiers.'
189
- Enabled: true
190
-
191
- Lint/UselessAssignment:
192
- Description: 'Checks for useless assignment to a local variable.'
193
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
194
- Enabled: true
195
-
196
- Lint/UselessComparison:
197
- Description: 'Checks for comparison of something with itself.'
198
- Enabled: true
199
-
200
- Lint/UselessElseWithoutRescue:
201
- Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
202
- Enabled: true
203
-
204
- Lint/UselessSetterCall:
205
- Description: 'Checks for useless setter call to a local variable.'
206
- Enabled: true
207
-
208
- Lint/Void:
209
- Description: 'Possible use of operator/literal/variable in void context.'
210
- Enabled: true
211
-
212
- ###################### Metrics ####################################
213
-
214
- Metrics/AbcSize:
215
- Description: >-
216
- A calculated magnitude based on number of assignments,
217
- branches, and conditions.
218
- Reference: 'http://c2.com/cgi/wiki?AbcMetric'
219
- Enabled: false
220
- Max: 20
221
-
222
- Metrics/BlockNesting:
223
- Description: 'Avoid excessive block nesting'
224
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
225
- Enabled: true
226
- Max: 4
227
-
228
- Metrics/ClassLength:
229
- Description: 'Avoid classes longer than 250 lines of code.'
230
- Enabled: true
231
- Max: 250
232
-
233
- Metrics/CyclomaticComplexity:
234
- Description: >-
235
- A complexity metric that is strongly correlated to the number
236
- of test cases needed to validate a method.
237
- Enabled: true
238
-
239
- Metrics/LineLength:
240
- Description: 'Limit lines to 80 characters.'
241
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
242
- Enabled: false
243
-
244
- Metrics/MethodLength:
245
- Description: 'Avoid methods longer than 30 lines of code.'
246
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
247
- Enabled: true
248
- Max: 30
249
-
250
- Metrics/ModuleLength:
251
- Description: 'Avoid modules longer than 250 lines of code.'
252
- Enabled: true
253
- Max: 250
254
-
255
- Metrics/ParameterLists:
256
- Description: 'Avoid parameter lists longer than three or four parameters.'
257
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
258
- Enabled: true
259
-
260
- Metrics/PerceivedComplexity:
261
- Description: >-
262
- A complexity metric geared towards measuring complexity for a
263
- human reader.
264
- Enabled: false
265
-
266
- ##################### Performance #############################
267
-
268
- Performance/Count:
269
- Description: >-
270
- Use `count` instead of `select...size`, `reject...size`,
271
- `select...count`, `reject...count`, `select...length`,
272
- and `reject...length`.
273
- Enabled: true
274
-
275
- Performance/Detect:
276
- Description: >-
277
- Use `detect` instead of `select.first`, `find_all.first`,
278
- `select.last`, and `find_all.last`.
279
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
280
- Enabled: true
281
-
282
- Performance/FlatMap:
283
- Description: >-
284
- Use `Enumerable#flat_map`
285
- instead of `Enumerable#map...Array#flatten(1)`
286
- or `Enumberable#collect..Array#flatten(1)`
287
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
288
- Enabled: true
289
- EnabledForFlattenWithoutParams: false
290
- # If enabled, this cop will warn about usages of
291
- # `flatten` being called without any parameters.
292
- # This can be dangerous since `flat_map` will only flatten 1 level, and
293
- # `flatten` without any parameters can flatten multiple levels.
294
-
295
- Performance/ReverseEach:
296
- Description: 'Use `reverse_each` instead of `reverse.each`.'
297
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
298
- Enabled: true
299
-
300
- Performance/Sample:
301
- Description: >-
302
- Use `sample` instead of `shuffle.first`,
303
- `shuffle.last`, and `shuffle[Fixnum]`.
304
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
305
- Enabled: true
306
-
307
- Performance/Size:
308
- Description: >-
309
- Use `size` instead of `count` for counting
310
- the number of elements in `Array` and `Hash`.
311
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
312
- Enabled: true
313
-
314
- Performance/StringReplacement:
315
- Description: >-
316
- Use `tr` instead of `gsub` when you are replacing the same
317
- number of characters. Use `delete` instead of `gsub` when
318
- you are deleting characters.
319
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
320
- Enabled: true
321
-
322
- ##################### Rails ##################################
323
-
324
- Rails/ActionFilter:
325
- Description: 'Enforces consistent use of action filter methods.'
326
- Enabled: false
327
-
328
- Rails/Date:
329
- Description: >-
330
- Checks the correct usage of date aware methods,
331
- such as Date.today, Date.current etc.
332
- Enabled: false
333
-
334
- Rails/DefaultScope:
335
- Description: 'Checks if the argument passed to default_scope is a block.'
336
- Enabled: false
337
-
338
- Rails/Delegate:
339
- Description: 'Prefer delegate method for delegations.'
340
- Enabled: false
341
-
342
- Rails/FindBy:
343
- Description: 'Prefer find_by over where.first.'
344
- Enabled: false
345
-
346
- Rails/FindEach:
347
- Description: 'Prefer all.find_each over all.find.'
348
- Enabled: false
349
-
350
- Rails/HasAndBelongsToMany:
351
- Description: 'Prefer has_many :through to has_and_belongs_to_many.'
352
- Enabled: false
353
-
354
- Rails/Output:
355
- Description: 'Checks for calls to puts, print, etc.'
356
- Enabled: false
357
-
358
- Rails/ReadWriteAttribute:
359
- Description: >-
360
- Checks for read_attribute(:attr) and
361
- write_attribute(:attr, val).
362
- Enabled: false
363
-
364
- Rails/ScopeArgs:
365
- Description: 'Checks the arguments of ActiveRecord scopes.'
366
- Enabled: false
367
-
368
- Rails/TimeZone:
369
- Description: 'Checks the correct usage of time zone aware methods.'
370
- StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
371
- Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
372
- Enabled: false
373
-
374
- Rails/Validation:
375
- Description: 'Use validates :attribute, hash of validations.'
376
- Enabled: false
377
-
378
- ################## Style #################################
379
-
380
- Style/AccessModifierIndentation:
381
- Description: Check indentation of private/protected visibility modifiers.
382
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
383
- Enabled: false
384
-
385
- Style/AccessorMethodName:
386
- Description: Check the naming of accessor methods for get_/set_.
387
- Enabled: false
388
-
389
- Style/Alias:
390
- Description: 'Use alias_method instead of alias.'
391
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
392
- Enabled: false
393
-
394
- Style/AlignArray:
395
- Description: >-
396
- Align the elements of an array literal if they span more than
397
- one line.
398
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
399
- Enabled: false
400
-
401
- Style/AlignHash:
402
- Description: >-
403
- Align the elements of a hash literal if they span more than
404
- one line.
405
- Enabled: false
406
-
407
- Style/AlignParameters:
408
- Description: >-
409
- Align the parameters of a method call if they span more
410
- than one line.
411
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
412
- Enabled: false
413
-
414
- Style/AndOr:
415
- Description: 'Use &&/|| instead of and/or.'
416
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or'
417
- Enabled: false
418
-
419
- Style/ArrayJoin:
420
- Description: 'Use Array#join instead of Array#*.'
421
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
422
- Enabled: false
423
-
424
- Style/AsciiComments:
425
- Description: 'Use only ascii symbols in comments.'
426
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
427
- Enabled: false
428
-
429
- Style/AsciiIdentifiers:
430
- Description: 'Use only ascii symbols in identifiers.'
431
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
432
- Enabled: false
433
-
434
- Style/Attr:
435
- Description: 'Checks for uses of Module#attr.'
436
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
437
- Enabled: false
438
-
439
- Style/BeginBlock:
440
- Description: 'Avoid the use of BEGIN blocks.'
441
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
442
- Enabled: false
443
-
444
- Style/BarePercentLiterals:
445
- Description: 'Checks if usage of %() or %Q() matches configuration.'
446
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand'
447
- Enabled: false
448
-
449
- Style/BlockComments:
450
- Description: 'Do not use block comments.'
451
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
452
- Enabled: false
453
-
454
- Style/BlockEndNewline:
455
- Description: 'Put end statement of multiline block on its own line.'
456
- Enabled: false
457
-
458
- Style/BlockDelimiters:
459
- Description: >-
460
- Avoid using {...} for multi-line blocks (multiline chaining is
461
- always ugly).
462
- Prefer {...} over do...end for single-line blocks.
463
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
464
- Enabled: false
465
-
466
- Style/BracesAroundHashParameters:
467
- Description: 'Enforce braces style around hash parameters.'
468
- Enabled: false
469
-
470
- Style/CaseEquality:
471
- Description: 'Avoid explicit use of the case equality operator(===).'
472
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
473
- Enabled: false
474
-
475
- Style/CaseIndentation:
476
- Description: 'Indentation of when in a case/when/[else/]end.'
477
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
478
- Enabled: false
479
-
480
- Style/CharacterLiteral:
481
- Description: 'Checks for uses of character literals.'
482
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
483
- Enabled: false
484
-
485
- Style/ClassAndModuleCamelCase:
486
- Description: 'Use CamelCase for classes and modules.'
487
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
488
- Enabled: false
489
-
490
- Style/ClassAndModuleChildren:
491
- Description: 'Checks style of children classes and modules.'
492
- Enabled: false
493
-
494
- Style/ClassCheck:
495
- Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
496
- Enabled: false
497
-
498
- Style/ClassMethods:
499
- Description: 'Use self when defining module/class methods.'
500
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods'
501
- Enabled: false
502
-
503
- Style/ClassVars:
504
- Description: 'Avoid the use of class variables.'
505
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
506
- Enabled: false
507
-
508
- Style/ClosingParenthesisIndentation:
509
- Description: 'Checks the indentation of hanging closing parentheses.'
510
- Enabled: false
511
-
512
- Style/ColonMethodCall:
513
- Description: 'Do not use :: for method call.'
514
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
515
- Enabled: false
516
-
517
- Style/CommandLiteral:
518
- Description: 'Use `` or %x around command literals.'
519
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x'
520
- Enabled: false
521
-
522
- Style/CommentAnnotation:
523
- Description: >-
524
- Checks formatting of special comments
525
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
526
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
527
- Enabled: false
528
-
529
- Style/CommentIndentation:
530
- Description: 'Indentation of comments.'
531
- Enabled: false
532
-
533
- Style/ConstantName:
534
- Description: 'Constants should use SCREAMING_SNAKE_CASE.'
535
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
536
- Enabled: false
537
-
538
- Style/DefWithParentheses:
539
- Description: 'Use def with parentheses when there are arguments.'
540
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
541
- Enabled: false
542
-
543
- Style/DeprecatedHashMethods:
544
- Description: 'Checks for use of deprecated Hash methods.'
545
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
546
- Enabled: false
547
-
548
- Style/Documentation:
549
- Description: 'Document classes and non-namespace modules.'
550
- Enabled: false
551
-
552
- Style/DotPosition:
553
- Description: 'Checks the position of the dot in multi-line method calls.'
554
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
555
- Enabled: false
556
-
557
- Style/DoubleNegation:
558
- Description: 'Checks for uses of double negation (!!).'
559
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
560
- Enabled: false
561
-
562
- Style/EachWithObject:
563
- Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
564
- Enabled: false
565
-
566
- Style/ElseAlignment:
567
- Description: 'Align elses and elsifs correctly.'
568
- Enabled: false
569
-
570
- Style/EmptyElse:
571
- Description: 'Avoid empty else-clauses.'
572
- Enabled: false
573
-
574
- Style/EmptyLineBetweenDefs:
575
- Description: 'Use empty lines between defs.'
576
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
577
- Enabled: false
578
-
579
- Style/EmptyLines:
580
- Description: "Don't use several empty lines in a row."
581
- Enabled: false
582
-
583
- Style/EmptyLinesAroundAccessModifier:
584
- Description: "Keep blank lines around access modifiers."
585
- Enabled: false
586
-
587
- Style/EmptyLinesAroundBlockBody:
588
- Description: "Keeps track of empty lines around block bodies."
589
- Enabled: false
590
-
591
- Style/EmptyLinesAroundClassBody:
592
- Description: "Keeps track of empty lines around class bodies."
593
- Enabled: false
594
-
595
- Style/EmptyLinesAroundModuleBody:
596
- Description: "Keeps track of empty lines around module bodies."
597
- Enabled: false
598
-
599
- Style/EmptyLinesAroundMethodBody:
600
- Description: "Keeps track of empty lines around method bodies."
601
- Enabled: false
602
-
603
- Style/EmptyLiteral:
604
- Description: 'Prefer literals to Array.new/Hash.new/String.new.'
605
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
606
- Enabled: false
607
-
608
- Style/EndBlock:
609
- Description: 'Avoid the use of END blocks.'
610
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
611
- Enabled: false
612
-
613
- Style/EndOfLine:
614
- Description: 'Use Unix-style line endings.'
615
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
616
- Enabled: false
617
-
618
- Style/EvenOdd:
619
- Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
620
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
621
- Enabled: false
622
-
623
- Style/ExtraSpacing:
624
- Description: 'Do not use unnecessary spacing.'
625
- Enabled: false
626
-
627
- Style/FileName:
628
- Description: 'Use snake_case for source file names.'
629
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
630
- Enabled: false
631
-
632
- Style/InitialIndentation:
633
- Description: >-
634
- Checks the indentation of the first non-blank non-comment line in a file.
635
- Enabled: false
636
-
637
- Style/FirstParameterIndentation:
638
- Description: 'Checks the indentation of the first parameter in a method call.'
639
- Enabled: false
640
-
641
- Style/FlipFlop:
642
- Description: 'Checks for flip flops'
643
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
644
- Enabled: false
645
-
646
- Style/For:
647
- Description: 'Checks use of for or each in multiline loops.'
648
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops'
649
- Enabled: false
650
-
651
- Style/FormatString:
652
- Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
653
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
654
- Enabled: false
655
-
656
- Style/GlobalVars:
657
- Description: 'Do not introduce global variables.'
658
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
659
- Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
660
- Enabled: false
661
-
662
- Style/GuardClause:
663
- Description: 'Check for conditionals that can be replaced with guard clauses'
664
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
665
- Enabled: false
666
-
667
- Style/HashSyntax:
668
- Description: >-
669
- Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
670
- { :a => 1, :b => 2 }.
671
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
672
- Enabled: false
673
-
674
- Style/IfUnlessModifier:
675
- Description: >-
676
- Favor modifier if/unless usage when you have a
677
- single-line body.
678
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
679
- Enabled: false
680
-
681
- Style/IfWithSemicolon:
682
- Description: 'Do not use if x; .... Use the ternary operator instead.'
683
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
684
- Enabled: false
685
-
686
- Style/IndentationConsistency:
687
- Description: 'Keep indentation straight.'
688
- Enabled: false
689
-
690
- Style/IndentationWidth:
691
- Description: 'Use 2 spaces for indentation.'
692
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
693
- Enabled: false
694
-
695
- Style/IndentArray:
696
- Description: >-
697
- Checks the indentation of the first element in an array
698
- literal.
699
- Enabled: false
700
-
701
- Style/IndentHash:
702
- Description: 'Checks the indentation of the first key in a hash literal.'
703
- Enabled: false
704
-
705
- Style/InfiniteLoop:
706
- Description: 'Use Kernel#loop for infinite loops.'
707
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop'
708
- Enabled: false
709
-
710
- Style/Lambda:
711
- Description: 'Use the new lambda literal syntax for single-line blocks.'
712
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
713
- Enabled: false
714
-
715
- Style/LambdaCall:
716
- Description: 'Use lambda.call(...) instead of lambda.(...).'
717
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
718
- Enabled: false
719
-
720
- Style/LeadingCommentSpace:
721
- Description: 'Comments should start with a space.'
722
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
723
- Enabled: false
724
-
725
- Style/LineEndConcatenation:
726
- Description: >-
727
- Use \ instead of + or << to concatenate two string literals at
728
- line end.
729
- Enabled: false
730
-
731
- Style/MethodCallParentheses:
732
- Description: 'Do not use parentheses for method calls with no arguments.'
733
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
734
- Enabled: false
735
-
736
- Style/MethodDefParentheses:
737
- Description: >-
738
- Checks if the method definitions have or don't have
739
- parentheses.
740
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
741
- Enabled: false
742
-
743
- Style/MethodName:
744
- Description: 'Use the configured style when naming methods.'
745
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
746
- Enabled: false
747
-
748
- Style/ModuleFunction:
749
- Description: 'Checks for usage of `extend self` in modules.'
750
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
751
- Enabled: false
752
-
753
- Style/MultilineBlockChain:
754
- Description: 'Avoid multi-line chains of blocks.'
755
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
756
- Enabled: false
757
-
758
- Style/MultilineBlockLayout:
759
- Description: 'Ensures newlines after multiline block do statements.'
760
- Enabled: false
761
-
762
- Style/MultilineIfThen:
763
- Description: 'Do not use then for multi-line if/unless.'
764
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
765
- Enabled: false
766
-
767
- Style/MultilineOperationIndentation:
768
- Description: >-
769
- Checks indentation of binary operations that span more than
770
- one line.
771
- Enabled: false
772
-
773
- Style/MultilineTernaryOperator:
774
- Description: >-
775
- Avoid multi-line ?: (the ternary operator);
776
- use if/unless instead.
777
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
778
- Enabled: false
779
-
780
- Style/NegatedIf:
781
- Description: >-
782
- Favor unless over if for negative conditions
783
- (or control flow or).
784
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
785
- Enabled: false
786
-
787
- Style/NegatedWhile:
788
- Description: 'Favor until over while for negative conditions.'
789
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
790
- Enabled: false
791
-
792
- Style/NestedTernaryOperator:
793
- Description: 'Use one expression per branch in a ternary operator.'
794
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
795
- Enabled: false
796
-
797
- Style/Next:
798
- Description: 'Use `next` to skip iteration instead of a condition at the end.'
799
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
800
- Enabled: false
801
-
802
- Style/NilComparison:
803
- Description: 'Prefer x.nil? to x == nil.'
804
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
805
- Enabled: false
806
-
807
- Style/NonNilCheck:
808
- Description: 'Checks for redundant nil checks.'
809
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
810
- Enabled: false
811
-
812
- Style/Not:
813
- Description: 'Use ! instead of not.'
814
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
815
- Enabled: false
816
-
817
- Style/NumericLiterals:
818
- Description: >-
819
- Add underscores to large numeric literals to improve their
820
- readability.
821
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
822
- Enabled: false
823
-
824
- Style/OneLineConditional:
825
- Description: >-
826
- Favor the ternary operator(?:) over
827
- if/then/else/end constructs.
828
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
829
- Enabled: false
830
-
831
- Style/OpMethod:
832
- Description: 'When defining binary operators, name the argument other.'
833
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
834
- Enabled: false
835
-
836
- Style/OptionalArguments:
837
- Description: >-
838
- Checks for optional arguments that do not appear at the end
839
- of the argument list
840
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments'
841
- Enabled: false
842
-
843
- Style/ParallelAssignment:
844
- Description: >-
845
- Check for simple usages of parallel assignment.
846
- It will only warn when the number of variables
847
- matches on both sides of the assignment.
848
- This also provides performance benefits
849
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment'
850
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#parallel-assignment-vs-sequential-assignment-code'
851
- Enabled: false
852
-
853
- Style/ParenthesesAroundCondition:
854
- Description: >-
855
- Don't use parentheses around the condition of an
856
- if/unless/while.
857
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
858
- Enabled: false
859
-
860
- Style/PercentLiteralDelimiters:
861
- Description: 'Use `%`-literal delimiters consistently'
862
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
863
- Enabled: false
864
-
865
- Style/PercentQLiterals:
866
- Description: 'Checks if uses of %Q/%q match the configured preference.'
867
- Enabled: false
868
-
869
- Style/PerlBackrefs:
870
- Description: 'Avoid Perl-style regex back references.'
871
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
872
- Enabled: false
873
-
874
- Style/PredicateName:
875
- Description: 'Check the names of predicate methods.'
876
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
877
- Enabled: false
878
-
879
- Style/Proc:
880
- Description: 'Use proc instead of Proc.new.'
881
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
882
- Enabled: false
883
-
884
- Style/RaiseArgs:
885
- Description: 'Checks the arguments passed to raise/fail.'
886
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
887
- Enabled: false
888
-
889
- Style/RedundantBegin:
890
- Description: "Don't use begin blocks when they are not needed."
891
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
892
- Enabled: false
893
-
894
- Style/RedundantException:
895
- Description: "Checks for an obsolete RuntimeException argument in raise/fail."
896
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror'
897
- Enabled: false
898
-
899
- Style/RedundantReturn:
900
- Description: "Don't use return where it's not required."
901
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
902
- Enabled: false
903
-
904
- Style/RedundantSelf:
905
- Description: "Don't use self where it's not needed."
906
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required'
907
- Enabled: false
908
-
909
- Style/RegexpLiteral:
910
- Description: 'Use / or %r around regular expressions.'
911
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
912
- Enabled: false
913
-
914
- Style/RescueEnsureAlignment:
915
- Description: 'Align rescues and ensures correctly.'
916
- Enabled: false
917
-
918
- Style/RescueModifier:
919
- Description: 'Avoid using rescue in its modifier form.'
920
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers'
921
- Enabled: false
922
-
923
- Style/SelfAssignment:
924
- Description: >-
925
- Checks for places where self-assignment shorthand should have
926
- been used.
927
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
928
- Enabled: false
929
-
930
- Style/Semicolon:
931
- Description: "Don't use semicolons to terminate expressions."
932
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon'
933
- Enabled: false
934
-
935
- Style/SignalException:
936
- Description: 'Checks for proper usage of fail and raise.'
937
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
938
- Enabled: false
939
-
940
- Style/SingleLineBlockParams:
941
- Description: 'Enforces the names of some block params.'
942
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
943
- Enabled: false
944
-
945
- Style/SingleLineMethods:
946
- Description: 'Avoid single-line methods.'
947
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
948
- Enabled: false
949
-
950
- Style/SingleSpaceBeforeFirstArg:
951
- Description: >-
952
- Checks that exactly one space is used between a method name
953
- and the first argument for method calls without parentheses.
954
- Enabled: false
955
-
956
- Style/SpaceAfterColon:
957
- Description: 'Use spaces after colons.'
958
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
959
- Enabled: false
960
-
961
- Style/SpaceAfterComma:
962
- Description: 'Use spaces after commas.'
963
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
964
- Enabled: false
965
-
966
- Style/SpaceAfterControlKeyword:
967
- Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
968
- Enabled: false
969
-
970
- Style/SpaceAfterMethodName:
971
- Description: >-
972
- Do not put a space between a method name and the opening
973
- parenthesis in a method definition.
974
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
975
- Enabled: false
976
-
977
- Style/SpaceAfterNot:
978
- Description: Tracks redundant space after the ! operator.
979
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang'
980
- Enabled: false
981
-
982
- Style/SpaceAfterSemicolon:
983
- Description: 'Use spaces after semicolons.'
984
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
985
- Enabled: false
986
-
987
- Style/SpaceBeforeBlockBraces:
988
- Description: >-
989
- Checks that the left block brace has or doesn't have space
990
- before it.
991
- Enabled: false
992
-
993
- Style/SpaceBeforeComma:
994
- Description: 'No spaces before commas.'
995
- Enabled: false
996
-
997
- Style/SpaceBeforeComment:
998
- Description: >-
999
- Checks for missing space between code and a comment on the
1000
- same line.
1001
- Enabled: false
1002
-
1003
- Style/SpaceBeforeSemicolon:
1004
- Description: 'No spaces before semicolons.'
1005
- Enabled: false
1006
-
1007
- Style/SpaceInsideBlockBraces:
1008
- Description: >-
1009
- Checks that block braces have or don't have surrounding space.
1010
- For blocks taking parameters, checks that the left brace has
1011
- or doesn't have trailing space.
1012
- Enabled: false
1013
-
1014
- Style/SpaceAroundBlockParameters:
1015
- Description: 'Checks the spacing inside and after block parameters pipes.'
1016
- Enabled: false
1017
-
1018
- Style/SpaceAroundEqualsInParameterDefault:
1019
- Description: >-
1020
- Checks that the equals signs in parameter default assignments
1021
- have or don't have surrounding space depending on
1022
- configuration.
1023
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
1024
- Enabled: false
1025
-
1026
- Style/SpaceAroundOperators:
1027
- Description: 'Use a single space around operators.'
1028
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
1029
- Enabled: false
1030
-
1031
- Style/SpaceBeforeModifierKeyword:
1032
- Description: 'Put a space before the modifier keyword.'
1033
- Enabled: false
1034
-
1035
- Style/SpaceInsideBrackets:
1036
- Description: 'No spaces after [ or before ].'
1037
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
1038
- Enabled: false
1039
-
1040
- Style/SpaceInsideHashLiteralBraces:
1041
- Description: "Use spaces inside hash literal braces - or don't."
1042
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
1043
- Enabled: false
1044
-
1045
- Style/SpaceInsideParens:
1046
- Description: 'No spaces after ( or before ).'
1047
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
1048
- Enabled: false
1049
-
1050
- Style/SpaceInsideRangeLiteral:
1051
- Description: 'No spaces inside range literals.'
1052
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
1053
- Enabled: false
1054
-
1055
- Style/SpaceInsideStringInterpolation:
1056
- Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1057
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation'
1058
- Enabled: false
1059
-
1060
- Style/SpecialGlobalVars:
1061
- Description: 'Avoid Perl-style global variables.'
1062
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
1063
- Enabled: false
1064
-
1065
- Style/StringLiterals:
1066
- Description: 'Checks if uses of quotes match the configured preference.'
1067
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
1068
- Enabled: false
1069
-
1070
- Style/StringLiteralsInInterpolation:
1071
- Description: >-
1072
- Checks if uses of quotes inside expressions in interpolated
1073
- strings match the configured preference.
1074
- Enabled: false
1075
-
1076
- Style/StructInheritance:
1077
- Description: 'Checks for inheritance from Struct.new.'
1078
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new'
1079
- Enabled: false
1080
-
1081
- Style/SymbolLiteral:
1082
- Description: 'Use plain symbols instead of string symbols when possible.'
1083
- Enabled: false
1084
-
1085
- Style/SymbolProc:
1086
- Description: 'Use symbols as procs instead of blocks when possible.'
1087
- Enabled: false
1088
-
1089
- Style/Tab:
1090
- Description: 'No hard tabs.'
1091
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
1092
- Enabled: false
1093
-
1094
- Style/TrailingBlankLines:
1095
- Description: 'Checks trailing blank lines and final newline.'
1096
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
1097
- Enabled: false
1098
-
1099
- Style/TrailingComma:
1100
- Description: 'Checks for trailing comma in parameter lists and literals.'
1101
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
1102
- Enabled: false
1103
-
1104
- Style/TrailingWhitespace:
1105
- Description: 'Avoid trailing whitespace.'
1106
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
1107
- Enabled: false
1108
-
1109
- Style/TrivialAccessors:
1110
- Description: 'Prefer attr_* methods to trivial readers/writers.'
1111
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
1112
- Enabled: false
1113
-
1114
- Style/UnlessElse:
1115
- Description: >-
1116
- Do not use unless with else. Rewrite these with the positive
1117
- case first.
1118
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
1119
- Enabled: false
1120
-
1121
- Style/UnneededCapitalW:
1122
- Description: 'Checks for %W when interpolation is not needed.'
1123
- Enabled: false
1124
-
1125
- Style/UnneededPercentQ:
1126
- Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
1127
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
1128
- Enabled: false
1129
-
1130
- Style/TrailingUnderscoreVariable:
1131
- Description: >-
1132
- Checks for the usage of unneeded trailing underscores at the
1133
- end of parallel variable assignment.
1134
- Enabled: false
1135
-
1136
- Style/VariableInterpolation:
1137
- Description: >-
1138
- Don't interpolate global, instance and class variables
1139
- directly in strings.
1140
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
1141
- Enabled: false
1142
-
1143
- Style/VariableName:
1144
- Description: 'Use the configured style when naming variables.'
1145
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
1146
- Enabled: false
1147
-
1148
- Style/WhenThen:
1149
- Description: 'Use when x then ... for one-line cases.'
1150
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
1151
- Enabled: false
1152
-
1153
- Style/WhileUntilDo:
1154
- Description: 'Checks for redundant do after while or until.'
1155
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do'
1156
- Enabled: false
1157
-
1158
- Style/WhileUntilModifier:
1159
- Description: >-
1160
- Favor modifier while/until usage when you have a
1161
- single-line body.
1162
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
1163
- Enabled: false
1164
-
1165
- Style/WordArray:
1166
- Description: 'Use %w or %W for arrays of words.'
1167
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
1168
- Enabled: false