flipper 0.17.1 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +57 -0
  3. data/Changelog.md +114 -1
  4. data/Dockerfile +1 -1
  5. data/Gemfile +3 -6
  6. data/README.md +103 -47
  7. data/Rakefile +1 -4
  8. data/docs/Adapters.md +9 -9
  9. data/docs/Caveats.md +2 -2
  10. data/docs/DockerCompose.md +0 -1
  11. data/docs/Gates.md +74 -74
  12. data/docs/Optimization.md +70 -47
  13. data/docs/http/README.md +12 -11
  14. data/docs/images/banner.jpg +0 -0
  15. data/docs/read-only/README.md +8 -5
  16. data/examples/basic.rb +1 -12
  17. data/examples/configuring_default.rb +2 -5
  18. data/examples/dsl.rb +13 -24
  19. data/examples/enabled_for_actor.rb +8 -15
  20. data/examples/group.rb +3 -6
  21. data/examples/group_dynamic_lookup.rb +5 -19
  22. data/examples/group_with_members.rb +4 -14
  23. data/examples/importing.rb +1 -1
  24. data/examples/individual_actor.rb +2 -5
  25. data/examples/instrumentation.rb +1 -2
  26. data/examples/memoizing.rb +35 -0
  27. data/examples/percentage_of_actors.rb +6 -16
  28. data/examples/percentage_of_actors_enabled_check.rb +7 -10
  29. data/examples/percentage_of_actors_group.rb +5 -18
  30. data/examples/percentage_of_time.rb +3 -6
  31. data/flipper.gemspec +3 -4
  32. data/lib/flipper.rb +7 -3
  33. data/lib/flipper/adapters/dual_write.rb +67 -0
  34. data/lib/flipper/adapters/http.rb +32 -28
  35. data/lib/flipper/adapters/memory.rb +23 -94
  36. data/lib/flipper/adapters/operation_logger.rb +5 -0
  37. data/lib/flipper/adapters/pstore.rb +8 -1
  38. data/lib/flipper/adapters/sync.rb +7 -7
  39. data/lib/flipper/adapters/sync/interval_synchronizer.rb +1 -1
  40. data/lib/flipper/adapters/sync/synchronizer.rb +1 -0
  41. data/lib/flipper/configuration.rb +33 -7
  42. data/lib/flipper/dsl.rb +8 -0
  43. data/lib/flipper/errors.rb +2 -3
  44. data/lib/flipper/feature.rb +2 -2
  45. data/lib/flipper/identifier.rb +17 -0
  46. data/lib/flipper/middleware/memoizer.rb +30 -15
  47. data/lib/flipper/middleware/setup_env.rb +13 -3
  48. data/lib/flipper/railtie.rb +38 -0
  49. data/lib/flipper/spec/shared_adapter_specs.rb +15 -0
  50. data/lib/flipper/test/shared_adapter_test.rb +16 -1
  51. data/lib/flipper/version.rb +1 -1
  52. data/spec/flipper/adapter_spec.rb +2 -2
  53. data/spec/flipper/adapters/dual_write_spec.rb +71 -0
  54. data/spec/flipper/adapters/http_spec.rb +74 -8
  55. data/spec/flipper/adapters/memory_spec.rb +21 -1
  56. data/spec/flipper/adapters/operation_logger_spec.rb +9 -0
  57. data/spec/flipper/adapters/sync_spec.rb +4 -4
  58. data/spec/flipper/configuration_spec.rb +20 -2
  59. data/spec/flipper/feature_spec.rb +5 -5
  60. data/spec/flipper/identifier_spec.rb +14 -0
  61. data/spec/flipper/middleware/memoizer_spec.rb +95 -35
  62. data/spec/flipper/middleware/setup_env_spec.rb +23 -3
  63. data/spec/flipper/railtie_spec.rb +69 -0
  64. data/spec/{integration_spec.rb → flipper_integration_spec.rb} +0 -0
  65. data/spec/flipper_spec.rb +26 -0
  66. data/spec/helper.rb +3 -3
  67. data/spec/support/descriptions.yml +1 -0
  68. data/spec/support/spec_helpers.rb +25 -0
  69. data/test/test_helper.rb +2 -1
  70. metadata +19 -10
  71. data/.rubocop.yml +0 -52
  72. data/.rubocop_todo.yml +0 -562
  73. data/examples/example_setup.rb +0 -8
@@ -56,21 +56,41 @@ RSpec.describe Flipper::Middleware::SetupEnv do
56
56
  end
57
57
  end
58
58
 
59
- context 'when flipper instance is nil' do
59
+ context 'when flipper instance or block are nil but env flipper is configured' do
60
60
  let(:app) do
61
61
  app = lambda do |env|
62
62
  [200, { 'Content-Type' => 'text/html' }, [env['flipper'].object_id.to_s]]
63
63
  end
64
64
  builder = Rack::Builder.new
65
- builder.use described_class, nil
65
+ builder.use described_class
66
66
  builder.run app
67
67
  builder
68
68
  end
69
69
 
70
- it 'leaves env flipper alone' do
70
+ it 'can use env flipper' do
71
71
  env_flipper = build_flipper
72
72
  get '/', {}, 'flipper' => env_flipper
73
73
  expect(last_response.body).to eq(env_flipper.object_id.to_s)
74
74
  end
75
75
  end
