launchdarkly-server-sdk 5.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +134 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.gitignore +15 -0
  6. data/.hound.yml +2 -0
  7. data/.rspec +2 -0
  8. data/.rubocop.yml +600 -0
  9. data/.simplecov +4 -0
  10. data/.yardopts +9 -0
  11. data/CHANGELOG.md +261 -0
  12. data/CODEOWNERS +1 -0
  13. data/CONTRIBUTING.md +37 -0
  14. data/Gemfile +3 -0
  15. data/Gemfile.lock +102 -0
  16. data/LICENSE.txt +13 -0
  17. data/README.md +56 -0
  18. data/Rakefile +5 -0
  19. data/azure-pipelines.yml +51 -0
  20. data/ext/mkrf_conf.rb +11 -0
  21. data/launchdarkly-server-sdk.gemspec +40 -0
  22. data/lib/ldclient-rb.rb +29 -0
  23. data/lib/ldclient-rb/cache_store.rb +45 -0
  24. data/lib/ldclient-rb/config.rb +411 -0
  25. data/lib/ldclient-rb/evaluation.rb +455 -0
  26. data/lib/ldclient-rb/event_summarizer.rb +55 -0
  27. data/lib/ldclient-rb/events.rb +468 -0
  28. data/lib/ldclient-rb/expiring_cache.rb +77 -0
  29. data/lib/ldclient-rb/file_data_source.rb +312 -0
  30. data/lib/ldclient-rb/flags_state.rb +76 -0
  31. data/lib/ldclient-rb/impl.rb +13 -0
  32. data/lib/ldclient-rb/impl/integrations/consul_impl.rb +158 -0
  33. data/lib/ldclient-rb/impl/integrations/dynamodb_impl.rb +228 -0
  34. data/lib/ldclient-rb/impl/integrations/redis_impl.rb +155 -0
  35. data/lib/ldclient-rb/impl/store_client_wrapper.rb +47 -0
  36. data/lib/ldclient-rb/impl/store_data_set_sorter.rb +55 -0
  37. data/lib/ldclient-rb/in_memory_store.rb +100 -0
  38. data/lib/ldclient-rb/integrations.rb +55 -0
  39. data/lib/ldclient-rb/integrations/consul.rb +38 -0
  40. data/lib/ldclient-rb/integrations/dynamodb.rb +47 -0
  41. data/lib/ldclient-rb/integrations/redis.rb +55 -0
  42. data/lib/ldclient-rb/integrations/util/store_wrapper.rb +230 -0
  43. data/lib/ldclient-rb/interfaces.rb +153 -0
  44. data/lib/ldclient-rb/ldclient.rb +424 -0
  45. data/lib/ldclient-rb/memoized_value.rb +32 -0
  46. data/lib/ldclient-rb/newrelic.rb +17 -0
  47. data/lib/ldclient-rb/non_blocking_thread_pool.rb +46 -0
  48. data/lib/ldclient-rb/polling.rb +78 -0
  49. data/lib/ldclient-rb/redis_store.rb +87 -0
  50. data/lib/ldclient-rb/requestor.rb +101 -0
  51. data/lib/ldclient-rb/simple_lru_cache.rb +25 -0
  52. data/lib/ldclient-rb/stream.rb +141 -0
  53. data/lib/ldclient-rb/user_filter.rb +51 -0
  54. data/lib/ldclient-rb/util.rb +50 -0
  55. data/lib/ldclient-rb/version.rb +3 -0
  56. data/scripts/gendocs.sh +11 -0
  57. data/scripts/release.sh +27 -0
  58. data/spec/config_spec.rb +63 -0
  59. data/spec/evaluation_spec.rb +739 -0
  60. data/spec/event_summarizer_spec.rb +63 -0
  61. data/spec/events_spec.rb +642 -0
  62. data/spec/expiring_cache_spec.rb +76 -0
  63. data/spec/feature_store_spec_base.rb +213 -0
  64. data/spec/file_data_source_spec.rb +255 -0
  65. data/spec/fixtures/feature.json +37 -0
  66. data/spec/fixtures/feature1.json +36 -0
  67. data/spec/fixtures/user.json +9 -0
  68. data/spec/flags_state_spec.rb +81 -0
  69. data/spec/http_util.rb +109 -0
  70. data/spec/in_memory_feature_store_spec.rb +12 -0
  71. data/spec/integrations/consul_feature_store_spec.rb +42 -0
  72. data/spec/integrations/dynamodb_feature_store_spec.rb +105 -0
  73. data/spec/integrations/store_wrapper_spec.rb +276 -0
  74. data/spec/ldclient_spec.rb +471 -0
  75. data/spec/newrelic_spec.rb +5 -0
  76. data/spec/polling_spec.rb +120 -0
  77. data/spec/redis_feature_store_spec.rb +95 -0
  78. data/spec/requestor_spec.rb +214 -0
  79. data/spec/segment_store_spec_base.rb +95 -0
  80. data/spec/simple_lru_cache_spec.rb +24 -0
  81. data/spec/spec_helper.rb +9 -0
  82. data/spec/store_spec.rb +10 -0
  83. data/spec/stream_spec.rb +60 -0
  84. data/spec/user_filter_spec.rb +91 -0
  85. data/spec/util_spec.rb +17 -0
  86. data/spec/version_spec.rb +7 -0
  87. metadata +375 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2645356ab5b30892fd39ceff79a949ba920ece48
