makara 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +11 -0
  3. data/.github/workflows/CI.yml +88 -0
  4. data/.rspec +1 -1
  5. data/.rubocop.yml +15 -0
  6. data/.rubocop_todo.yml +670 -0
  7. data/CHANGELOG.md +14 -6
  8. data/Gemfile +1 -16
  9. data/README.md +2 -1
  10. data/Rakefile +1 -1
  11. data/gemfiles/activerecord_5.2.gemfile +8 -0
  12. data/gemfiles/activerecord_6.0.gemfile +8 -0
  13. data/gemfiles/activerecord_6.1.gemfile +8 -0
  14. data/gemfiles/activerecord_head.gemfile +6 -0
  15. data/lib/active_record/connection_adapters/jdbcmysql_makara_adapter.rb +4 -18
  16. data/lib/active_record/connection_adapters/jdbcpostgresql_makara_adapter.rb +4 -18
  17. data/lib/active_record/connection_adapters/makara_abstract_adapter.rb +3 -31
  18. data/lib/active_record/connection_adapters/makara_jdbcmysql_adapter.rb +4 -18
  19. data/lib/active_record/connection_adapters/makara_jdbcpostgresql_adapter.rb +4 -18
  20. data/lib/active_record/connection_adapters/makara_mysql2_adapter.rb +4 -20
  21. data/lib/active_record/connection_adapters/makara_postgis_adapter.rb +4 -19
  22. data/lib/active_record/connection_adapters/makara_postgresql_adapter.rb +4 -20
  23. data/lib/active_record/connection_adapters/mysql2_makara_adapter.rb +4 -20
  24. data/lib/active_record/connection_adapters/postgresql_makara_adapter.rb +4 -20
  25. data/lib/makara.rb +0 -2
  26. data/lib/makara/cache.rb +0 -2
  27. data/lib/makara/config_parser.rb +5 -14
  28. data/lib/makara/connection_wrapper.rb +24 -27
  29. data/lib/makara/context.rb +1 -0
  30. data/lib/makara/cookie.rb +1 -0
  31. data/lib/makara/error_handler.rb +0 -9
  32. data/lib/makara/errors/all_connections_blacklisted.rb +0 -2
  33. data/lib/makara/errors/blacklist_connection.rb +0 -2
  34. data/lib/makara/errors/blacklisted_while_in_transaction.rb +0 -2
  35. data/lib/makara/errors/invalid_shard.rb +1 -3
  36. data/lib/makara/errors/makara_error.rb +0 -1
  37. data/lib/makara/errors/no_connections_available.rb +0 -2
  38. data/lib/makara/logging/logger.rb +0 -4
  39. data/lib/makara/logging/subscriber.rb +0 -2
  40. data/lib/makara/middleware.rb +1 -2
  41. data/lib/makara/pool.rb +2 -7
  42. data/lib/makara/proxy.rb +25 -27
  43. data/lib/makara/railtie.rb +0 -2
  44. data/lib/makara/strategies/abstract.rb +1 -0
  45. data/lib/makara/strategies/priority_failover.rb +2 -0
  46. data/lib/makara/strategies/round_robin.rb +1 -3
  47. data/lib/makara/strategies/shard_aware.rb +0 -2
  48. data/lib/makara/version.rb +1 -3
  49. data/makara.gemspec +24 -5
  50. data/spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb +1 -6
  51. data/spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb +0 -9
  52. data/spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb +9 -22
  53. data/spec/active_record/connection_adapters/makara_postgis_adapter_spec.rb +2 -10
  54. data/spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb +7 -20
  55. data/spec/cache_spec.rb +0 -1
  56. data/spec/config_parser_spec.rb +54 -56
  57. data/spec/connection_wrapper_spec.rb +1 -2
  58. data/spec/cookie_spec.rb +1 -1
  59. data/spec/middleware_spec.rb +1 -1
  60. data/spec/pool_spec.rb +3 -16
  61. data/spec/proxy_spec.rb +0 -4
  62. data/spec/spec_helper.rb +5 -1
  63. data/spec/strategies/priority_failover_spec.rb +3 -4
  64. data/spec/strategies/round_robin_spec.rb +4 -8
  65. data/spec/strategies/shard_aware_spec.rb +4 -5
  66. data/spec/support/deep_dup.rb +1 -1
  67. data/spec/support/helpers.rb +5 -5
  68. data/spec/support/mock_objects.rb +1 -4
  69. data/spec/support/mysql2_database.yml +2 -2
  70. data/spec/support/mysql2_database_with_custom_errors.yml +2 -2
  71. data/spec/support/pool_extensions.rb +0 -3
  72. data/spec/support/postgis_schema.rb +1 -1
  73. data/spec/support/postgresql_database.yml +0 -2
  74. data/spec/support/proxy_extensions.rb +1 -3
  75. data/spec/support/schema.rb +1 -1
  76. data/spec/support/user.rb +1 -2
  77. metadata +156 -20
  78. data/.travis.yml +0 -131
  79. data/gemfiles/ar-head.gemfile +0 -24
  80. data/gemfiles/ar30.gemfile +0 -36
  81. data/gemfiles/ar31.gemfile +0 -36
  82. data/gemfiles/ar32.gemfile +0 -36
  83. data/gemfiles/ar40.gemfile +0 -24
  84. data/gemfiles/ar41.gemfile +0 -24
  85. data/gemfiles/ar42.gemfile +0 -24
  86. data/gemfiles/ar50.gemfile +0 -24
  87. data/gemfiles/ar51.gemfile +0 -24
  88. data/gemfiles/ar52.gemfile +0 -24
  89. data/gemfiles/ar60.gemfile +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dae82f5608272a2e365b3f75561d7e0359a646101a54d769d854eb1437c49ef