76
+
77
+ context 'when flipper instance or block are nil and default Flipper is configured' do
78
+ let(:app) do
79
+ Flipper.configure do |config|
80
+ config.default { flipper }
81
+ end
82
+ app = lambda do |env|
83
+ [200, { 'Content-Type' => 'text/html' }, [env['flipper'].object_id.to_s]]
84
+ end
85
+ builder = Rack::Builder.new
86
+ builder.use described_class
87
+ builder.run app
88
+ builder
89
+ end
90
+
91
+ it 'can use env flipper' do
92
+ get '/', {}, {}
93
+ expect(last_response.body).to eq(Flipper.object_id.to_s)
94
+ end
95
+ end
76
96
  end
@@ -0,0 +1,69 @@
1
+ require 'helper'
2
+ require 'rails'
3
+ require 'flipper/railtie'
4
+
5
+ RSpec.describe Flipper::Railtie do
6
+ let(:application) do
7
+ app = Class.new(Rails::Application).new(
8
+ railties: [Flipper::Railtie],
9
+ ordered_railties: [Flipper::Railtie]
10
+ )
11
+ app.config.eager_load = false
12
+ app.config.logger = ActiveSupport::Logger.new($stdout)
13
+ app.run_load_hooks!
14
+ end
15
+
16
+ before do
17
+ Rails.application = nil
18
+ end
19
+
20
+ subject do
21
+ application.initialize!
22
+ application
23
+ end
24
+
25
+ describe 'initializers' do
26
+ it 'sets defaults' do
27
+ expect(application.config.flipper.env_key).to eq("flipper")
28
+ expect(application.config.flipper.memoize).to be(true)
29
+ expect(application.config.flipper.preload).to be(true)
30
+ end
31
+
32
+ it "configures instrumentor on default instance" do
33
+ subject
34
+
35
+ expect(Flipper.instance.instrumenter).to eq(ActiveSupport::Notifications)
36
+ end
37
+
38
+ it 'uses Memoizer middleware if config.memoize = true' do
39
+ expect(subject.middleware.last).to eq(Flipper::Middleware::Memoizer)
40
+ end
41
+
42
+ it 'does not use Memoizer middleware if config.memoize = false' do
43
+ # load but don't initialize
44
+ application.config.flipper.memoize = false
45
+
46
+ expect(subject.middleware.last).not_to eq(Flipper::Middleware::Memoizer)
47
+ end
48
+
49
+ it 'passes config to memoizer' do
50
+ # load but don't initialize
51
+ application.config.flipper.update(
52
+ env_key: 'my_flipper',
53
+ preload: [:stats, :search]
54
+ )
55
+
56
+ expect(Flipper::Middleware::Memoizer).to receive(:new).with(application.routes,
57
+ env_key: 'my_flipper', preload: [:stats, :search], if: nil
58
+ )
59
+
60
+ subject # initialize
61
+ end
62
+
63
+ it "defines #flipper_id on AR::Base" do
64
+ subject
65
+ require 'active_record'
66
+ expect(ActiveRecord::Base.ancestors).to include(Flipper::Identifier)
67
+ end
68
+ end
69
+ end
data/spec/flipper_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'helper'
2
+ require 'flipper/cloud'
2
3
 
3
4
  RSpec.describe Flipper do
4
5
  describe '.new' do
@@ -215,6 +216,31 @@ RSpec.describe Flipper do
215
216
  it 'delegates memoizing? to instance' do
216
217
  expect(described_class.memoizing?).to eq(described_class.adapter.memoizing?)
217
218
  end
219
+
220
+ it 'delegates sync stuff to instance and does nothing' do
221
+ expect(described_class.sync).to be(nil)
222
+ expect(described_class.sync_secret).to be(nil)
223
+ end
224
+
225
+ it 'delegates sync stuff to instance for Flipper::Cloud' do
226
+ stub = stub_request(:get, "https://www.flippercloud.io/adapter/features").
227
+ with({
228
+ headers: {
229
+ 'Flipper-Cloud-Token'=>'asdf',
230
+ },
231
+ }).to_return(status: 200, body: '{"features": {}}', headers: {})
232
+ cloud_configuration = Flipper::Cloud::Configuration.new({
233
+ token: "asdf",
234
+ sync_secret: "tasty",
235
+ })
236
+
237
+ described_class.configure do |config|
238
+ config.default { Flipper::Cloud::DSL.new(cloud_configuration) }
239
+ end
240
+ described_class.sync
241
+ expect(described_class.sync_secret).to eq("tasty")
242
+ expect(stub).to have_been_requested
243
+ end
218
244
  end
219
245
 
220
246
  describe '.register' do
data/spec/helper.rb CHANGED
@@ -14,10 +14,10 @@ require 'webmock/rspec'
14
14
  WebMock.disable_net_connect!(allow_localhost: true)
15
15
 
16
16
  require 'flipper'
17
- require 'flipper-ui'
18
- require 'flipper-api'
17
+ require 'flipper/ui'
18
+ require 'flipper/api'
19
19
 
20
- Dir[FlipperRoot.join('spec/support/**/*.rb')].each { |f| require f }
20
+ Dir[FlipperRoot.join('spec/support/**/*.rb')].sort.each { |f| require f }
21
21
 
22
22
  RSpec.configure do |config|
23
23
  config.before(:example) do
@@ -0,0 +1 @@
1
+ some_awesome_feature: 'Awesome feature description'
@@ -1,3 +1,4 @@
1
+ require 'climate_control'
1
2
  require 'json'
2
3
  require 'rack/test'
3
4
 
@@ -56,9 +57,33 @@ module SpecHelpers
56
57
  'more_info' => api_error_code_reference_url,
57
58
  }
58
59
  end
