shipcloud 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +62 -0
- data/.rubocop.yml +310 -313
- data/.ruby-version +1 -1
- data/CHANGELOG.md +21 -4
- data/Gemfile +2 -1
- data/README.md +3 -1
- data/Rakefile +5 -4
- data/bin/setup +7 -0
- data/lib/shipcloud/address.rb +2 -0
- data/lib/shipcloud/base.rb +5 -5
- data/lib/shipcloud/carrier.rb +2 -0
- data/lib/shipcloud/operations/all.rb +2 -0
- data/lib/shipcloud/operations/create.rb +3 -1
- data/lib/shipcloud/operations/delete.rb +2 -0
- data/lib/shipcloud/operations/find.rb +3 -1
- data/lib/shipcloud/operations/update.rb +19 -13
- data/lib/shipcloud/order.rb +15 -0
- data/lib/shipcloud/pickup_request.rb +2 -0
- data/lib/shipcloud/request/base.rb +2 -0
- data/lib/shipcloud/request/connection.rb +11 -3
- data/lib/shipcloud/request/info.rb +6 -5
- data/lib/shipcloud/shipcloud_error.rb +7 -0
- data/lib/shipcloud/shipment.rb +5 -2
- data/lib/shipcloud/shipment_quote.rb +2 -0
- data/lib/shipcloud/tracker.rb +1 -0
- data/lib/shipcloud/version.rb +3 -1
- data/lib/shipcloud/webhook.rb +2 -0
- data/lib/shipcloud.rb +1 -0
- data/shipcloud.gemspec +7 -6
- data/spec/shipcloud/address_spec.rb +66 -42
- data/spec/shipcloud/carrier_spec.rb +53 -52
- data/spec/shipcloud/order_spec.rb +188 -0
- data/spec/shipcloud/pickup_request_spec.rb +14 -13
- data/spec/shipcloud/request/base_spec.rb +3 -2
- data/spec/shipcloud/request/connection_spec.rb +1 -0
- data/spec/shipcloud/shipcloud_error_spec.rb +8 -7
- data/spec/shipcloud/shipment_quote_spec.rb +5 -4
- data/spec/shipcloud/shipment_spec.rb +135 -78
- data/spec/shipcloud/webhooks_spec.rb +5 -4
- data/spec/shipcloud_spec.rb +5 -2
- data/spec/spec_helper.rb +3 -2
- metadata +22 -21
- data/.hound.yml +0 -12
- data/.travis.yml +0 -27
- data/install-cc-test-reporter.sh +0 -4
data/.rubocop.yml
CHANGED
@@ -1,11 +1,240 @@
|
|
1
1
|
require: rubocop-performance
|
2
2
|
|
3
3
|
AllCops:
|
4
|
+
NewCops: enable
|
4
5
|
TargetRubyVersion: 2.6
|
5
6
|
Exclude:
|
6
7
|
- vendor/**/*
|
7
8
|
- bin/*
|
8
9
|
|
10
|
+
# rubocop
|
11
|
+
# https://github.com/rubocop-hq/rubocop/blob/master/config/default.yml
|
12
|
+
|
13
|
+
# Layout - https://docs.rubocop.org/rubocop/cops_layout.html
|
14
|
+
|
15
|
+
Layout/ConditionPosition:
|
16
|
+
Description: >-
|
17
|
+
Checks for condition placed in a confusing position relative to
|
18
|
+
the keyword.
|
19
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Layout/DotPosition:
|
23
|
+
Description: 'Checks the position of the dot in multi-line method calls.'
|
24
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
25
|
+
EnforcedStyle: trailing
|
26
|
+
|
27
|
+
Layout/EmptyLineAfterMagicComment:
|
28
|
+
Description: 'Add an empty line after magic comments to separate them from code.'
|
29
|
+
StyleGuide: '#separate-magic-comments-from-code'
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
33
|
+
Description: "Keep blank lines around attribute accessors."
|
34
|
+
Enabled: true
|
35
|
+
|
36
|
+
Layout/ExtraSpacing:
|
37
|
+
Description: 'Do not use unnecessary spacing.'
|
38
|
+
Enabled: true
|
39
|
+
|
40
|
+
Layout/FirstArrayElementLineBreak:
|
41
|
+
Description: >-
|
42
|
+
Checks for a line break before the first element in a
|
43
|
+
multi-line array.
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
Layout/FirstHashElementLineBreak:
|
47
|
+
Description: >-
|
48
|
+
Checks for a line break before the first element in a
|
49
|
+
multi-line hash.
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
Layout/FirstMethodArgumentLineBreak:
|
53
|
+
Description: >-
|
54
|
+
Checks for a line break before the first argument in a
|
55
|
+
multi-line method call.
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
Layout/InitialIndentation:
|
59
|
+
Description: >-
|
60
|
+
Checks the indentation of the first non-blank non-comment line in a file.
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Layout/LineLength:
|
64
|
+
Description: "Limit lines to 100 characters."
|
65
|
+
Max: 100
|
66
|
+
Enabled: true
|
67
|
+
|
68
|
+
Layout/MultilineMethodCallIndentation:
|
69
|
+
Description: >-
|
70
|
+
Checks indentation of method calls with the dot operator
|
71
|
+
that span more than one line.
|
72
|
+
Enabled: true
|
73
|
+
EnforcedStyle: indented
|
74
|
+
|
75
|
+
Layout/MultilineOperationIndentation:
|
76
|
+
Description: >-
|
77
|
+
Checks indentation of binary operations that span more than
|
78
|
+
one line.
|
79
|
+
Enabled: true
|
80
|
+
EnforcedStyle: indented
|
81
|
+
|
82
|
+
# Lint - https://docs.rubocop.org/rubocop/cops_lint.html
|
83
|
+
|
84
|
+
Lint/AmbiguousOperator:
|
85
|
+
Description: >-
|
86
|
+
Checks for ambiguous operators in the first argument of a
|
87
|
+
method invocation without parentheses.
|
88
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Lint/AmbiguousRegexpLiteral:
|
92
|
+
Description: >-
|
93
|
+
Checks for ambiguous regexp literals in the first argument of
|
94
|
+
a method invocation without parenthesis.
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Lint/AssignmentInCondition:
|
98
|
+
Description: "Don't use assignment in conditions."
|
99
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
100
|
+
Enabled: false
|
101
|
+
|
102
|
+
Lint/DeprecatedClassMethods:
|
103
|
+
Description: 'Check for deprecated class method calls.'
|
104
|
+
Enabled: false
|
105
|
+
|
106
|
+
Lint/DuplicateHashKey:
|
107
|
+
Description: 'Check for duplicate keys in hash literals.'
|
108
|
+
Enabled: false
|
109
|
+
|
110
|
+
Lint/EachWithObjectArgument:
|
111
|
+
Description: 'Check for immutable argument given to each_with_object.'
|
112
|
+
Enabled: false
|
113
|
+
|
114
|
+
Lint/ElseLayout:
|
115
|
+
Description: 'Check for odd code arrangement in an else block.'
|
116
|
+
Enabled: false
|
117
|
+
|
118
|
+
Lint/FlipFlop:
|
119
|
+
Description: 'Checks for flip flops'
|
120
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
|
121
|
+
Enabled: false
|
122
|
+
|
123
|
+
Lint/FormatParameterMismatch:
|
124
|
+
Description: 'The number of parameters to format/sprint must match the fields.'
|
125
|
+
Enabled: false
|
126
|
+
|
127
|
+
Lint/LiteralAsCondition:
|
128
|
+
Description: 'Checks of literals used in conditions.'
|
129
|
+
Enabled: false
|
130
|
+
|
131
|
+
Lint/LiteralInInterpolation:
|
132
|
+
Description: 'Checks for literals used in interpolation.'
|
133
|
+
Enabled: false
|
134
|
+
|
135
|
+
Lint/Loop:
|
136
|
+
Description: >-
|
137
|
+
Use Kernel#loop with break rather than begin/end/until or
|
138
|
+
begin/end/while for post-loop tests.
|
139
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
|
140
|
+
Enabled: false
|
141
|
+
|
142
|
+
Lint/NestedMethodDefinition:
|
143
|
+
Description: 'Do not use nested method definitions.'
|
144
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
|
145
|
+
Enabled: false
|
146
|
+
|
147
|
+
Lint/NonDeterministicRequireOrder:
|
148
|
+
Description: 'Always sort arrays returned by Dir.glob when requiring files.'
|
149
|
+
Enabled: true
|
150
|
+
|
151
|
+
Lint/NonLocalExitFromIterator:
|
152
|
+
Description: 'Do not use return in iterator to cause non-local exit.'
|
153
|
+
Enabled: false
|
154
|
+
|
155
|
+
Lint/ParenthesesAsGroupedExpression:
|
156
|
+
Description: >-
|
157
|
+
Checks for method calls with a space before the opening
|
158
|
+
parenthesis.
|
159
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
160
|
+
Enabled: false
|
161
|
+
|
162
|
+
Lint/RaiseException:
|
163
|
+
Description: Checks for `raise` or `fail` statements which are raising `Exception` class.
|
164
|
+
Enabled: true
|
165
|
+
|
166
|
+
Lint/RedundantCopDisableDirective:
|
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: false
|
172
|
+
|
173
|
+
Lint/RequireParentheses:
|
174
|
+
Description: >-
|
175
|
+
Use parentheses in the method call to avoid confusion
|
176
|
+
about precedence.
|
177
|
+
Enabled: false
|
178
|
+
|
179
|
+
Lint/SuppressedException:
|
180
|
+
Description: "Don't suppress exception."
|
181
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
182
|
+
Enabled: false
|
183
|
+
|
184
|
+
Lint/UnderscorePrefixedVariableName:
|
185
|
+
Description: 'Do not use prefix `_` for a variable that is used.'
|
186
|
+
Enabled: false
|
187
|
+
|
188
|
+
Lint/Void:
|
189
|
+
Description: 'Possible use of operator/literal/variable in void context.'
|
190
|
+
Enabled: false
|
191
|
+
|
192
|
+
# Metrics - https://docs.rubocop.org/rubocop/cops_metrics.html
|
193
|
+
|
194
|
+
Metrics/AbcSize:
|
195
|
+
Description: >-
|
196
|
+
A calculated magnitude based on number of assignments,
|
197
|
+
branches, and conditions.
|
198
|
+
Enabled: false
|
199
|
+
|
200
|
+
Metrics/BlockLength:
|
201
|
+
Description: 'Avoid long blocks with many lines.'
|
202
|
+
Enabled: true
|
203
|
+
IgnoredMethods: [task, namespace, describe, context, factory, it]
|
204
|
+
Exclude:
|
205
|
+
- !ruby/regexp /config/routes.rb$/
|
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: false
|
211
|
+
|
212
|
+
Metrics/ClassLength:
|
213
|
+
Description: 'Avoid classes longer than 100 lines of code.'
|
214
|
+
Enabled: false
|
215
|
+
|
216
|
+
Metrics/CyclomaticComplexity:
|
217
|
+
Description: >-
|
218
|
+
A complexity metric that is strongly correlated to the number
|
219
|
+
of test cases needed to validate a method.
|
220
|
+
Enabled: false
|
221
|
+
|
222
|
+
Metrics/MethodLength:
|
223
|
+
Description: 'Avoid methods longer than 10 lines of code.'
|
224
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
|
225
|
+
Enabled: false
|
226
|
+
|
227
|
+
Metrics/ModuleLength:
|
228
|
+
Description: 'Avoid modules longer than 100 lines of code.'
|
229
|
+
Enabled: false
|
230
|
+
|
231
|
+
Metrics/ParameterLists:
|
232
|
+
Description: 'Avoid parameter lists longer than three or four parameters.'
|
233
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
|
234
|
+
Enabled: false
|
235
|
+
|
236
|
+
# Naming - https://docs.rubocop.org/rubocop/cops_naming.html
|
237
|
+
|
9
238
|
Naming/AccessorMethodName:
|
10
239
|
Description: Check the naming of accessor methods for get_/set_.
|
11
240
|
Enabled: false
|
@@ -15,16 +244,16 @@ Naming/AsciiIdentifiers:
|
|
15
244
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
16
245
|
Enabled: false
|
17
246
|
|
18
|
-
Naming/FileName:
|
19
|
-
Description: 'Use snake_case for source file names.'
|
20
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
21
|
-
Enabled: false
|
22
|
-
|
23
247
|
Naming/BinaryOperatorParameterName:
|
24
248
|
Description: 'When defining binary operators, name the argument other.'
|
25
249
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
|
26
250
|
Enabled: false
|
27
251
|
|
252
|
+
Naming/FileName:
|
253
|
+
Description: 'Use snake_case for source file names.'
|
254
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
255
|
+
Enabled: false
|
256
|
+
|
28
257
|
Naming/MemoizedInstanceVariableName:
|
29
258
|
Description: Memoized method name should match memo instance variable name.
|
30
259
|
Enabled: true
|
@@ -37,21 +266,33 @@ Naming/PredicateName:
|
|
37
266
|
- is_
|
38
267
|
- has_
|
39
268
|
- have_
|
40
|
-
|
269
|
+
ForbiddenPrefixes:
|
41
270
|
- is_
|
42
271
|
Exclude:
|
43
|
-
- spec
|
272
|
+
- !ruby/regexp /spec(\/.*)*\/.*\.rb$/
|
44
273
|
|
45
274
|
Naming/RescuedExceptionsVariableName:
|
46
275
|
Description: 'Use consistent rescued exceptions variables naming.'
|
47
276
|
Enabled: true
|
48
277
|
PreferredName: error
|
49
278
|
|
279
|
+
# Style - https://docs.rubocop.org/rubocop/cops_style.html
|
280
|
+
|
281
|
+
Style/AccessorGrouping:
|
282
|
+
Description: 'Checks for grouping of accessors in `class` and `module` bodies.'
|
283
|
+
Enabled: true
|
284
|
+
|
50
285
|
Style/Alias:
|
51
286
|
Description: 'Use alias_method instead of alias.'
|
52
287
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
|
53
288
|
Enabled: false
|
54
289
|
|
290
|
+
Style/ArrayCoercion:
|
291
|
+
Description: >-
|
292
|
+
Use Array() instead of explicit Array check or [*var], when dealing
|
293
|
+
with a variable you want to treat as an Array, but you're not certain it's an array.
|
294
|
+
Enabled: true
|
295
|
+
|
55
296
|
Style/ArrayJoin:
|
56
297
|
Description: 'Use Array#join instead of Array#*.'
|
57
298
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
|
@@ -72,6 +313,10 @@ Style/CaseEquality:
|
|
72
313
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
|
73
314
|
Enabled: false
|
74
315
|
|
316
|
+
Style/CaseLikeIf:
|
317
|
+
Description: 'This cop identifies places where `if-elsif` constructions can be replaced with `case-when`.'
|
318
|
+
Enabled: true
|
319
|
+
|
75
320
|
Style/CharacterLiteral:
|
76
321
|
Description: 'Checks for uses of character literals.'
|
77
322
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
|
@@ -107,11 +352,6 @@ Style/CommentAnnotation:
|
|
107
352
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
|
108
353
|
Enabled: false
|
109
354
|
|
110
|
-
Style/PreferredHashMethods:
|
111
|
-
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
112
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
|
113
|
-
Enabled: false
|
114
|
-
|
115
355
|
Style/Documentation:
|
116
356
|
Description: 'Document classes and non-namespace modules.'
|
117
357
|
Enabled: false
|
@@ -141,11 +381,6 @@ Style/EvenOdd:
|
|
141
381
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
142
382
|
Enabled: false
|
143
383
|
|
144
|
-
Lint/FlipFlop:
|
145
|
-
Description: 'Checks for flip flops'
|
146
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
|
147
|
-
Enabled: false
|
148
|
-
|
149
384
|
Style/FormatString:
|
150
385
|
Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
|
151
386
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
|
@@ -162,6 +397,30 @@ Style/GuardClause:
|
|
162
397
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
|
163
398
|
Enabled: false
|
164
399
|
|
400
|
+
Style/HashAsLastArrayItem:
|
401
|
+
Description: >-
|
402
|
+
Checks for presence or absence of braces around hash literal as a last
|
403
|
+
array item depending on configuration.
|
404
|
+
Enabled: true
|
405
|
+
|
406
|
+
Style/HashEachMethods:
|
407
|
+
Description: 'Use Hash#each_key and Hash#each_value.'
|
408
|
+
Enabled: false
|
409
|
+
|
410
|
+
Style/HashLikeCase:
|
411
|
+
Description: >-
|
412
|
+
Checks for places where `case-when` represents a simple 1:1
|
413
|
+
mapping and can be replaced with a hash lookup.
|
414
|
+
Enabled: true
|
415
|
+
|
416
|
+
Style/HashTransformKeys:
|
417
|
+
Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
|
418
|
+
Enabled: false
|
419
|
+
|
420
|
+
Style/HashTransformValues:
|
421
|
+
Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
|
422
|
+
Enabled: false
|
423
|
+
|
165
424
|
Style/IfUnlessModifier:
|
166
425
|
Description: >-
|
167
426
|
Favor modifier if/unless usage when you have a
|
@@ -174,13 +433,11 @@ Style/IfWithSemicolon:
|
|
174
433
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
|
175
434
|
Enabled: false
|
176
435
|
|
177
|
-
Style/InlineComment:
|
178
|
-
Description: 'Avoid inline comments.'
|
179
|
-
Enabled: false
|
180
|
-
|
181
436
|
Style/IpAddresses:
|
182
437
|
Description: "Don't include literal IP addresses in code."
|
183
438
|
Enabled: true
|
439
|
+
Exclude:
|
440
|
+
- !ruby/regexp /spec(\/.*)*\/.*\.rb$/
|
184
441
|
|
185
442
|
Style/Lambda:
|
186
443
|
Description: 'Use the new lambda literal syntax for single-line blocks.'
|
@@ -249,6 +506,16 @@ Style/OneLineConditional:
|
|
249
506
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
|
250
507
|
Enabled: false
|
251
508
|
|
509
|
+
Style/OptionHash:
|
510
|
+
Description: Don\'t use option hashes when you can use keyword arguments.
|
511
|
+
SuspiciousParamNames:
|
512
|
+
- options
|
513
|
+
- opts
|
514
|
+
- args
|
515
|
+
- params
|
516
|
+
- parameters
|
517
|
+
Enabled: true
|
518
|
+
|
252
519
|
Style/PercentLiteralDelimiters:
|
253
520
|
Description: 'Use `%`-literal delimiters consistently'
|
254
521
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
|
@@ -259,6 +526,11 @@ Style/PerlBackrefs:
|
|
259
526
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
260
527
|
Enabled: false
|
261
528
|
|
529
|
+
Style/PreferredHashMethods:
|
530
|
+
Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
|
531
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
|
532
|
+
Enabled: false
|
533
|
+
|
262
534
|
Style/Proc:
|
263
535
|
Description: 'Use proc instead of Proc.new.'
|
264
536
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
|
@@ -269,6 +541,12 @@ Style/RaiseArgs:
|
|
269
541
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
|
270
542
|
Enabled: false
|
271
543
|
|
544
|
+
Style/RedundantFetchBlock:
|
545
|
+
Description: >-
|
546
|
+
Use `fetch(key, value)` instead of `fetch(key) { value }`
|
547
|
+
when value has Numeric, Rational, Complex, Symbol or String type, `false`, `true`, `nil` or is a constant.
|
548
|
+
Enabled: true
|
549
|
+
|
272
550
|
Style/RegexpLiteral:
|
273
551
|
Description: 'Use / or %r around regular expressions.'
|
274
552
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
|
@@ -288,6 +566,11 @@ Style/SelfAssignment:
|
|
288
566
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
|
289
567
|
Enabled: false
|
290
568
|
|
569
|
+
Style/SignalException:
|
570
|
+
Description: 'Checks for proper usage of fail and raise.'
|
571
|
+
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
|
572
|
+
Enabled: false
|
573
|
+
|
291
574
|
Style/SingleLineBlockParams:
|
292
575
|
Description: 'Enforces the names of some block params.'
|
293
576
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
|
@@ -298,10 +581,9 @@ Style/SingleLineMethods:
|
|
298
581
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
|
299
582
|
Enabled: false
|
300
583
|
|
301
|
-
Style/
|
302
|
-
Description: 'Checks
|
303
|
-
|
304
|
-
Enabled: false
|
584
|
+
Style/SlicingWithRange:
|
585
|
+
Description: 'Checks array slicing is done with endless ranges when suitable.'
|
586
|
+
Enabled: true
|
305
587
|
|
306
588
|
Style/SpecialGlobalVars:
|
307
589
|
Description: 'Avoid Perl-style global variables.'
|
@@ -314,16 +596,6 @@ Style/StringLiterals:
|
|
314
596
|
EnforcedStyle: double_quotes
|
315
597
|
Enabled: true
|
316
598
|
|
317
|
-
Style/StringLiteralsInInterpolation:
|
318
|
-
Description: >-
|
319
|
-
Checks if uses of quotes inside expressions in interpolated strings
|
320
|
-
match the configured preference.
|
321
|
-
Enabled: true
|
322
|
-
EnforcedStyle: single_quotes
|
323
|
-
SupportedStyles:
|
324
|
-
- single_quotes
|
325
|
-
- double_quotes
|
326
|
-
|
327
599
|
Style/SymbolArray:
|
328
600
|
Enabled: false
|
329
601
|
|
@@ -386,233 +658,10 @@ Style/WordArray:
|
|
386
658
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
|
387
659
|
Enabled: false
|
388
660
|
|
389
|
-
|
390
|
-
|
391
|
-
SuspiciousParamNames:
|
392
|
-
- options
|
393
|
-
- opts
|
394
|
-
- args
|
395
|
-
- params
|
396
|
-
- parameters
|
397
|
-
Enabled: true
|
398
|
-
|
399
|
-
# Layout
|
400
|
-
|
401
|
-
Layout/ConditionPosition:
|
402
|
-
Description: >-
|
403
|
-
Checks for condition placed in a confusing position relative to
|
404
|
-
the keyword.
|
405
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
|
406
|
-
Enabled: false
|
407
|
-
|
408
|
-
Layout/DotPosition:
|
409
|
-
Description: 'Checks the position of the dot in multi-line method calls.'
|
410
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
411
|
-
EnforcedStyle: trailing
|
412
|
-
|
413
|
-
Layout/EmptyLineAfterMagicComment:
|
414
|
-
Description: 'Add an empty line after magic comments to separate them from code.'
|
415
|
-
StyleGuide: '#separate-magic-comments-from-code'
|
416
|
-
Enabled: false
|
417
|
-
|
418
|
-
Layout/ExtraSpacing:
|
419
|
-
Description: 'Do not use unnecessary spacing.'
|
420
|
-
Enabled: true
|
421
|
-
|
422
|
-
Layout/FirstArrayElementLineBreak:
|
423
|
-
Description: >-
|
424
|
-
Checks for a line break before the first element in a
|
425
|
-
multi-line array.
|
426
|
-
Enabled: true
|
427
|
-
|
428
|
-
Layout/FirstHashElementLineBreak:
|
429
|
-
Description: >-
|
430
|
-
Checks for a line break before the first element in a
|
431
|
-
multi-line hash.
|
432
|
-
Enabled: true
|
433
|
-
|
434
|
-
Layout/FirstMethodArgumentLineBreak:
|
435
|
-
Description: >-
|
436
|
-
Checks for a line break before the first argument in a
|
437
|
-
multi-line method call.
|
438
|
-
Enabled: true
|
439
|
-
|
440
|
-
Layout/InitialIndentation:
|
441
|
-
Description: >-
|
442
|
-
Checks the indentation of the first non-blank non-comment line in a file.
|
443
|
-
Enabled: false
|
444
|
-
|
445
|
-
Layout/MultilineMethodCallIndentation:
|
446
|
-
Description: >-
|
447
|
-
Checks indentation of method calls with the dot operator
|
448
|
-
that span more than one line.
|
449
|
-
Enabled: true
|
450
|
-
EnforcedStyle: indented
|
451
|
-
|
452
|
-
Layout/MultilineOperationIndentation:
|
453
|
-
Description: >-
|
454
|
-
Checks indentation of binary operations that span more than
|
455
|
-
one line.
|
456
|
-
Enabled: true
|
457
|
-
EnforcedStyle: indented
|
458
|
-
|
459
|
-
# Lint
|
460
|
-
|
461
|
-
Lint/AmbiguousOperator:
|
462
|
-
Description: >-
|
463
|
-
Checks for ambiguous operators in the first argument of a
|
464
|
-
method invocation without parentheses.
|
465
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
|
466
|
-
Enabled: false
|
467
|
-
|
468
|
-
Lint/AmbiguousRegexpLiteral:
|
469
|
-
Description: >-
|
470
|
-
Checks for ambiguous regexp literals in the first argument of
|
471
|
-
a method invocation without parenthesis.
|
472
|
-
Enabled: false
|
473
|
-
|
474
|
-
Lint/AssignmentInCondition:
|
475
|
-
Description: "Don't use assignment in conditions."
|
476
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
477
|
-
Enabled: false
|
478
|
-
|
479
|
-
Lint/CircularArgumentReference:
|
480
|
-
Description: "Don't refer to the keyword argument in the default value."
|
481
|
-
Enabled: true
|
482
|
-
|
483
|
-
Lint/DeprecatedClassMethods:
|
484
|
-
Description: 'Check for deprecated class method calls.'
|
485
|
-
Enabled: false
|
486
|
-
|
487
|
-
Lint/DuplicatedKey:
|
488
|
-
Description: 'Check for duplicate keys in hash literals.'
|
489
|
-
Enabled: false
|
661
|
+
# rubocop-performance
|
662
|
+
# https://github.com/rubocop-hq/rubocop-performance/blob/master/config/default.yml
|
490
663
|
|
491
|
-
|
492
|
-
Description: 'Check for immutable argument given to each_with_object.'
|
493
|
-
Enabled: false
|
494
|
-
|
495
|
-
Lint/ElseLayout:
|
496
|
-
Description: 'Check for odd code arrangement in an else block.'
|
497
|
-
Enabled: false
|
498
|
-
|
499
|
-
Lint/FormatParameterMismatch:
|
500
|
-
Description: 'The number of parameters to format/sprint must match the fields.'
|
501
|
-
Enabled: false
|
502
|
-
|
503
|
-
Lint/HandleExceptions:
|
504
|
-
Description: "Don't suppress exception."
|
505
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
506
|
-
Enabled: false
|
507
|
-
|
508
|
-
Lint/LiteralAsCondition:
|
509
|
-
Description: 'Checks of literals used in conditions.'
|
510
|
-
Enabled: false
|
511
|
-
|
512
|
-
Lint/LiteralInInterpolation:
|
513
|
-
Description: 'Checks for literals used in interpolation.'
|
514
|
-
Enabled: false
|
515
|
-
|
516
|
-
Lint/Loop:
|
517
|
-
Description: >-
|
518
|
-
Use Kernel#loop with break rather than begin/end/until or
|
519
|
-
begin/end/while for post-loop tests.
|
520
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
|
521
|
-
Enabled: false
|
522
|
-
|
523
|
-
Lint/NestedMethodDefinition:
|
524
|
-
Description: 'Do not use nested method definitions.'
|
525
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
|
526
|
-
Enabled: false
|
527
|
-
|
528
|
-
Lint/NonLocalExitFromIterator:
|
529
|
-
Description: 'Do not use return in iterator to cause non-local exit.'
|
530
|
-
Enabled: false
|
531
|
-
|
532
|
-
Lint/ParenthesesAsGroupedExpression:
|
533
|
-
Description: >-
|
534
|
-
Checks for method calls with a space before the opening
|
535
|
-
parenthesis.
|
536
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
537
|
-
Enabled: false
|
538
|
-
|
539
|
-
Lint/RequireParentheses:
|
540
|
-
Description: >-
|
541
|
-
Use parentheses in the method call to avoid confusion
|
542
|
-
about precedence.
|
543
|
-
Enabled: false
|
544
|
-
|
545
|
-
Lint/UnderscorePrefixedVariableName:
|
546
|
-
Description: 'Do not use prefix `_` for a variable that is used.'
|
547
|
-
Enabled: false
|
548
|
-
|
549
|
-
Lint/UnneededCopDisableDirective:
|
550
|
-
Description: >-
|
551
|
-
Checks for rubocop:disable comments that can be removed.
|
552
|
-
Note: this cop is not disabled when disabling all cops.
|
553
|
-
It must be explicitly disabled.
|
554
|
-
Enabled: false
|
555
|
-
|
556
|
-
Lint/Void:
|
557
|
-
Description: 'Possible use of operator/literal/variable in void context.'
|
558
|
-
Enabled: false
|
559
|
-
|
560
|
-
# Metrics
|
561
|
-
|
562
|
-
Metrics/AbcSize:
|
563
|
-
Description: >-
|
564
|
-
A calculated magnitude based on number of assignments,
|
565
|
-
branches, and conditions.
|
566
|
-
Enabled: false
|
567
|
-
|
568
|
-
Metrics/BlockLength:
|
569
|
-
Description: 'Avoid long blocks with many lines.'
|
570
|
-
Enabled: true
|
571
|
-
Exclude:
|
572
|
-
- "gems/**/*_spec.rb"
|
573
|
-
- "spec/**/*"
|
574
|
-
- "config/routes.rb"
|
575
|
-
|
576
|
-
Metrics/BlockNesting:
|
577
|
-
Description: 'Avoid excessive block nesting'
|
578
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
|
579
|
-
Enabled: false
|
580
|
-
|
581
|
-
Metrics/ClassLength:
|
582
|
-
Description: 'Avoid classes longer than 100 lines of code.'
|
583
|
-
Enabled: false
|
584
|
-
|
585
|
-
Metrics/CyclomaticComplexity:
|
586
|
-
Description: >-
|
587
|
-
A complexity metric that is strongly correlated to the number
|
588
|
-
of test cases needed to validate a method.
|
589
|
-
Enabled: false
|
590
|
-
|
591
|
-
Metrics/LineLength:
|
592
|
-
Description: 'Limit lines to 100 characters.'
|
593
|
-
Max: 100
|
594
|
-
|
595
|
-
Metrics/MethodLength:
|
596
|
-
Description: 'Avoid methods longer than 10 lines of code.'
|
597
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
|
598
|
-
Enabled: false
|
599
|
-
|
600
|
-
Metrics/ModuleLength:
|
601
|
-
Description: 'Avoid modules longer than 100 lines of code.'
|
602
|
-
Enabled: false
|
603
|
-
|
604
|
-
Metrics/ParameterLists:
|
605
|
-
Description: 'Avoid parameter lists longer than three or four parameters.'
|
606
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
|
607
|
-
Enabled: false
|
608
|
-
|
609
|
-
# Performance
|
610
|
-
|
611
|
-
Performance/CaseWhenSplat:
|
612
|
-
Description: >-
|
613
|
-
Place `when` conditions that use splat at the end
|
614
|
-
of the list of `when` branches.
|
615
|
-
Enabled: false
|
664
|
+
# Performance - https://docs.rubocop.org/rubocop-performance/cops_performance.html
|
616
665
|
|
617
666
|
Performance/Count:
|
618
667
|
Description: >-
|
@@ -659,55 +708,3 @@ Performance/StringReplacement:
|
|
659
708
|
Performance/UnfreezeString:
|
660
709
|
Description: 'Use unary plus to get an unfrozen string literal.'
|
661
710
|
Enabled: false
|
662
|
-
|
663
|
-
# Rails
|
664
|
-
|
665
|
-
Rails/ActionFilter:
|
666
|
-
Description: 'Enforces consistent use of action filter methods.'
|
667
|
-
Enabled: false
|
668
|
-
|
669
|
-
Rails/Date:
|
670
|
-
Description: >-
|
671
|
-
Checks the correct usage of date aware methods,
|
672
|
-
such as Date.today, Date.current etc.
|
673
|
-
Enabled: false
|
674
|
-
|
675
|
-
Rails/Delegate:
|
676
|
-
Description: 'Prefer delegate method for delegations.'
|
677
|
-
Enabled: false
|
678
|
-
|
679
|
-
Rails/FindBy:
|
680
|
-
Description: 'Prefer find_by over where.first.'
|
681
|
-
Enabled: false
|
682
|
-
|
683
|
-
Rails/FindEach:
|
684
|
-
Description: 'Prefer all.find_each over all.find.'
|
685
|
-
Enabled: false
|
686
|
-
|
687
|
-
Rails/HasAndBelongsToMany:
|
688
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
689
|
-
Enabled: false
|
690
|
-
|
691
|
-
Rails/Output:
|
692
|
-
Description: 'Checks for calls to puts, print, etc.'
|
693
|
-
Enabled: false
|
694
|
-
|
695
|
-
Rails/ReadWriteAttribute:
|
696
|
-
Description: >-
|
697
|
-
Checks for read_attribute(:attr) and
|
698
|
-
write_attribute(:attr, val).
|
699
|
-
Enabled: false
|
700
|
-
|
701
|
-
Rails/ScopeArgs:
|
702
|
-
Description: 'Checks the arguments of ActiveRecord scopes.'
|
703
|
-
Enabled: false
|
704
|
-
|
705
|
-
Rails/TimeZone:
|
706
|
-
Description: 'Checks the correct usage of time zone aware methods.'
|
707
|
-
StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
|
708
|
-
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
|
709
|
-
Enabled: false
|
710
|
-
|
711
|
-
Rails/Validation:
|
712
|
-
Description: 'Use validates :attribute, hash of validations.'
|
713
|
-
Enabled: false
|