4
- data.tar.gz: b9de62fb9f9ef35029c71b32038ca21c05dd3922a4a6b1ed5ff86578fe5e30ef
3
+ metadata.gz: fca781edcd318b4e4e598fbf7223d38ead88e124a3721258cb5452251a34ec92
4
+ data.tar.gz: 5b9d4fced7583800c371a34a011944a1beef844c61b83cb73ab8668f4d597d11
5
5
  SHA512:
6
- metadata.gz: ba51b69a62b36132cdc4654e2207e2b46c0414386111bd3c9a31d8d7ce9960d51cd662f59b6c4fc2194b677c658c7aaff3d85930a3dbbc4cfe289c261d31311d
7
- data.tar.gz: c0532643db2b517ce248dcead76a01092b9647350671c8794f6b2c19f257fce681579b278ab2c318735a9a6b7f84ebc9aa59ba897a36641645ebd631f1471868
6
+ metadata.gz: e9f4f963a2e577fb347913862f317c797521a2f32df73707b0e17b90b8cf25c76d8328dc9cbedefc16db0bc14a3a5bb144c931a534a9b40ccf5e8822338fd93c
7
+ data.tar.gz: b91fac6c7de164fe396b0a6ae2f30c743d89f093cda8e80d52664d95926ccf96f821d1574386618bb26b8e886f971c3df976b5ebb1153150bbc8b7f8052b402f
@@ -0,0 +1,11 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "bundler" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "daily"
@@ -0,0 +1,88 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby:
16
+ - '2.5'
17
+ - '2.6'
18
+ - '2.7'
19
+ - '3.0'
20
+ - head
21
+ - jruby
22
+ activerecord:
23
+ - '5.2'
24
+ - '6.0'
25
+ - '6.1'
26
+ - head
27
+ exclude:
28
+ - activerecord: '5.2'
29
+ ruby: '3.0'
30
+ - activerecord: '5.2'
31
+ ruby: head
32
+ - activerecord: head
33
+ ruby: '2.5'
34
+ - activerecord: head
35
+ ruby: '2.6'
36
+ continue-on-error: ${{ matrix.ruby == 'jruby' || matrix.ruby == 'head' || matrix.activerecord == 'head' }}
37
+ name: Ruby ${{ matrix.ruby }} / ActiveRecord ${{ matrix.activerecord }}
38
+ services:
39
+ postgres:
40
+ image: postgis/postgis:12-3.1
41
+ ports:
42
+ - 5432:5432
43
+ env:
44
+ POSTGRES_HOST_AUTH_METHOD: trust
45
+ POSTGRES_DB: makara_test
46
+ options: >-
47
+ --health-cmd pg_isready
48
+ --health-interval 10s
49
+ --health-timeout 5s
50
+ --health-retries 5
51
+ mysql:
52
+ image: mysql:5.7
53
+ env:
54
+ MYSQL_ALLOW_EMPTY_PASSWORD: yes
55
+ MYSQL_DATABASE: makara_test
56
+ ports:
57
+ - 3306:3306
58
+ options: >-
59
+ --health-cmd "mysqladmin ping"
60
+ --health-interval 10s
61
+ --health-timeout 5s
62
+ --health-retries 5
63
+ env:
64
+ BUNDLE_GEMFILE: gemfiles/activerecord_${{ matrix.activerecord }}.gemfile
65
+ JRUBY_OPTS: --dev -J-Xmx1024M
66
+ steps:
67
+ - uses: actions/checkout@v2
68
+ - uses: ruby/setup-ruby@v1
69
+ with:
70
+ ruby-version: ${{ matrix.ruby }}
71
+ bundler-cache: true
72
+ - run: |
73
+ bundle exec rake
74
+ env:
75
+ PGHOST: localhost
76
+ PGUSER: postgres
77
+ MYSQL_HOST: 127.0.0.1
78
+ RAILS_ENV: test
79
+ RuboCop:
80
+ runs-on: ubuntu-latest
81
+ steps:
82
+ - uses: actions/checkout@v2
83
+ - uses: ruby/setup-ruby@v1
84
+ with:
85
+ ruby-version: '3.0'
86
+ bundler-cache: true
87
+ - run: |
88
+ bundle exec rubocop --parallel --color
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --color
1
+ --force-color
2
2
  --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,15 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ # The behavior of RuboCop can be controlled via the .rubocop.yml