60
+
61
+ def with_modified_env(options, &block)
62
+ ClimateControl.modify(options, &block)
63
+ end
64
+
65
+ def silence
66
+ # Store the original stderr and stdout in order to restore them later
67
+ original_stderr = $stderr
68
+ original_stdout = $stdout
69
+
70
+ # Redirect stderr and stdout
71
+ output = $stderr = $stdout = StringIO.new
72
+
73
+ yield
74
+
75
+ $stderr = original_stderr
76
+ $stdout = original_stdout
77
+
78
+ # Return output
79
+ output.string
80
+ end
59
81
  end
60
82
 
61
83
  RSpec.configure do |config|
84
+ config.order = :random
85
+ Kernel.srand config.seed
86
+
62
87
  config.include Rack::Test::Methods
63
88
  config.include SpecHelpers
64
89
  end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
+ require 'bundler/setup'
1
2
  require 'flipper'
2
3
  require 'minitest/autorun'
3
4
  require 'minitest/unit'
4
- Dir['./lib/flipper/test/*.rb'].each { |f| require(f) }
5
+ Dir['./lib/flipper/test/*.rb'].sort.each { |f| require(f) }
5
6
 
6
7
  FlipperRoot = Pathname(__FILE__).dirname.join('..').expand_path
metadata CHANGED
@@ -1,18 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.21.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-14 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Feature flipper is the act of enabling/disabling features in your application,
14
- ideally without re-deploying or changing anything in your code base. Flipper makes
15
- this extremely easy to do with any backend you would like to use.
13
+ description:
16
14
  email:
17
15
  - nunemaker@gmail.com
18
16
  executables: []
@@ -20,8 +18,7 @@ extensions: []
20
18
  extra_rdoc_files: []
21
19
  files:
22
20
  - ".codeclimate.yml"
23
- - ".rubocop.yml"
24
- - ".rubocop_todo.yml"
21
+ - ".github/workflows/ci.yml"
25
22
  - CODE_OF_CONDUCT.md
26
23
  - Changelog.md
27
24
  - Dockerfile
@@ -38,18 +35,19 @@ files:
38
35
  - docs/Optimization.md
39
36
  - docs/api/README.md
40
37
  - docs/http/README.md
38
+ - docs/images/banner.jpg
41
39
  - docs/read-only/README.md
42
40
  - examples/basic.rb
43
41
  - examples/configuring_default.rb
44
42
  - examples/dsl.rb
45
43
  - examples/enabled_for_actor.rb
46
- - examples/example_setup.rb
47
44
  - examples/group.rb
48
45
  - examples/group_dynamic_lookup.rb
49
46
  - examples/group_with_members.rb
50
47
  - examples/importing.rb
51
48
  - examples/individual_actor.rb
52
49
  - examples/instrumentation.rb
50
+ - examples/memoizing.rb
53
51
  - examples/percentage_of_actors.rb
54
52
  - examples/percentage_of_actors_enabled_check.rb
55
53
  - examples/percentage_of_actors_group.rb
@@ -58,6 +56,7 @@ files:
58
56
  - lib/flipper.rb
59
57
  - lib/flipper/actor.rb
60
58
  - lib/flipper/adapter.rb
59
+ - lib/flipper/adapters/dual_write.rb
61
60
  - lib/flipper/adapters/http.rb
62
61
  - lib/flipper/adapters/http/client.rb
63
62
  - lib/flipper/adapters/http/error.rb
@@ -83,6 +82,7 @@ files:
83
82
  - lib/flipper/gates/group.rb
84
83
  - lib/flipper/gates/percentage_of_actors.rb
85
84
  - lib/flipper/gates/percentage_of_time.rb
85
+ - lib/flipper/identifier.rb
86
86
  - lib/flipper/instrumentation/log_subscriber.rb
87
87
  - lib/flipper/instrumentation/statsd.rb
88
88
  - lib/flipper/instrumentation/statsd_subscriber.rb
@@ -92,6 +92,7 @@ files:
92
92
  - lib/flipper/metadata.rb
93
93
  - lib/flipper/middleware/memoizer.rb
94
94
  - lib/flipper/middleware/setup_env.rb
95
+ - lib/flipper/railtie.rb
95
96
  - lib/flipper/registry.rb
96
97
  - lib/flipper/spec/shared_adapter_specs.rb
97
98
  - lib/flipper/test/shared_adapter_test.rb
@@ -107,6 +108,7 @@ files:
107
108
  - spec/fixtures/feature.json
108
109
  - spec/flipper/actor_spec.rb
109
110
  - spec/flipper/adapter_spec.rb
111
+ - spec/flipper/adapters/dual_write_spec.rb
110
112
  - spec/flipper/adapters/http_spec.rb
111
113
  - spec/flipper/adapters/instrumented_spec.rb
112
114
  - spec/flipper/adapters/memoizable_spec.rb
@@ -129,12 +131,14 @@ files:
129
131
  - spec/flipper/gates/group_spec.rb
130
132
  - spec/flipper/gates/percentage_of_actors_spec.rb
131
133
  - spec/flipper/gates/percentage_of_time_spec.rb
134
+ - spec/flipper/identifier_spec.rb
132
135
  - spec/flipper/instrumentation/log_subscriber_spec.rb
133
136
  - spec/flipper/instrumentation/statsd_subscriber_spec.rb
134
137
  - spec/flipper/instrumenters/memory_spec.rb
135
138
  - spec/flipper/instrumenters/noop_spec.rb
136
139
  - spec/flipper/middleware/memoizer_spec.rb
