wavefront-cli 2.7.0 → 2.8.0

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