Skip to content

Commit 2a58ddc

Browse files
authored
Merge pull request #912 from flippercloud/delegation
Fix all the warnings and turn them on for CI
2 parents 3683318 + ed49fca commit 2a58ddc

31 files changed

+69
-62
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ gem 'mysql2'
3131
gem 'pg'
3232
gem 'cuprite'
3333
gem 'puma'
34+
gem 'warning'
3435

3536
group(:guard) do
3637
gem 'guard'

Guardfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ rspec_options = {
1010
all_after_pass: false,
1111
all_on_start: false,
1212
failed_mode: :keep,
13-
cmd: 'bundle exec rspec',
13+
cmd: 'bundle exec ruby -w $(which rspec)',
1414
}
1515

1616
guard 'rspec', rspec_options do

lib/flipper/adapters/http/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def initialize(response)
2020
if more_info = data["more_info"]
2121
message << "\n#{data["more_info"]}"
2222
end
23-
rescue => exception
23+
rescue
2424
# welp we tried
2525
end
2626

lib/flipper/adapters/poll.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def initialize(poller, adapter)
2525
if adapter.features.empty?
2626
begin
2727
@poller.sync
28-
rescue => error
28+
rescue
2929
# TODO: Warn here that it's possible that no data has been synced
3030
# and flags are being evaluated without flag data being present
3131
# until a sync completes. We rescue to avoid flipper being down

lib/flipper/api/v1/actions/expression_gate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def post
1818
feature.enable_expression expression
1919
decorated_feature = Decorators::Feature.new(feature)
2020
json_response(decorated_feature.as_json, 200)
21-
rescue NameError, ArgumentError => exception
21+
rescue NameError, ArgumentError
2222
json_error_response(:expression_invalid)
2323
end
2424
end

lib/flipper/cloud/configuration.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require "flipper/adapters/http"
44
require "flipper/adapters/poll"
55
require "flipper/poller"
6-
require "flipper/adapters/memory"
76
require "flipper/adapters/dual_write"
87
require "flipper/adapters/sync/synchronizer"
98
require "flipper/cloud/telemetry"

lib/flipper/export.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require "flipper/adapters/memory"
2-
31
module Flipper
42
class Export
53
attr_reader :contents, :format, :version

lib/flipper/expressions/all.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require "flipper/expression"
2-
31
module Flipper
42
module Expressions
53
class All

lib/flipper/feature.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,14 @@ def clear
100100
#
101101
# Returns true if enabled, false if not.
102102
def enabled?(*actors)
103-
# Allows null object pattern. See PR for more.
104-
# https://github.com/flippercloud/flipper/pull/887
105-
actors = actors.flatten.reject(&:nil?).map { |actor| Types::Actor.wrap(actor) }
103+
actors = Array(actors).
104+
# Avoids to_ary warning that happens when passing DelegateClass of an
105+
# ActiveRecord object and using flatten here. This is tested in
106+
# spec/flipper/model/active_record_spec.rb.
107+
flat_map { |actor| actor.is_a?(Array) ? actor : [actor] }.
108+
# Allows null object pattern. See PR for more. https://github.com/flippercloud/flipper/pull/887
109+
reject(&:nil?).
110+
map { |actor| Types::Actor.wrap(actor) }
106111
actors = nil if actors.empty?
107112

108113
# thing is left for backwards compatibility

lib/flipper/instrumentation/log_subscriber.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ def adapter_operation(event)
5353

5454
feature_name = event.payload[:feature_name]
5555
adapter_name = event.payload[:adapter_name]
56-
gate_name = event.payload[:gate_name]
5756
operation = event.payload[:operation]
5857
result = event.payload[:result]
5958

0 commit comments

Comments
 (0)