137
140
  - spec/flipper/middleware/setup_env_spec.rb
141
+ - spec/flipper/railtie_spec.rb
138
142
  - spec/flipper/registry_spec.rb
139
143
  - spec/flipper/typecast_spec.rb
140
144
  - spec/flipper/types/actor_spec.rb
@@ -143,9 +147,10 @@ files:
143
147
  - spec/flipper/types/percentage_of_actors_spec.rb
144
148
  - spec/flipper/types/percentage_of_time_spec.rb
145
149
  - spec/flipper/types/percentage_spec.rb
150
+ - spec/flipper_integration_spec.rb
146
151
  - spec/flipper_spec.rb
147
152
  - spec/helper.rb
148
- - spec/integration_spec.rb
153
+ - spec/support/descriptions.yml
149
154
  - spec/support/fake_udp_socket.rb
150
155
  - spec/support/spec_helpers.rb
151
156
  - test/adapters/memory_test.rb
@@ -180,6 +185,7 @@ test_files:
180
185
  - spec/fixtures/feature.json
181
186
  - spec/flipper/actor_spec.rb
182
187
  - spec/flipper/adapter_spec.rb
188
+ - spec/flipper/adapters/dual_write_spec.rb
183
189
  - spec/flipper/adapters/http_spec.rb
184
190
  - spec/flipper/adapters/instrumented_spec.rb
185
191
  - spec/flipper/adapters/memoizable_spec.rb
@@ -202,12 +208,14 @@ test_files:
202
208
  - spec/flipper/gates/group_spec.rb
203
209
  - spec/flipper/gates/percentage_of_actors_spec.rb
204
210
  - spec/flipper/gates/percentage_of_time_spec.rb
211
+ - spec/flipper/identifier_spec.rb
205
212
  - spec/flipper/instrumentation/log_subscriber_spec.rb
206
213
  - spec/flipper/instrumentation/statsd_subscriber_spec.rb
207
214
  - spec/flipper/instrumenters/memory_spec.rb
208
215
  - spec/flipper/instrumenters/noop_spec.rb
209
216
  - spec/flipper/middleware/memoizer_spec.rb
210
217
  - spec/flipper/middleware/setup_env_spec.rb
218
+ - spec/flipper/railtie_spec.rb
211
219
  - spec/flipper/registry_spec.rb
212
220
  - spec/flipper/typecast_spec.rb
213
221
  - spec/flipper/types/actor_spec.rb
@@ -216,9 +224,10 @@ test_files:
216
224
  - spec/flipper/types/percentage_of_actors_spec.rb
217
225
  - spec/flipper/types/percentage_of_time_spec.rb
218
226
  - spec/flipper/types/percentage_spec.rb
227
+ - spec/flipper_integration_spec.rb
219
228
  - spec/flipper_spec.rb
220
229
  - spec/helper.rb
221
- - spec/integration_spec.rb
230
+ - spec/support/descriptions.yml
222
231
  - spec/support/fake_udp_socket.rb
223
232
  - spec/support/spec_helpers.rb
224
233
  - test/adapters/memory_test.rb