4
+ data.tar.gz: 44a8f04e4d11658940e279054d21b9a58af5b85e
5
+ SHA512:
6
+ metadata.gz: 3a1b235df9a437555afb40df28c1f6774eaf256eadb183217e2fd55428f6b8a631a41f5fee657dd86665915f02c5e9ef2e32fab224272a05d0400a56eb3cce62
7
+ data.tar.gz: 1a5c81cd039e80188c66c13f063d4118cfc6ee1ad24c0ccf9a91e5e1484cf84db10a3fc19c1aca70d877780df3a7b5faaf2f99cd8d2321460dda5f8281a79686
@@ -0,0 +1,134 @@
1
+ version: 2
2
+
3
+ workflows:
4
+ version: 2
5
+ test:
6
+ jobs:
7
+ - test-misc-rubies
8
+ - test-2.2
9
+ - test-2.3
10
+ - test-2.4
11
+ - test-2.5
12
+ - test-2.6
13
+ - test-jruby-9.2
14
+
15
+ ruby-docker-template: &ruby-docker-template
16
+ steps:
17
+ - checkout
18
+ - run: |
19
+ if [[ $CIRCLE_JOB == test-jruby* ]]; then
20
+ gem install jruby-openssl; # required by bundler, no effect on Ruby MRI
21
+ fi
22
+ - run: ruby -v
23
+ - run: gem install bundler -v 1.17.3
24
+ - run: bundle install
25
+ - run: mkdir ./rspec
26
+ - run: bundle exec rspec --format progress --format RspecJunitFormatter -o ./rspec/rspec.xml spec
27
+ - store_test_results:
28
+ path: ./rspec
29
+ - store_artifacts:
30
+ path: ./rspec
31
+
32
+ jobs:
33
+ test-2.2:
34
+ <<: *ruby-docker-template
35
+ docker:
36
+ - image: circleci/ruby:2.2.10-jessie
37
+ - image: consul
38
+ - image: redis
39
+ - image: amazon/dynamodb-local
40
+ test-2.3:
41
+ <<: *ruby-docker-template
42
+ docker:
43
+ - image: circleci/ruby:2.3.7-jessie
44
+ - image: consul
45
+ - image: redis
46
+ - image: amazon/dynamodb-local
47
+ test-2.4:
48
+ <<: *ruby-docker-template
49
+ docker:
50
+ - image: circleci/ruby:2.4.5-stretch
51
+ - image: consul
52
+ - image: redis
53
+ - image: amazon/dynamodb-local
54
+ test-2.5:
55
+ <<: *ruby-docker-template
56
+ docker:
57
+ - image: circleci/ruby:2.5.3-stretch
58
+ - image: consul
59
+ - image: redis
60
+ - image: amazon/dynamodb-local
61
+ test-2.6:
62
+ <<: *ruby-docker-template
63
+ docker:
64
+ - image: circleci/ruby:2.6.2-stretch
65
+ - image: consul
66
+ - image: redis
67
+ - image: amazon/dynamodb-local
68
+ test-jruby-9.2:
69
+ <<: *ruby-docker-template
70
+ docker:
71
+ - image: circleci/jruby:9-jdk
72
+ - image: consul
73
+ - image: redis
74
+ - image: amazon/dynamodb-local
75
+
76
+ # The following very slow job uses an Ubuntu container to run the Ruby versions that
77
+ # CircleCI doesn't provide Docker images for.
78
+ test-misc-rubies:
79
+ machine:
80
+ image: circleci/classic:latest
81
+ environment:
82
+ - RUBIES: "jruby-9.1.17.0"
83
+ steps:
84
+ - run: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
85
+ - run: sudo apt-get -q update
86
+ - run: sudo apt-get -qy install redis-server
87
+ - run: sudo apt-cache policy docker-ce
88
+ - run: sudo apt-get -qy install docker-ce
89
+ - checkout
90
+ - run:
91
+ name: install all Ruby versions
92
+ command: "parallel rvm install ::: $RUBIES"
93
+ - run:
94
+ name: bundle install for all versions
95
+ shell: /bin/bash -leo pipefail # need -l in order for "rvm use" to work
96
+ command: |
97
+ set -e;
98
+ for i in $RUBIES;
99
+ do
100
+ rvm use $i;
101
+ if [[ $i == jruby* ]]; then
102
+ gem install jruby-openssl; # required by bundler, no effect on Ruby MRI
103
+ fi
104
+ # bundler 2.0 may be preinstalled, we need to remove it if so
105
+ yes | gem uninstall bundler --version '>=2.0' || true;
106
+ gem install bundler -v 1.17.3;
107
+ bundle install;
108
+ mv Gemfile.lock "Gemfile.lock.$i"
109
+ done
110
+ - run:
111
+ name: start DynamoDB
112
+ command: docker run -p 8000:8000 amazon/dynamodb-local
113
+ background: true
114
+ - run:
115
+ name: download Consul
116
+ command: wget https://releases.hashicorp.com/consul/0.8.0/consul_0.8.0_linux_amd64.zip
117
+ - run:
118
+ name: extract Consul
119
+ command: unzip consul_0.8.0_linux_amd64.zip
120
+ - run:
121
+ name: start Consul
122
+ command: ./consul agent -dev
123
+ background: true
124
+ - run:
125
+ name: run tests for all versions
126
+ shell: /bin/bash -leo pipefail
127
+ command: |
128
+ set -e;
129
+ for i in $RUBIES;
130
+ do
131
+ rvm use $i;
132
+ cp "Gemfile.lock.$i" Gemfile.lock;
133
+ bundle exec rspec spec;
134
+ done
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is this a support request?**
11
+ This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the SDK code. If you're not sure whether the problem you are having is specifically related to the SDK, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/) and clicking "submit a request", or by emailing support@launchdarkly.com.
12
+
13
+ Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.
14
+
15
+ **Describe the bug**
16
+ A clear and concise description of what the bug is.
17
+
18
+ **To reproduce**
19
+ Steps to reproduce the behavior.
20
+
21
+ **Expected behavior**
22
+ A clear and concise description of what you expected to happen.
23
+
24
+ **Logs**
25
+ If applicable, add any log output related to your problem.
26
+
27
+ **SDK version**
28
+ The version of this SDK that you are using.
29
+
30
+ **Language version, developer tools**
31
+ For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.
32
+
33
+ **OS/platform**
34
+ For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version.
35
+
36
+ **Additional context**
37
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context about the feature request here.
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ *.bundle
10
+ *.so
11
+ *.o
12
+ *.a
13
+ mkmf.log
14
+ *.gem
15
+ .DS_Store
data/.hound.yml ADDED
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .rubocop
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --order random
data/.rubocop.yml ADDED
@@ -0,0 +1,600 @@
1
+ AllCops:
2
+ Exclude:
3
+ - db/schema.rb
4
+
5
+ Style/AccessorMethodName:
6
+ Description: Check the naming of accessor methods for get_/set_.
7
+ Enabled: false
8
+
9
+ Style/Alias:
10
+ Description: 'Use alias_method instead of alias.'
11
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
12
+ Enabled: false
13
+
14
+ Style/ArrayJoin:
15
+ Description: 'Use Array#join instead of Array#*.'
16
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
17
+ Enabled: false
18
+
19
+ Style/AsciiComments:
20
+ Description: 'Use only ascii symbols in comments.'
21
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
22
+ Enabled: false
23
+
24
+ Style/AsciiIdentifiers:
25
+ Description: 'Use only ascii symbols in identifiers.'
26
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
27
+ Enabled: false
28
+
29
+ Style/Attr:
30
+ Description: 'Checks for uses of Module#attr.'
31
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
32
+ Enabled: false
33
+
34
+ Metrics/BlockNesting:
35
+ Description: 'Avoid excessive block nesting'
36
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
37
+ Enabled: false
38
+
39
+ Style/CaseEquality:
40
+ Description: 'Avoid explicit use of the case equality operator(===).'
41
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
42
+ Enabled: false
43
+
44
+ Style/CharacterLiteral:
45
+ Description: 'Checks for uses of character literals.'
46
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
47
+ Enabled: false
48
+
49
+ Style/ClassAndModuleChildren:
50
+ Description: 'Checks style of children classes and modules.'
51
+ Enabled: true
52
+ EnforcedStyle: nested
53
+
54
+ Metrics/ClassLength:
55
+ Description: 'Avoid classes longer than 100 lines of code.'
56
+ Enabled: false
57
+
58
+ Metrics/ModuleLength:
59
+ Description: 'Avoid modules longer than 100 lines of code.'
60
+ Enabled: false
61
+
62
+ Style/ClassVars:
63
+ Description: 'Avoid the use of class variables.'
64
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
65
+ Enabled: false
66
+
67
+ Style/CollectionMethods:
68
+ Enabled: true
69
+ PreferredMethods:
70
+ find: detect
71
+ inject: reduce
72
+ collect: map
73
+ find_all: select
74
+
75
+ Style/ColonMethodCall:
76
+ Description: 'Do not use :: for method call.'
77
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
78
+ Enabled: false
79
+
80
+ Style/CommentAnnotation:
81
+ Description: >-
82
+ Checks formatting of special comments
83
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
84
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
85
+ Enabled: false
86
+
87
+ Metrics/CyclomaticComplexity:
88
+ Description: >-
89
+ A complexity metric that is strongly correlated to the number
90
+ of test cases needed to validate a method.
91
+ Enabled: false
92
+
93
+ Rails/Delegate:
94
+ Description: 'Prefer delegate method for delegations.'
95
+ Enabled: false
96
+
97
+ Style/PreferredHashMethods:
98
+ Description: 'Checks for use of deprecated Hash methods.'
99
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
100
+ Enabled: false
101
+
102
+ Style/Documentation:
103
+ Description: 'Document classes and non-namespace modules.'
104
+ Enabled: false
105
+
106
+ Style/DoubleNegation:
107
+ Description: 'Checks for uses of double negation (!!).'
108
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
109
+ Enabled: false
110
+
111
+ Style/EachWithObject:
112
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
113
+ Enabled: false
114
+
115
+ Style/EmptyLiteral:
116
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
117
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
118
+ Enabled: false
119
+
120
+ # Checks whether the source file has a utf-8 encoding comment or not
121
+ # AutoCorrectEncodingComment must match the regex
122
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
123
+ Style/Encoding:
124
+ Enabled: false
125
+
126
+ Style/EvenOdd:
127
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
128
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
129
+ Enabled: false
130
+
131
+ Style/FileName:
132
+ Description: 'Use snake_case for source file names.'
133
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
134
+ Enabled: false
135
+
136
+ Style/FlipFlop:
137
+ Description: 'Checks for flip flops'
138
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
139
+ Enabled: false
140
+
141
+ Style/FormatString:
142
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
143
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
144
+ Enabled: false
145
+
146
+ Style/GlobalVars:
147
+ Description: 'Do not introduce global variables.'
148
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
149
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
150
+ Enabled: false
151
+
152
+ Style/GuardClause:
153
+ Description: 'Check for conditionals that can be replaced with guard clauses'
154
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
155
+ Enabled: false
156
+
157
+ Style/IfUnlessModifier:
158
+ Description: >-
159
+ Favor modifier if/unless usage when you have a
160
+ single-line body.
161
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
162
+ Enabled: false
163
+
164
+ Style/IfWithSemicolon:
165
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
166
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
167
+ Enabled: false
168
+
169
+ Style/InlineComment:
170
+ Description: 'Avoid inline comments.'
171
+ Enabled: false
172
+
173
+ Style/Lambda:
174
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
175
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
176
+ Enabled: false
177
+
178
+ Style/LambdaCall:
179
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
180
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
181
+ Enabled: false
182
+
183
+ Style/LineEndConcatenation:
184
+ Description: >-
185
+ Use \ instead of + or << to concatenate two string literals at
186
+ line end.
187
+ Enabled: false
188
+
189
+ Metrics/LineLength:
190
+ Description: 'Limit lines to 150 characters.'
191
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
192
+ Max: 150
193
+
194
+ Metrics/MethodLength:
195
+ Description: 'Avoid methods longer than 10 lines of code.'
196
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
197
+ Enabled: false
198
+
199
+ Style/ModuleFunction:
200
+ Description: 'Checks for usage of `extend self` in modules.'
201
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
202
+ Enabled: false
203
+
204
+ Style/NegatedIf:
205
+ Description: >-
206
+ Favor unless over if for negative conditions
207
+ (or control flow or).
208
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
209
+ Enabled: false
210
+
211
+ Style/NegatedWhile:
212
+ Description: 'Favor until over while for negative conditions.'
213
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
214
+ Enabled: false
215
+
216
+ Style/Next:
217
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
218
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
219
+ Enabled: false
220
+
221
+ Style/NilComparison:
222
+ Description: 'Prefer x.nil? to x == nil.'
223
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
224
+ Enabled: false
225
+
226
+ Style/Not:
227
+ Description: 'Use ! instead of not.'
228
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
229
+ Enabled: false
230
+
231
+ Style/NumericLiterals:
232
+ Description: >-
233
+ Add underscores to large numeric literals to improve their
234
+ readability.
235
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
236
+ Enabled: false
237
+
238
+ Style/OneLineConditional:
239
+ Description: >-
240
+ Favor the ternary operator(?:) over
241
+ if/then/else/end constructs.
242
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
243
+ Enabled: false
244
+
245
+ Style/OpMethod:
246
+ Description: 'When defining binary operators, name the argument other.'
247
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
248
+ Enabled: false
249
+
250
+ Metrics/ParameterLists:
251
+ Description: 'Avoid parameter lists longer than three or four parameters.'
252
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
253
+ Enabled: false
254
+
255
+ Style/PercentLiteralDelimiters:
256
+ Description: 'Use `%`-literal delimiters consistently'
257
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
258
+ Enabled: false
259
+
260
+ Style/PerlBackrefs:
261
+ Description: 'Avoid Perl-style regex back references.'
262
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
263
+ Enabled: false
264
+
265
+ Style/PredicateName:
266
+ Description: 'Check the names of predicate methods.'
267
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
268
+ NamePrefixBlacklist:
269
+ - is_
270
+ Exclude:
271
+ - spec/**/*
272
+
273
+ Style/Proc:
274
+ Description: 'Use proc instead of Proc.new.'
275
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
276
+ Enabled: false
277
+
278
+ Style/RaiseArgs:
279
+ Description: 'Checks the arguments passed to raise/fail.'
280
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
281
+ Enabled: false
282
+
283
+ Style/RegexpLiteral:
284
+ Description: 'Use / or %r around regular expressions.'
285
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
286
+ Enabled: false
287
+
288
+ Style/SelfAssignment:
289
+ Description: >-
290
+ Checks for places where self-assignment shorthand should have
291
+ been used.
292
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
293
+ Enabled: false
294
+
295
+ Style/SingleLineBlockParams:
296
+ Description: 'Enforces the names of some block params.'
297
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
298
+ Enabled: false
299
+
300
+ Style/SingleLineMethods:
301
+ Description: 'Avoid single-line methods.'
302
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
303
+ Enabled: false
304
+
305
+ Style/SignalException:
306
+ Description: 'Checks for proper usage of fail and raise.'
307
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
308
+ Enabled: false
309
+
310
+ Style/SpecialGlobalVars:
311
+ Description: 'Avoid Perl-style global variables.'
312
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
313
+ Enabled: false
314
+
315
+ Style/StringLiterals:
316
+ Description: 'Checks if uses of quotes match the configured preference.'
317
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
318
+ EnforcedStyle: double_quotes
319
+ Enabled: true
320
+
321
+ Style/TrailingCommaInArguments:
322
+ Description: 'Checks for trailing comma in argument lists.'
323
+ StyleGuide: '#no-trailing-params-comma'
324
+ Enabled: true
325
+
326
+ Style/TrailingCommaInLiteral:
327
+ Description: 'Checks for trailing comma in array and hash literals.'
328
+ StyleGuide: '#no-trailing-array-commas'
329
+ Enabled: true
330
+
331
+ Style/TrivialAccessors:
332
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
333
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
334
+ Enabled: false
335
+
336
+ Style/VariableInterpolation:
337
+ Description: >-
338
+ Don't interpolate global, instance and class variables
339
+ directly in strings.
340
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
341
+ Enabled: false
342
+
343
+ Style/WhenThen:
344
+ Description: 'Use when x then ... for one-line cases.'
345
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
346
+ Enabled: false
347
+
348
+ Style/WhileUntilModifier:
349
+ Description: >-
350
+ Favor modifier while/until usage when you have a
351
+ single-line body.
352
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
353
+ Enabled: false
354
+
355
+ Style/WordArray:
356
+ Description: 'Use %w or %W for arrays of words.'
357
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
358
+ Enabled: false
359
+
360
+ # Layout
361
+ Layout/DotPosition:
362
+ Description: 'Checks the position of the dot in multi-line method calls.'
363
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
364
+ EnforcedStyle: trailing
365
+
366
+ Layout/ExtraSpacing:
367
+ Description: 'Do not use unnecessary spacing.'
368
+ Enabled: true
369
+
370
+ Layout/MultilineOperationIndentation:
371
+ Description: >-
372
+ Checks indentation of binary operations that span more than
373
+ one line.
374
+ Enabled: true
375
+ EnforcedStyle: indented
376
+
377
+ Layout/InitialIndentation:
378
+ Description: >-
379
+ Checks the indentation of the first non-blank non-comment line in a file.
380
+ Enabled: false
381
+
382
+
383
+ # Lint
384
+
385
+ Lint/AmbiguousOperator:
386
+ Description: >-
387
+ Checks for ambiguous operators in the first argument of a
388
+ method invocation without parentheses.
389
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
390
+ Enabled: false
391
+
392
+ Lint/AmbiguousRegexpLiteral:
393
+ Description: >-
394
+ Checks for ambiguous regexp literals in the first argument of
395
+ a method invocation without parenthesis.
396
+ Enabled: false
397
+
398
+ Lint/AssignmentInCondition:
399
+ Description: "Don't use assignment in conditions."
400
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
401
+ Enabled: false
402
+
403
+ Lint/CircularArgumentReference:
404
+ Description: "Don't refer to the keyword argument in the default value."
405
+ Enabled: false
406
+
407
+ Lint/ConditionPosition:
408
+ Description: >-
409
+ Checks for condition placed in a confusing position relative to
410
+ the keyword.
411
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
412
+ Enabled: false
413
+
414
+ Lint/DeprecatedClassMethods:
415
+ Description: 'Check for deprecated class method calls.'
416
+ Enabled: false
417
+
418
+ Lint/DuplicatedKey:
419
+ Description: 'Check for duplicate keys in hash literals.'
420
+ Enabled: false
421
+
422
+ Lint/EachWithObjectArgument:
423
+ Description: 'Check for immutable argument given to each_with_object.'
424
+ Enabled: false
425
+
426
+ Lint/ElseLayout:
427
+ Description: 'Check for odd code arrangement in an else block.'
428
+ Enabled: false
429
+
430
+ Lint/FormatParameterMismatch:
431
+ Description: 'The number of parameters to format/sprint must match the fields.'
432
+ Enabled: false
433
+
434
+ Lint/HandleExceptions:
435
+ Description: "Don't suppress exception."
436
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
437
+ Enabled: false
438
+
439
+ Lint/InvalidCharacterLiteral:
440
+ Description: >-
441
+ Checks for invalid character literals with a non-escaped
442
+ whitespace character.
443
+ Enabled: false
444
+
445
+ Lint/LiteralInCondition:
446
+ Description: 'Checks of literals used in conditions.'
447
+ Enabled: false
448
+
449
+ Lint/LiteralInInterpolation:
450
+ Description: 'Checks for literals used in interpolation.'
451
+ Enabled: false
452
+
453
+ Lint/Loop:
454
+ Description: >-
455
+ Use Kernel#loop with break rather than begin/end/until or
456
+ begin/end/while for post-loop tests.
457
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
458
+ Enabled: false
459
+
460
+ Lint/NestedMethodDefinition:
461
+ Description: 'Do not use nested method definitions.'
462
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
463
+ Enabled: false
464
+
465
+ Lint/NonLocalExitFromIterator:
466
+ Description: 'Do not use return in iterator to cause non-local exit.'
467
+ Enabled: false
468
+
469
+ Lint/ParenthesesAsGroupedExpression:
470
+ Description: >-
471
+ Checks for method calls with a space before the opening
472
+ parenthesis.
473
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
474
+ Enabled: false
475
+
476
+ Lint/RequireParentheses:
477
+ Description: >-
478
+ Use parentheses in the method call to avoid confusion
479
+ about precedence.
480
+ Enabled: false
481
+
482
+ Lint/UnderscorePrefixedVariableName:
483
+ Description: 'Do not use prefix `_` for a variable that is used.'
484
+ Enabled: false
485
+
486
+ Lint/UnneededDisable:
487
+ Description: >-
488
+ Checks for rubocop:disable comments that can be removed.
489
+ Note: this cop is not disabled when disabling all cops.
490
+ It must be explicitly disabled.
491
+ Enabled: false
492
+
493
+ Lint/Void:
494
+ Description: 'Possible use of operator/literal/variable in void context.'
495
+ Enabled: false
496
+
497
+ # Performance
498
+
499
+ Performance/CaseWhenSplat:
500
+ Description: >-
501
+ Place `when` conditions that use splat at the end
502
+ of the list of `when` branches.
503
+ Enabled: false
504
+
505
+ Performance/Count:
506
+ Description: >-
507
+ Use `count` instead of `select...size`, `reject...size`,
508
+ `select...count`, `reject...count`, `select...length`,
509
+ and `reject...length`.
510
+ Enabled: false
511
+
512
+ Performance/Detect:
513
+ Description: >-
514
+ Use `detect` instead of `select.first`, `find_all.first`,
515
+ `select.last`, and `find_all.last`.
516
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
517
+ Enabled: false
518
+
519
+ Performance/FlatMap:
520
+ Description: >-
521
+ Use `Enumerable#flat_map`
522
+ instead of `Enumerable#map...Array#flatten(1)`
523
+ or `Enumberable#collect..Array#flatten(1)`
524
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
525
+ Enabled: false
526
+
527
+ Performance/ReverseEach:
528
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
529
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
530
+ Enabled: false
531
+
532
+ Performance/Sample:
533
+ Description: >-
534
+ Use `sample` instead of `shuffle.first`,
535
+ `shuffle.last`, and `shuffle[Fixnum]`.
536
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
537
+ Enabled: false
538
+
539
+ Performance/Size:
540
+ Description: >-
541
+ Use `size` instead of `count` for counting
542
+ the number of elements in `Array` and `Hash`.
543
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
544
+ Enabled: false
545
+
546
+ Performance/StringReplacement:
547
+ Description: >-
548
+ Use `tr` instead of `gsub` when you are replacing the same
549
+ number of characters. Use `delete` instead of `gsub` when
550
+ you are deleting characters.
551
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
552
+ Enabled: false
553
+
554
+ # Rails
555
+
556
+ Rails/ActionFilter:
557
+ Description: 'Enforces consistent use of action filter methods.'
558
+ Enabled: false
559
+
560
+ Rails/Date:
561
+ Description: >-
562
+ Checks the correct usage of date aware methods,
563
+ such as Date.today, Date.current etc.
564
+ Enabled: false
565
+
566
+ Rails/FindBy:
567
+ Description: 'Prefer find_by over where.first.'
568
+ Enabled: false
569
+
570
+ Rails/FindEach:
571
+ Description: 'Prefer all.find_each over all.find.'
572
+ Enabled: false
573
+
574
+ Rails/HasAndBelongsToMany:
575
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
576
+ Enabled: false
577
+
578
+ Rails/Output:
579
+ Description: 'Checks for calls to puts, print, etc.'
580
+ Enabled: false
581
+
582
+ Rails/ReadWriteAttribute:
583
+ Description: >-
584
+ Checks for read_attribute(:attr) and
585
+ write_attribute(:attr, val).
586
+ Enabled: false
587
+
588
+ Rails/ScopeArgs:
589
+ Description: 'Checks the arguments of ActiveRecord scopes.'
590
+ Enabled: false
591
+
592
+ Rails/TimeZone:
593
+ Description: 'Checks the correct usage of time zone aware methods.'
594
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
595
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
596
+ Enabled: false
597
+
598
+ Rails/Validation:
599
+ Description: 'Use validates :attribute, hash of validations.'
600
+ Enabled: false