4
+ # configuration file. It makes it possible to enable/disable
5
+ # certain cops (checks) and to alter their behavior if they accept
6
+ # any parameters. The file can be placed either in your home
7
+ # directory or in some project directory.
8
+ #
9
+ # RuboCop will start looking for the configuration file in the directory
10
+ # where the inspected file is and continue its way up to the root directory.
11
+ #
12
+ # See https://docs.rubocop.org/rubocop/configuration
13
+
14
+ AllCops:
15
+ NewCops: enable
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,670 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-01-19 22:10:17 UTC using RuboCop version 1.8.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/OrderedDependencies:
14
+ Exclude:
15
+ - 'makara.gemspec'
16
+
17
+ # Offense count: 1
18
+ # Configuration parameters: Include.
19
+ # Include: **/*.gemspec
20
+ Gemspec/RequiredRubyVersion:
21
+ Exclude:
22
+ - 'makara.gemspec'
23
+
24
+ # Offense count: 1
25
+ # Cop supports --auto-correct.
26
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
27
+ # SupportedStyles: with_first_argument, with_fixed_indentation
28
+ Layout/ArgumentAlignment:
29
+ Exclude:
30
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
31
+
32
+ # Offense count: 4
33
+ # Cop supports --auto-correct.
34
+ Layout/BlockEndNewline:
35
+ Exclude:
36
+ - 'spec/strategies/shard_aware_spec.rb'
37
+
38
+ # Offense count: 1
39
+ # Cop supports --auto-correct.
40
+ Layout/CommentIndentation:
41
+ Exclude:
42
+ - 'lib/makara/strategies/round_robin.rb'
43
+
44
+ # Offense count: 1
45
+ # Cop supports --auto-correct.
46
+ Layout/ElseAlignment:
47
+ Exclude:
48
+ - 'lib/makara/cookie.rb'
49
+
50
+ # Offense count: 1
51
+ # Cop supports --auto-correct.
52
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
53
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
54
+ Layout/EndAlignment:
55
+ Exclude:
56
+ - 'lib/makara/cookie.rb'
57
+
58
+ # Offense count: 8
59
+ # Cop supports --auto-correct.
60
+ # Configuration parameters: IndentationWidth.
61
+ # SupportedStyles: special_inside_parentheses, consistent, align_brackets
62
+ Layout/FirstArrayElementIndentation:
63
+ EnforcedStyle: consistent
64
+
65
+ # Offense count: 10
66
+ # Cop supports --auto-correct.
67
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
68
+ # SupportedStyles: special_inside_parentheses, consistent, align_braces
69
+ Layout/FirstHashElementIndentation:
70
+ Exclude:
71
+ - 'lib/makara/config_parser.rb'
72
+ - 'spec/strategies/shard_aware_spec.rb'
73
+
74
+ # Offense count: 4
75
+ # Cop supports --auto-correct.
76
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
77
+ # SupportedHashRocketStyles: key, separator, table
78
+ # SupportedColonStyles: key, separator, table
79
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
80
+ Layout/HashAlignment:
81
+ Exclude:
82
+ - 'lib/makara/config_parser.rb'
83
+
84
+ # Offense count: 1
85
+ # Cop supports --auto-correct.
86
+ # Configuration parameters: Width, IgnoredPatterns.
87
+ Layout/IndentationWidth:
88
+ Exclude:
89
+ - 'lib/makara/cookie.rb'
90
+
91
+ # Offense count: 4
92
+ # Cop supports --auto-correct.
93
+ Layout/MultilineBlockLayout:
94
+ Exclude:
95
+ - 'spec/strategies/shard_aware_spec.rb'
96
+
97
+ # Offense count: 2
98
+ # Cop supports --auto-correct.
99
+ # Configuration parameters: EnforcedStyle.
100
+ # SupportedStyles: symmetrical, new_line, same_line
101
+ Layout/MultilineHashBraceLayout:
102
+ Exclude:
103
+ - 'lib/makara/config_parser.rb'
104
+
105
+ # Offense count: 2
106
+ # Cop supports --auto-correct.
107
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
108
+ # SupportedStyles: aligned, indented
109
+ Layout/MultilineOperationIndentation:
110
+ Exclude:
111
+ - 'spec/active_record/connection_adapters/makara_postgis_adapter_spec.rb'
112
+
113
+ # Offense count: 10
114
+ # Cop supports --auto-correct.
115
+ Layout/SpaceAfterComma:
116
+ Exclude:
117
+ - 'lib/makara/config_parser.rb'
118
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb'
119
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb'
120
+ - 'spec/middleware_spec.rb'
121
+ - 'spec/proxy_spec.rb'
122
+ - 'spec/support/deep_dup.rb'
123
+
124
+ # Offense count: 4
125
+ # Cop supports --auto-correct.
126
+ # Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
127
+ # SupportedStylesForExponentOperator: space, no_space
128
+ Layout/SpaceAroundOperators:
129
+ Exclude:
130
+ - 'lib/makara/context.rb'
131
+ - 'lib/makara/proxy.rb'
132
+ - 'spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb'
133
+ - 'spec/context_spec.rb'
134
+
135
+ # Offense count: 144
136
+ # Cop supports --auto-correct.
137
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
138
+ # SupportedStyles: space, no_space
139
+ # SupportedStylesForEmptyBraces: space, no_space
140
+ Layout/SpaceBeforeBlockBraces:
141
+ Enabled: false
142
+
143
+ # Offense count: 2
144
+ # Cop supports --auto-correct.
145
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
146
+ # SupportedStyles: space, no_space, compact
147
+ # SupportedStylesForEmptyBrackets: space, no_space
148
+ Layout/SpaceInsideArrayLiteralBrackets:
149
+ Exclude:
150
+ - 'lib/makara/proxy.rb'
151
+
152
+ # Offense count: 33
153
+ # Cop supports --auto-correct.
154
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
155
+ # SupportedStyles: space, no_space
156
+ # SupportedStylesForEmptyBraces: space, no_space
157
+ Layout/SpaceInsideBlockBraces:
158
+ Exclude:
159
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
160
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb'
161
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
162
+ - 'spec/active_record/connection_adapters/makara_postgis_adapter_spec.rb'
163
+ - 'spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb'
164
+ - 'spec/middleware_spec.rb'
165
+ - 'spec/pool_spec.rb'
166
+ - 'spec/proxy_spec.rb'
167
+ - 'spec/strategies/shard_aware_spec.rb'
168
+
169
+ # Offense count: 40
170
+ # Cop supports --auto-correct.
171
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
172
+ # SupportedStyles: space, no_space, compact
173
+ # SupportedStylesForEmptyBraces: space, no_space
174
+ Layout/SpaceInsideHashLiteralBraces:
175
+ Exclude:
176
+ - 'lib/makara/connection_wrapper.rb'
177
+ - 'spec/connection_wrapper_spec.rb'
178
+ - 'spec/pool_spec.rb'
179
+ - 'spec/strategies/priority_failover_spec.rb'
180
+ - 'spec/strategies/round_robin_spec.rb'
181
+ - 'spec/strategies/shard_aware_spec.rb'
182
+ - 'spec/support/helpers.rb'
183
+
184
+ # Offense count: 2
185
+ # Configuration parameters: AllowedMethods.
186
+ # AllowedMethods: enums
187
+ Lint/ConstantDefinitionInBlock:
188
+ Exclude:
189
+ - 'spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb'
190
+
191
+ # Offense count: 2
192
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
193
+ Lint/DuplicateBranch:
194
+ Exclude:
195
+ - 'lib/makara/proxy.rb'
196
+
197
+ # Offense count: 1
198
+ # Cop supports --auto-correct.
199
+ Lint/IdentityComparison:
200
+ Exclude:
201
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
202
+
203
+ # Offense count: 1
204
+ # Cop supports --auto-correct.
205
+ Lint/Loop:
206
+ Exclude:
207
+ - 'lib/makara/strategies/round_robin.rb'
208
+
209
+ # Offense count: 1
210
+ Lint/NonLocalExitFromIterator:
211
+ Exclude:
212
+ - 'lib/makara/strategies/priority_failover.rb'
213
+
214
+ # Offense count: 2
215
+ Lint/RescueException:
216
+ Exclude:
217
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
218
+ - 'lib/makara/error_handler.rb'
219
+
220
+ # Offense count: 1
221
+ # Cop supports --auto-correct.
222
+ Lint/ScriptPermission:
223
+ Exclude:
224
+ - 'Rakefile'
225
+
226
+ # Offense count: 2
227
+ # Cop supports --auto-correct.
228
+ Lint/SendWithMixinArgument:
229
+ Exclude:
230
+ - 'spec/support/pool_extensions.rb'
231
+ - 'spec/support/proxy_extensions.rb'
232
+
233
+ # Offense count: 2
234
+ # Configuration parameters: AllowComments.
235
+ Lint/SuppressedException:
236
+ Exclude:
237
+ - 'spec/spec_helper.rb'
238
+
239
+ # Offense count: 1
240
+ # Cop supports --auto-correct.
241
+ # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
242
+ Lint/UnusedBlockArgument:
243
+ Exclude:
244
+ - 'lib/makara/strategies/priority_failover.rb'
245
+
246
+ # Offense count: 28
247
+ # Cop supports --auto-correct.
248
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
249
+ Lint/UnusedMethodArgument:
250
+ Exclude:
251
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
252
+ - 'lib/makara/cache.rb'
253
+ - 'lib/makara/connection_wrapper.rb'
254
+ - 'lib/makara/proxy.rb'
255
+ - 'spec/support/mock_objects.rb'
256
+
257
+ # Offense count: 29
258
+ Lint/UselessAssignment:
259
+ Exclude:
260
+ - 'spec/pool_spec.rb'
261
+ - 'spec/proxy_spec.rb'
262
+ - 'spec/strategies/priority_failover_spec.rb'
263
+ - 'spec/strategies/round_robin_spec.rb'
264
+ - 'spec/strategies/shard_aware_spec.rb'
265
+ - 'spec/support/helpers.rb'
266
+
267
+ # Offense count: 5
268
+ # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
269
+ Metrics/AbcSize:
270
+ Max: 28
271
+
272
+ # Offense count: 36
273
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
274
+ # IgnoredMethods: refine
275
+ Metrics/BlockLength:
276
+ Max: 191
277
+
278
+ # Offense count: 3
279
+ # Configuration parameters: CountBlocks.
280
+ Metrics/BlockNesting:
281
+ Max: 4
282
+
283
+ # Offense count: 4
284
+ # Configuration parameters: CountComments, CountAsOne.
285
+ Metrics/ClassLength:
286
+ Max: 240
287
+
288
+ # Offense count: 3
289
+ # Configuration parameters: IgnoredMethods.
290
+ Metrics/CyclomaticComplexity:
291
+ Max: 10
292
+
293
+ # Offense count: 16
294
+ # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
295
+ Metrics/MethodLength:
296
+ Max: 48
297
+
298
+ # Offense count: 3
299
+ # Configuration parameters: IgnoredMethods.
300
+ Metrics/PerceivedComplexity:
301
+ Max: 12
302
+
303
+ # Offense count: 2
304
+ Naming/AccessorMethodName:
305
+ Exclude:
306
+ - 'lib/makara/context.rb'
307
+ - 'lib/makara/middleware.rb'
308
+
309
+ # Offense count: 1
310
+ # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, Regex, IgnoreExecutableScripts, AllowedAcronyms.
311
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
312
+ Naming/FileName:
313
+ Exclude:
314
+ - 'gemfiles/ar-head.gemfile'
315
+
316
+ # Offense count: 2
317
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
318
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
319
+ Naming/MemoizedInstanceVariableName:
320
+ Exclude:
321
+ - 'lib/makara/connection_wrapper.rb'
322
+ - 'lib/makara/context.rb'
323
+
324
+ # Offense count: 8
325
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
326
+ # AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to
327
+ Naming/MethodParameterName:
328
+ Exclude:
329
+ - 'lib/makara/connection_wrapper.rb'
330
+ - 'lib/makara/error_handler.rb'
331
+ - 'lib/makara/logging/logger.rb'
332
+ - 'lib/makara/proxy.rb'
333
+ - 'spec/support/proxy_extensions.rb'
334
+
335
+ # Offense count: 2
336
+ # Cop supports --auto-correct.
337
+ Security/YAMLLoad:
338
+ Exclude:
339
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb'
340
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
341
+
342
+ # Offense count: 12
343
+ # Cop supports --auto-correct.
344
+ # Configuration parameters: EnforcedStyle.
345
+ # SupportedStyles: separated, grouped
346
+ Style/AccessorGrouping:
347
+ Exclude:
348
+ - 'lib/makara/errors/invalid_shard.rb'
349
+ - 'lib/makara/pool.rb'
350
+ - 'lib/makara/proxy.rb'
351
+
352
+ # Offense count: 1
353
+ # Cop supports --auto-correct.
354
+ # Configuration parameters: EnforcedStyle.
355
+ # SupportedStyles: prefer_alias, prefer_alias_method
356
+ Style/Alias:
357
+ Exclude:
358
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
359
+
360
+ # Offense count: 2
361
+ # Cop supports --auto-correct.
362
+ # Configuration parameters: EnforcedStyle.
363
+ # SupportedStyles: percent_q, bare_percent
364
+ Style/BarePercentLiterals:
365
+ Exclude:
366
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb'
367
+
368
+ # Offense count: 16
369
+ # Cop supports --auto-correct.
370
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
371
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
372
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
373
+ # FunctionalMethods: let, let!, subject, watch
374
+ # IgnoredMethods: lambda, proc, it
375
+ Style/BlockDelimiters:
376
+ Exclude:
377
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb'
378
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
379
+ - 'spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb'
380
+ - 'spec/config_parser_spec.rb'
381
+ - 'spec/middleware_spec.rb'
382
+ - 'spec/pool_spec.rb'
383
+ - 'spec/strategies/round_robin_spec.rb'
384
+ - 'spec/strategies/shard_aware_spec.rb'
385
+
386
+ # Offense count: 1
387
+ # Cop supports --auto-correct.
388
+ # Configuration parameters: AllowOnConstant.
389
+ Style/CaseEquality:
390
+ Exclude:
391
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
392
+
393
+ # Offense count: 1
394
+ # Cop supports --auto-correct.
395
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
396
+ # SupportedStyles: assign_to_condition, assign_inside_condition
397
+ Style/ConditionalAssignment:
398
+ Exclude:
399
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
400
+
401
+ # Offense count: 41
402
+ Style/Documentation:
403
+ Enabled: false
404
+
405
+ # Offense count: 1
406
+ # Cop supports --auto-correct.
407
+ # Configuration parameters: EnforcedStyle.
408
+ # SupportedStyles: allowed_in_returns, forbidden
409
+ Style/DoubleNegation:
410
+ Exclude:
411
+ - 'lib/makara/context.rb'
412
+
413
+ # Offense count: 2
414
+ # Cop supports --auto-correct.
415
+ Style/ExpandPathArguments:
416
+ Exclude:
417
+ - 'makara.gemspec'
418
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb'
419
+
420
+ # Offense count: 4
421
+ # Cop supports --auto-correct.
422
+ Style/ExplicitBlockArgument:
423
+ Exclude:
424
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
425
+ - 'lib/makara/proxy.rb'
426
+
427
+ # Offense count: 66
428
+ # Cop supports --auto-correct.
429
+ # Configuration parameters: EnforcedStyle.
430
+ # SupportedStyles: always, always_true, never
431
+ Style/FrozenStringLiteralComment:
432
+ Enabled: false
433
+
434
+ # Offense count: 7
435
+ # Configuration parameters: MinBodyLength.
436
+ Style/GuardClause:
437
+ Exclude:
438
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
439
+ - 'lib/makara/context.rb'
440
+ - 'lib/makara/cookie.rb'
441
+ - 'lib/makara/pool.rb'
442
+ - 'lib/makara/strategies/round_robin.rb'
443
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
444
+
445
+ # Offense count: 16
446
+ # Cop supports --auto-correct.
447
+ Style/IfUnlessModifier:
448
+ Exclude:
449
+ - 'lib/makara/config_parser.rb'
450
+ - 'lib/makara/connection_wrapper.rb'
451
+ - 'lib/makara/context.rb'
452
+ - 'lib/makara/cookie.rb'
453
+ - 'lib/makara/middleware.rb'
454
+ - 'lib/makara/proxy.rb'
455
+ - 'lib/makara/strategies/round_robin.rb'
456
+ - 'spec/pool_spec.rb'
457
+ - 'spec/spec_helper.rb'
458
+ - 'spec/strategies/priority_failover_spec.rb'
459
+ - 'spec/strategies/round_robin_spec.rb'
460
+ - 'spec/strategies/shard_aware_spec.rb'
461
+
462
+ # Offense count: 2
463
+ Style/MultilineBlockChain:
464
+ Exclude:
465
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
466
+ - 'spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb'
467
+
468
+ # Offense count: 1
469
+ # Cop supports --auto-correct.
470
+ Style/MultilineIfModifier:
471
+ Exclude:
472
+ - 'lib/makara/version.rb'
473
+
474
+ # Offense count: 1
475
+ # Cop supports --auto-correct.
476
+ Style/MultilineTernaryOperator:
477
+ Exclude:
478
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
479
+
480
+ # Offense count: 4
481
+ # Cop supports --auto-correct.
482
+ # Configuration parameters: EnforcedStyle.
483
+ # SupportedStyles: literals, strict
484
+ Style/MutableConstant:
485
+ Exclude:
486
+ - 'lib/makara/config_parser.rb'
487
+ - 'lib/makara/cookie.rb'
488
+ - 'lib/makara/logging/subscriber.rb'
489
+ - 'lib/makara/proxy.rb'
490
+
491
+ # Offense count: 2
492
+ # Cop supports --auto-correct.
493
+ # Configuration parameters: EnforcedStyle.
494
+ # SupportedStyles: both, prefix, postfix
495
+ Style/NegatedIf:
496
+ Exclude:
497
+ - 'lib/makara/pool.rb'
498
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
499
+
500
+ # Offense count: 3
501
+ # Cop supports --auto-correct.
502
+ Style/NestedTernaryOperator:
503
+ Exclude:
504
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
505
+
506
+ # Offense count: 3
507
+ # Cop supports --auto-correct.
508
+ # Configuration parameters: EnforcedStyle, IgnoredMethods.
509
+ # SupportedStyles: predicate, comparison
510
+ Style/NumericPredicate:
511
+ Exclude:
512
+ - 'spec/**/*'
513
+ - 'lib/makara/connection_wrapper.rb'
514
+ - 'lib/makara/context.rb'
515
+ - 'lib/makara/proxy.rb'
516
+
517
+ # Offense count: 2
518
+ # Configuration parameters: AllowedMethods.
519
+ # AllowedMethods: respond_to_missing?
520
+ Style/OptionalBooleanParameter:
521
+ Exclude:
522
+ - 'lib/makara/proxy.rb'
523
+ - 'lib/makara/strategies/round_robin.rb'
524
+
525
+ # Offense count: 17
526
+ # Cop supports --auto-correct.
527
+ # Configuration parameters: PreferredDelimiters.
528
+ Style/PercentLiteralDelimiters:
529
+ Exclude:
530
+ - 'makara.gemspec'
531
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_error_handling_spec.rb'
532
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb'
533
+
534
+ # Offense count: 5
535
+ # Cop supports --auto-correct.
536
+ Style/PerlBackrefs:
537
+ Exclude:
538
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
539
+
540
+ # Offense count: 4
541
+ # Cop supports --auto-correct.
542
+ # Configuration parameters: EnforcedStyle, AllowedCompactTypes.
543
+ # SupportedStyles: compact, exploded
544
+ Style/RaiseArgs:
545
+ Exclude:
546
+ - 'lib/makara/pool.rb'
547
+
548
+ # Offense count: 1
549
+ # Cop supports --auto-correct.
550
+ Style/RedundantBegin:
551
+ Exclude:
552
+ - 'spec/strategies/shard_aware_spec.rb'
553
+
554
+ # Offense count: 4
555
+ # Cop supports --auto-correct.
556
+ Style/RedundantPercentQ:
557
+ Exclude:
558
+ - 'makara.gemspec'
559
+ - 'spec/active_record/connection_adapters/makara_abstract_adapter_spec.rb'
560
+
561
+ # Offense count: 1
562
+ # Cop supports --auto-correct.
563
+ Style/RedundantRegexpCharacterClass:
564
+ Exclude:
565
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
566
+
567
+ # Offense count: 3
568
+ # Cop supports --auto-correct.
569
+ Style/RedundantRegexpEscape:
570
+ Exclude:
571
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
572
+ - 'lib/makara/config_parser.rb'
573
+
574
+ # Offense count: 8
575
+ # Cop supports --auto-correct.
576
+ Style/RedundantSelf:
577
+ Exclude:
578
+ - 'lib/makara/context.rb'
579
+ - 'lib/makara/pool.rb'
580
+ - 'lib/makara/proxy.rb'
581
+ - 'spec/support/deep_dup.rb'
582
+
583
+ # Offense count: 1
584
+ # Cop supports --auto-correct.
585
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
586
+ # SupportedStyles: slashes, percent_r, mixed
587
+ Style/RegexpLiteral:
588
+ Exclude:
589
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
590
+
591
+ # Offense count: 2
592
+ # Cop supports --auto-correct.
593
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
594
+ # AllowedMethods: present?, blank?, presence, try, try!
595
+ Style/SafeNavigation:
596
+ Exclude:
597
+ - 'lib/makara/connection_wrapper.rb'
598
+ - 'lib/makara/logging/logger.rb'
599
+
600
+ # Offense count: 1
601
+ # Cop supports --auto-correct.
602
+ Style/SelfAssignment:
603
+ Exclude:
604
+ - 'lib/makara/strategies/round_robin.rb'
605
+
606
+ # Offense count: 2
607
+ # Cop supports --auto-correct.
608
+ # Configuration parameters: AllowModifier.
609
+ Style/SoleNestedConditional:
610
+ Exclude:
611
+ - 'lib/active_record/connection_adapters/makara_abstract_adapter.rb'
612
+ - 'lib/makara/middleware.rb'
613
+
614
+ # Offense count: 1
615
+ # Cop supports --auto-correct.
616
+ # Configuration parameters: .
617
+ # SupportedStyles: use_perl_names, use_english_names
618
+ Style/SpecialGlobalVars:
619
+ EnforcedStyle: use_perl_names
620
+
621
+ # Offense count: 11
622
+ # Cop supports --auto-correct.
623
+ Style/StringConcatenation:
624
+ Exclude:
625
+ - 'spec/active_record/connection_adapters/makara_mysql2_adapter_spec.rb'
626
+ - 'spec/active_record/connection_adapters/makara_postgis_adapter_spec.rb'
627
+ - 'spec/active_record/connection_adapters/makara_postgresql_adapter_spec.rb'
628
+
629
+ # Offense count: 118
630
+ # Cop supports --auto-correct.
631
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
632
+ # SupportedStyles: single_quotes, double_quotes
633
+ Style/StringLiterals:
634
+ Enabled: false
635
+
636
+ # Offense count: 2
637
+ # Cop supports --auto-correct.
638
+ Style/StructInheritance:
639
+ Exclude:
640
+ - 'spec/support/mock_objects.rb'
641
+
642
+ # Offense count: 1
643
+ # Cop supports --auto-correct.
644
+ # Configuration parameters: MinSize.
645
+ # SupportedStyles: percent, brackets
646
+ Style/SymbolArray:
647
+ EnforcedStyle: brackets
648
+
649
+ # Offense count: 3
650
+ # Cop supports --auto-correct.
651
+ # Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, AllowedMethods.
652
+ # AllowedMethods: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
653
+ Style/TrivialAccessors:
654
+ Exclude:
655
+ - 'lib/makara/config_parser.rb'
656
+ - 'lib/makara/logging/logger.rb'
657
+
658
+ # Offense count: 1
659
+ # Cop supports --auto-correct.
660
+ # Configuration parameters: MinSize, WordRegex.
661
+ # SupportedStyles: percent, brackets
662
+ Style/WordArray:
663
+ EnforcedStyle: brackets
664
+
665
+ # Offense count: 25
666
+ # Cop supports --auto-correct.
667
+ # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
668
+ # URISchemes: http, https
669
+ Layout/LineLength:
670
+ Max: 225