data/.rubocop.yml DELETED
@@ -1,52 +0,0 @@
1
- # This is the configuration used to check the rubocop source code.
2
-
3
- require: rubocop-rspec
4
- inherit_from:
5
- - .rubocop_todo.yml
6
-
7
- AllCops:
8
- Exclude:
9
- - 'docker-compose/**/*'
10
- - 'examples/**/*'
11
- - 'tmp/**/*'
12
- - 'bin/**/*'
13
- - 'vendor/bundle/**/*'
14
- TargetRubyVersion: 2.6
15
- Style/Alias:
16
- Enabled: false
17
-
18
- Style/Documentation:
19
- Enabled: false
20
-
21
- Style/Encoding:
22
- Enabled: false
23
-
24
- Style/NumericLiterals:
25
- Enabled: false
26
-
27
- Style/StringLiterals:
28
- Enabled: false
29
-
30
- Style/GuardClause:
31
- Enabled: false
32
-
33
- Style/IfUnlessModifier:
34
- Enabled: false
35
-
36
- Metrics/LineLength:
37
- Max: 100
38
-
39
- Style/RegexpLiteral:
40
- EnforcedStyle: mixed
41
-
42
- Style/TrailingCommaInArrayLiteral:
43
- EnforcedStyleForMultiline: consistent_comma
44
-
45
- Style/TrailingCommaInHashLiteral:
46
- EnforcedStyleForMultiline: consistent_comma
47
-
48
- RSpec/InstanceVariable:
49
- Enabled: false
50
-
51
- Lint/HandleExceptions:
52
- Enabled: false
data/.rubocop_todo.yml DELETED
@@ -1,562 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2019-09-13 08:34:35 -0400 using RuboCop version 0.74.0.
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: 6
10
- # Cop supports --auto-correct.
11
- # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
12
- # Include: **/*.gemfile, **/Gemfile, **/gems.rb
13
- Bundler/OrderedGems:
14
- Exclude:
15
- - 'Gemfile'
16
-
17
- # Offense count: 6
18
- # Cop supports --auto-correct.
19
- # Configuration parameters: TreatCommentsAsGroupSeparators, Include.
20
- # Include: **/*.gemspec
21
- Gemspec/OrderedDependencies:
22
- Exclude:
23
- - 'flipper-active_record.gemspec'
24
- - 'flipper-active_support_cache_store.gemspec'
25
- - 'flipper-api.gemspec'
26
- - 'flipper-dalli.gemspec'
27
- - 'flipper-ui.gemspec'
28
-
29
- # Offense count: 4
30
- # Cop supports --auto-correct.
31
- # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
32
- # SupportedHashRocketStyles: key, separator, table
33
- # SupportedColonStyles: key, separator, table
34
- # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
35
- Layout/AlignHash:
36
- Exclude:
37
- - 'lib/flipper/typecast.rb'
38
-
39
- # Offense count: 1
40
- # Cop supports --auto-correct.
41
- Layout/ClosingHeredocIndentation:
42
- Exclude:
43
- - 'test/generators/flipper/active_record_generator_test.rb'
44
-
45
- # Offense count: 8
46
- # Cop supports --auto-correct.
47
- Layout/EmptyLineAfterGuardClause:
48
- Exclude:
49
- - 'lib/flipper/adapters/sync/feature_synchronizer.rb'
50
- - 'lib/flipper/api/json_params.rb'
51
- - 'lib/flipper/api/v1/actions/feature.rb'
52
- - 'lib/flipper/type.rb'
53
- - 'lib/flipper/types/actor.rb'
54
- - 'lib/flipper/types/group.rb'
55
- - 'lib/flipper/ui/action.rb'
56
-
57
- # Offense count: 12
58
- # Cop supports --auto-correct.
59
- Layout/EmptyLineAfterMagicComment:
60
- Exclude:
61
- - 'flipper-active_record.gemspec'
62
- - 'flipper-active_support_cache_store.gemspec'
63
- - 'flipper-api.gemspec'
64
- - 'flipper-cloud.gemspec'
65
- - 'flipper-dalli.gemspec'
66
- - 'flipper-moneta.gemspec'
67
- - 'flipper-mongo.gemspec'
68
- - 'flipper-redis.gemspec'
69
- - 'flipper-rollout.gemspec'
70
- - 'flipper-sequel.gemspec'
71
- - 'flipper-ui.gemspec'
72
- - 'flipper.gemspec'
73
-
74
- # Offense count: 1
75
- # Cop supports --auto-correct.
76
- Layout/EmptyLinesAroundExceptionHandlingKeywords:
77
- Exclude:
78
- - 'test/adapters/active_record_test.rb'
79
-
80
- # Offense count: 1
81
- # Cop supports --auto-correct.
82
- # Configuration parameters: EnforcedStyle.
83
- # SupportedStyles: squiggly, active_support, powerpack, unindent
84
- Layout/IndentHeredoc:
85
- Exclude:
86
- - 'test/generators/flipper/active_record_generator_test.rb'
87
-
88
- # Offense count: 2
89
- # Cop supports --auto-correct.
90
- Layout/RescueEnsureAlignment:
91
- Exclude:
92
- - 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb'
93
- - 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb'
94
-
95
- # Offense count: 1
96
- Lint/AmbiguousRegexpLiteral:
97
- Exclude:
98
- - 'lib/flipper/instrumentation/statsd.rb'
99
-
100
- # Offense count: 6
101
- # Configuration parameters: AllowSafeAssignment.
102
- Lint/AssignmentInCondition:
103
- Exclude:
104
- - 'lib/flipper/adapters/active_record.rb'
105
- - 'lib/flipper/adapters/sequel.rb'
106
- - 'lib/flipper/feature.rb'
107
- - 'lib/flipper/gate_values.rb'
108
-
109
- # Offense count: 2
110
- Lint/DuplicateMethods:
111
- Exclude:
112
- - 'lib/flipper/ui.rb'
113
- - 'lib/flipper/ui/configuration.rb'
114
-
115
- # Offense count: 3
116
- # Configuration parameters: MaximumRangeSize.
117
- Lint/MissingCopEnableDirective:
118
- Exclude:
119
- - 'lib/flipper/feature.rb'
120
- - 'lib/flipper/spec/shared_adapter_specs.rb'
121
- - 'lib/flipper/test/shared_adapter_test.rb'
122
-
123
- # Offense count: 1
124
- # Cop supports --auto-correct.
125
- Lint/ScriptPermission:
126
- Exclude:
127
- - 'Rakefile'
128
-
129
- # Offense count: 21
130
- Lint/ShadowingOuterLocalVariable:
131
- Exclude:
132
- - 'spec/flipper/api/v1/actions/actors_gate_spec.rb'
133
- - 'spec/flipper/api/v1/actions/percentage_of_actors_gate_spec.rb'
134
- - 'spec/flipper/api/v1/actions/percentage_of_time_gate_spec.rb'
135
- - 'spec/flipper/dsl_spec.rb'
136
- - 'spec/flipper/feature_spec.rb'
137
- - 'spec/flipper/types/group_spec.rb'
138
-
139
- # Offense count: 2
140
- # Cop supports --auto-correct.
141
- Lint/UnneededCopDisableDirective:
142
- Exclude:
143
- - 'spec/flipper/adapter_spec.rb'
144
-
145
- # Offense count: 1
146
- # Cop supports --auto-correct.
147
- Lint/UnneededRequireStatement:
148
- Exclude:
149
- - 'lib/flipper/registry.rb'
150
-
151
- # Offense count: 27
152
- Lint/UselessAssignment:
153
- Exclude:
154
- - 'lib/flipper/instrumentation/log_subscriber.rb'
155
- - 'lib/flipper/instrumentation/subscriber.rb'
156
- - 'spec/flipper/api/action_spec.rb'
157
- - 'spec/flipper/dsl_spec.rb'
158
- - 'spec/flipper/feature_spec.rb'
159
- - 'spec/flipper/gates/group_spec.rb'
160
- - 'spec/flipper/instrumentation/statsd_subscriber_spec.rb'
161
- - 'spec/flipper/middleware/memoizer_spec.rb'
162
- - 'spec/flipper_spec.rb'
163
-
164
- # Offense count: 35
165
- Metrics/AbcSize:
166
- Max: 29
167
-
168
- # Offense count: 136
169
- # Configuration parameters: CountComments, ExcludedMethods.
170
- # ExcludedMethods: refine
171
- Metrics/BlockLength:
172
- Max: 683
173
-
174
- # Offense count: 11
175
- # Configuration parameters: CountComments.
176
- Metrics/ClassLength:
177
- Max: 150
178
-
179
- # Offense count: 20
180
- # Cop supports --auto-correct.
181
- # Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
182
- # URISchemes: http, https
183
- Metrics/LineLength:
184
- Max: 251
185
-
186
- # Offense count: 59
187
- # Configuration parameters: CountComments, ExcludedMethods.
188
- Metrics/MethodLength:
189
- Max: 23
190
-
191
- # Offense count: 18
192
- Naming/AccessorMethodName:
193
- Enabled: false
194
-
195
- # Offense count: 25
196
- Naming/ConstantName:
197
- Exclude:
198
- - 'lib/flipper.rb'
199
- - 'lib/flipper/adapters/active_support_cache_store.rb'
200
- - 'lib/flipper/adapters/dalli.rb'
201
- - 'lib/flipper/adapters/instrumented.rb'
202
- - 'lib/flipper/adapters/memoizable.rb'
203
- - 'lib/flipper/adapters/memory.rb'
204
- - 'lib/flipper/adapters/mongo.rb'
205
- - 'lib/flipper/adapters/operation_logger.rb'
206
- - 'lib/flipper/adapters/pstore.rb'
207
- - 'lib/flipper/adapters/redis.rb'
208
- - 'lib/flipper/adapters/redis_cache.rb'
209
- - 'lib/flipper/feature.rb'
210
- - 'lib/flipper/gate_values.rb'
211
- - 'lib/flipper/typecast.rb'
212
- - 'lib/flipper/ui/decorators/feature.rb'
213
-
214
- # Offense count: 9
215
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
216
- # 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
217
- Naming/FileName:
218
- Exclude:
219
- - 'lib/flipper-active_record.rb'
220
- - 'lib/flipper-active_support_cache_store.rb'
221
- - 'lib/flipper-api.rb'
222
- - 'lib/flipper-cloud.rb'
223
- - 'lib/flipper-dalli.rb'
224
- - 'lib/flipper-mongo.rb'
225
- - 'lib/flipper-redis.rb'
226
- - 'lib/flipper-sequel.rb'
227
- - 'lib/flipper-ui.rb'
228
-
229
- # Offense count: 1
230
- # Configuration parameters: Blacklist.
231
- # Blacklist: (?-mix:(^|\s)(EO[A-Z]{1}|END)(\s|$))
232
- Naming/HeredocDelimiterNaming:
233
- Exclude:
234
- - 'test/generators/flipper/active_record_generator_test.rb'
235
-
236
- # Offense count: 4
237
- # Cop supports --auto-correct.
238
- # Configuration parameters: PreferredName.
239
- Naming/RescuedExceptionsVariableName:
240
- Exclude:
241
- - 'lib/flipper/adapters/active_record.rb'
242
- - 'lib/flipper/adapters/sync/synchronizer.rb'
243
- - 'lib/flipper/ui/actions/percentage_of_actors_gate.rb'
244
- - 'lib/flipper/ui/actions/percentage_of_time_gate.rb'
245
-
246
- # Offense count: 3
247
- RSpec/BeforeAfterAll:
248
- Exclude:
249
- - 'spec/spec_helper.rb'
250
- - 'spec/rails_helper.rb'
251
- - 'spec/support/**/*.rb'
252
- - 'spec/flipper/adapters/active_record_spec.rb'
253
- - 'spec/flipper/adapters/http_spec.rb'
254
-
255
- # Offense count: 76
256
- # Configuration parameters: Prefixes.
257
- # Prefixes: when, with, without
258
- RSpec/ContextWording:
259
- Enabled: false
260
-
261
- # Offense count: 1
262
- # Configuration parameters: CustomIncludeMethods.
263
- RSpec/EmptyExampleGroup:
264
- Exclude:
265
- - 'spec/flipper/gates/actor_spec.rb'
266
-
267
- # Offense count: 3
268
- # Cop supports --auto-correct.
269
- RSpec/EmptyLineAfterFinalLet:
270
- Exclude:
271
- - 'spec/flipper/adapters/moneta_spec.rb'
272
- - 'spec/flipper/ui/actions/features_spec.rb'
273
-
274
- # Offense count: 2
275
- # Cop supports --auto-correct.
276
- RSpec/EmptyLineAfterSubject:
277
- Exclude:
278
- - 'spec/flipper/adapters/http_spec.rb'
279
- - 'spec/flipper/types/percentage_spec.rb'
280
-
281
- # Offense count: 138
282
- # Configuration parameters: Max.
283
- RSpec/ExampleLength:
284
- Enabled: false
285
-
286
- # Offense count: 1
287
- # Configuration parameters: CustomTransform, IgnoreMethods.
288
- RSpec/FilePath:
289
- Exclude:
290
- - 'spec/flipper/adapters/pstore_spec.rb'
291
-
292
- # Offense count: 6
293
- # Cop supports --auto-correct.
294
- # Configuration parameters: EnforcedStyle.
295
- # SupportedStyles: implicit, each, example
296
- RSpec/HookArgument:
297
- Exclude:
298
- - 'spec/flipper/adapters/active_record_spec.rb'
299
- - 'spec/flipper/adapters/http_spec.rb'
300
- - 'spec/flipper/adapters/sequel_spec.rb'
301
- - 'spec/helper.rb'
302
-
303
- # Offense count: 4
304
- # Cop supports --auto-correct.
305
- RSpec/HooksBeforeExamples:
306
- Exclude:
307
- - 'spec/flipper/ui_spec.rb'
308
-
309
- # Offense count: 22
310
- # Cop supports --auto-correct.
311
- # Configuration parameters: EnforcedStyle.
312
- # SupportedStyles: it_behaves_like, it_should_behave_like
313
- RSpec/ItBehavesLike:
314
- Enabled: false
315
-
316
- # Offense count: 4
317
- RSpec/IteratedExpectation:
318
- Exclude:
319
- - 'spec/flipper/dsl_spec.rb'
320
- - 'spec/flipper/feature_spec.rb'
321
- - 'spec/flipper/gates/percentage_of_actors_spec.rb'
322
- - 'spec/flipper/registry_spec.rb'
323
-
324
- # Offense count: 26
325
- # Cop supports --auto-correct.
326
- RSpec/LeadingSubject:
327
- Enabled: false
328
-
329
- # Offense count: 17
330
- # Configuration parameters: .
331
- # SupportedStyles: have_received, receive
332
- RSpec/MessageSpies:
333
- EnforcedStyle: receive
334
-
335
- # Offense count: 233
336
- # Configuration parameters: AggregateFailuresByDefault.
337
- RSpec/MultipleExpectations:
338
- Max: 20
339
-
340
- # Offense count: 449
341
- # Configuration parameters: IgnoreSharedExamples.
342
- RSpec/NamedSubject:
343
- Enabled: false
344
-
345
- # Offense count: 25
346
- RSpec/NestedGroups:
347
- Max: 5
348
-
349
- # Offense count: 19
350
- # Cop supports --auto-correct.
351
- # Configuration parameters: Strict, EnforcedStyle.
352
- # SupportedStyles: inflected, explicit
353
- RSpec/PredicateMatcher:
354
- Exclude:
355
- - 'spec/flipper/api/v1/actions/actors_gate_spec.rb'
356
- - 'spec/flipper/api/v1/actions/boolean_gate_spec.rb'
357
- - 'spec/flipper/api/v1/actions/clear_feature_spec.rb'
358
- - 'spec/flipper/api/v1/actions/features_spec.rb'
359
- - 'spec/flipper/api/v1/actions/groups_gate_spec.rb'
360
- - 'spec/flipper/types/group_spec.rb'
361
-
362
- # Offense count: 1
363
- # Cop supports --auto-correct.
364
- RSpec/ReceiveNever:
365
- Exclude:
366
- - 'spec/flipper/middleware/memoizer_spec.rb'
367
-
368
- # Offense count: 2
369
- RSpec/RepeatedDescription:
370
- Exclude:
371
- - 'spec/flipper/gates/boolean_spec.rb'
372
-
373
- # Offense count: 4
374
- RSpec/RepeatedExample:
375
- Exclude:
376
- - 'spec/flipper/cloud_spec.rb'
377
- - 'spec/integration_spec.rb'
378
-
379
- # Offense count: 2
380
- RSpec/ScatteredLet:
381
- Exclude:
382
- - 'spec/flipper/adapters/http_spec.rb'
383
- - 'spec/flipper/instrumentation/log_subscriber_spec.rb'
384
-
385
- # Offense count: 4
386
- RSpec/SubjectStub:
387
- Exclude:
388
- - 'spec/flipper/adapters/sync_spec.rb'
389
-
390
- # Offense count: 17
391
- # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
392
- RSpec/VerifiedDoubles:
393
- Exclude:
394
- - 'spec/flipper/api/v1/actions/features_spec.rb'
395
- - 'spec/flipper/dsl_spec.rb'
396
- - 'spec/flipper/feature_spec.rb'
397
- - 'spec/flipper/types/group_spec.rb'
398
- - 'spec/flipper_spec.rb'
399
- - 'spec/integration_spec.rb'
400
-
401
- # Offense count: 1
402
- Security/Eval:
403
- Exclude:
404
- - 'flipper.gemspec'
405
-
406
- # Offense count: 5
407
- Security/MarshalLoad:
408
- Exclude:
409
- - 'lib/flipper/adapters/redis_cache.rb'
410
- - 'spec/flipper/adapters/redis_cache_spec.rb'
411
-
412
- # Offense count: 2
413
- # Configuration parameters: EnforcedStyle.
414
- # SupportedStyles: inline, group
415
- Style/AccessModifierDeclarations:
416
- Exclude:
417
- - 'lib/flipper/api/action.rb'
418
- - 'lib/flipper/ui/action.rb'
419
-
420
- # Offense count: 3
421
- Style/DoubleNegation:
422
- Exclude:
423
- - 'lib/flipper/adapters/memoizable.rb'
424
- - 'lib/flipper/gates/boolean.rb'
425
- - 'lib/flipper/typecast.rb'
426
-
427
- # Offense count: 1
428
- # Cop supports --auto-correct.
429
- Style/EmptyLambdaParameter:
430
- Exclude:
431
- - 'lib/flipper/ui.rb'
432
-
433
- # Offense count: 1
434
- # Cop supports --auto-correct.
435
- # Configuration parameters: EnforcedStyle.
436
- # SupportedStyles: compact, expanded
437
- Style/EmptyMethod:
438
- Exclude:
439
- - 'lib/flipper/gate.rb'
440
-
441
- # Offense count: 27
442
- # Cop supports --auto-correct.
443
- Style/ExpandPathArguments:
444
- Enabled: false
445
-
446
- # Offense count: 2
447
- # Cop supports --auto-correct.
448
- # Configuration parameters: EnforcedStyle.
449
- # SupportedStyles: format, sprintf, percent
450
- Style/FormatString:
451
- Exclude:
452
- - 'lib/flipper/instrumentation/log_subscriber.rb'
453
-
454
- # Offense count: 2
455
- # Configuration parameters: .
456
- # SupportedStyles: annotated, template, unannotated
457
- Style/FormatStringToken:
458
- EnforcedStyle: unannotated
459
-
460
- # Offense count: 219
461
- # Cop supports --auto-correct.
462
- # Configuration parameters: EnforcedStyle.
463
- # SupportedStyles: always, never
464
- Style/FrozenStringLiteralComment:
465
- Enabled: false
466
-
467
- # Offense count: 1
468
- # Configuration parameters: AllowIfModifier.
469
- Style/IfInsideElse:
470
- Exclude:
471
- - 'lib/flipper/gates/actor.rb'
472
-
473
- # Offense count: 1
474
- Style/MethodMissingSuper:
475
- Exclude:
476
- - 'lib/flipper/types/actor.rb'
477
-
478
- # Offense count: 1
479
- Style/MissingRespondToMissing:
480
- Exclude:
481
- - 'lib/flipper/types/actor.rb'
482
-
483
- # Offense count: 1
484
- # Cop supports --auto-correct.
485
- # Configuration parameters: EnforcedStyle.
486
- # SupportedStyles: literals, strict
487
- Style/MutableConstant:
488
- Exclude:
489
- - 'lib/flipper/ui/util.rb'
490
-
491
- # Offense count: 5
492
- # Cop supports --auto-correct.
493
- # Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
494
- # SupportedStyles: predicate, comparison
495
- Style/NumericPredicate:
496
- Exclude:
497
- - 'spec/**/*'
498
- - 'lib/flipper/api/v1/actions/percentage_of_actors_gate.rb'
499
- - 'lib/flipper/api/v1/actions/percentage_of_time_gate.rb'
500
- - 'lib/flipper/gates/percentage_of_actors.rb'
501
- - 'lib/flipper/gates/percentage_of_time.rb'
502
- - 'lib/flipper/types/percentage.rb'
503
-
504
- # Offense count: 34
505
- # Cop supports --auto-correct.
506
- # Configuration parameters: PreferredDelimiters.
507
- Style/PercentLiteralDelimiters:
508
- Exclude:
509
- - 'Rakefile'
510
- - 'lib/flipper/spec/shared_adapter_specs.rb'
511
- - 'lib/flipper/test/shared_adapter_test.rb'
512
- - 'lib/flipper/ui.rb'
513
- - 'lib/flipper/ui/configuration.rb'
514
- - 'spec/flipper/adapter_spec.rb'
515
- - 'spec/flipper/adapters/http_spec.rb'
516
- - 'spec/flipper/adapters/memoizable_spec.rb'
517
- - 'spec/flipper/adapters/sync/synchronizer_spec.rb'
518
- - 'spec/flipper/adapters/sync_spec.rb'
519
- - 'spec/flipper/api/v1/actions/features_spec.rb'
520
- - 'spec/flipper/api_spec.rb'
521
- - 'spec/flipper/dsl_spec.rb'
522
- - 'spec/flipper/middleware/memoizer_spec.rb'
523
- - 'spec/flipper/registry_spec.rb'
524
-
525
- # Offense count: 3
526
- # Cop supports --auto-correct.
527
- Style/RedundantBegin:
528
- Exclude:
529
- - 'spec/flipper/middleware/memoizer_spec.rb'
530
- - 'spec/flipper/ui/actions/feature_spec.rb'
531
- - 'spec/flipper/ui_spec.rb'
532
-
533
- # Offense count: 2
534
- # Cop supports --auto-correct.
535
- # Configuration parameters: EnforcedStyle.
536
- # SupportedStyles: implicit, explicit
537
- Style/RescueStandardError:
538
- Exclude:
539
- - 'lib/flipper/adapters/sync/synchronizer.rb'
540
- - 'spec/flipper/middleware/memoizer_spec.rb'
541
-
542
- # Offense count: 4
543
- # Cop supports --auto-correct.
544
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
545
- # Whitelist: present?, blank?, presence, try, try!
546
- Style/SafeNavigation:
547
- Exclude:
548
- - 'lib/flipper/instrumentation/statsd_subscriber.rb'
549
- - 'lib/flipper/middleware/memoizer.rb'
550
- - 'spec/flipper/adapters/http_spec.rb'
551
-
552
- # Offense count: 8
553
- # Cop supports --auto-correct.
554
- # Configuration parameters: EnforcedStyle, MinSize.
555
- # SupportedStyles: percent, brackets
556
- Style/SymbolArray:
557
- Exclude:
558
- - 'Rakefile'
559
- - 'lib/flipper/adapters/operation_logger.rb'
560
- - 'lib/generators/flipper/templates/sequel_migration.rb'
561
- - 'spec/flipper/adapters/rollout_spec.rb'
562
- - 'spec/flipper/gate_values_spec.rb'