airbrake-ruby 4.13.4-java → 4.14.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4da09995f6af54a53f3c22d05a4a22d1c27cfc477da090a9513f2ede529ae0d
4
- data.tar.gz: c12fad300807903f28b3d3dcdc472e729d6e27e74fca597467774c9ea8ab347a
3
+ metadata.gz: 47137b5594e838edb0d68d5121a8a7f4fddc04ef90503c31d2cfe1f4a14e7efc
4
+ data.tar.gz: 743b3190115223bf043cf8ecf7e9b5a8bb32b40206c146967d86489514247d99
5
5
  SHA512:
6
- metadata.gz: 22b6f6051236280c493f5b82361aad66e1c41bf09872e6f9179f53a5c56d82f559205792b9efd9134c5ac5e1c49a6e7471931286e7fad672e70923731c8bc4df
7
- data.tar.gz: 683a8c9d90db59353e70c2f4474825ce583cb8a8d68ff01d895794bd4d6def0daa3ae7898f2ef10398ca24a8361c5fa3d53ae21b270182653431469955b9c578
6
+ metadata.gz: 31b0eb06f2c8fadc1b6845e80af5f41bad55169e1e34830f5536761767c866bd181441f1827fba1ccc78434522c25c556ad38429f83e225e2c6ecc79002ab5cc
7
+ data.tar.gz: b7ed80303a34c3b0f58b51037063428384b4680273729f88062fd22146fcccfc55989a0f77ddc88a502859d234661a1243853d98fc1abc05f951a703962ec6af
@@ -570,6 +570,7 @@ module Airbrake
570
570
 
571
571
  private
572
572
 
573
+ # rubocop:disable Metrics/AbcSize
573
574
  def process_config_options(config)
574
575
  if config.blacklist_keys.any?
575
576
  blacklist = Airbrake::Filters::KeysBlacklist.new(config.blacklist_keys)
@@ -581,7 +582,6 @@ module Airbrake
581
582
  notice_notifier.add_filter(whitelist)
582
583
  end
583
584
 
584
- return if configured?
585
585
  return unless config.root_directory
586
586
 
587
587
  [
@@ -590,9 +590,12 @@ module Airbrake
590
590
  Airbrake::Filters::GitRepositoryFilter,
591
591
  Airbrake::Filters::GitLastCheckoutFilter,
592
592
  ].each do |filter|
593
+ next if notice_notifier.has_filter?(filter)
594
+
593
595
  notice_notifier.add_filter(filter.new(config.root_directory))
594
596
  end
595
597
  end
598
+ # rubocop:enable Metrics/AbcSize
596
599
  end
597
600
  end
598
601
  # rubocop:enable Metrics/ModuleLength
@@ -76,7 +76,7 @@ module Airbrake
76
76
 
77
77
  # @return [String] customized inspect to lessen the amount of clutter
78
78
  def inspect
79
- @filters.map(&:class).to_s
79
+ filter_classes.to_s
80
80
  end
81
81
 
82
82
  # @return [String] {#inspect} for PrettyPrint
@@ -91,5 +91,19 @@ module Airbrake
91
91
  end
92
92
  q.text(']')
93
93
  end
94
+
95
+ # @param [Class] filter_class
96
+ # @return [Boolean] true if the current chain has an instance of the given
97
+ # class, false otherwise
98
+ # @since v4.14.0
99
+ def includes?(filter_class)
100
+ filter_classes.include?(filter_class)
101
+ end
102
+
103
+ private
104
+
105
+ def filter_classes
106
+ @filters.map(&:class)
107
+ end
94
108
  end
95
109
  end
@@ -82,6 +82,12 @@ module Airbrake
82
82
  @context.merge!(context)
83
83
  end
84
84
 
85
+ # @return [Boolean]
86
+ # @since v4.14.0
87
+ def has_filter?(filter_class) # rubocop:disable Naming/PredicateName
88
+ @filter_chain.includes?(filter_class)
89
+ end
90
+
85
91
  private
86
92
 
87
93
  def convert_to_exception(ex)
@@ -2,5 +2,5 @@
2
2
  # More information: http://semver.org/
3
3
  module Airbrake
4
4
  # @return [String] the library version
5
- AIRBRAKE_RUBY_VERSION = '4.13.4'.freeze
5
+ AIRBRAKE_RUBY_VERSION = '4.14.0'.freeze
6
6
  end
@@ -85,6 +85,18 @@ RSpec.describe Airbrake do
85
85
  expect(described_class.notice_notifier).not_to receive(:add_filter)
86
86
  10.times { described_class.configure {} }
87
87
  end
88
+
89
+ it "appends some default filters" do
90
+ allow(described_class.notice_notifier).to receive(:add_filter)
91
+ expect(described_class.notice_notifier).to receive(:add_filter).with(
92
+ an_instance_of(Airbrake::Filters::RootDirectoryFilter),
93
+ )
94
+
95
+ described_class.configure do |c|
96
+ c.project_id = 1
97
+ c.project_key = '2'
98
+ end
99
+ end
88
100
  end
89
101
 
90
102
  context "when blacklist_keys gets configured" do
@@ -89,4 +89,31 @@ RSpec.describe Airbrake::FilterChain do
89
89
  expect(subject.inspect).to eq('[Proc]')
90
90
  end
91
91
  end
92
+
93
+ describe "#includes?" do
94
+ context "when a custom filter class is included in the filter chain" do
95
+ it "returns true" do
96
+ klass = Class.new {}
97
+
98
+ subject.add_filter(klass.new)
99
+ expect(subject.includes?(klass)).to eq(true)
100
+ end
101
+ end
102
+
103
+ context "when Proc filter class is included in the filter chain" do
104
+ it "returns true" do
105
+ subject.add_filter(proc {})
106
+ expect(subject.includes?(Proc)).to eq(true)
107
+ end
108
+ end
109
+
110
+ context "when filter class is NOT included in the filter chain" do
111
+ it "returns false" do
112
+ klass = Class.new {}
113
+
114
+ subject.add_filter(proc {})
115
+ expect(subject.includes?(klass)).to eq(false)
116
+ end
117
+ end
118
+ end
92
119
  end
@@ -389,7 +389,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
389
389
  subject.close
390
390
 
391
391
  expect(promise).to be_an(Airbrake::Promise)
392
- expect(promise.value).to eq('' => nil)
392
+ expect(promise.value).to eq('' => '')
393
393
  end
394
394
 
395
395
  it "checks performance stat configuration" do
@@ -601,7 +601,7 @@ RSpec.describe Airbrake::PerformanceNotifier do
601
601
  body: %r|\A{"queries":\[{"method":"POST","route":"/foo"|,
602
602
  ),
603
603
  ).to have_been_made
604
- expect(retval).to eq('' => nil)
604
+ expect(retval).to eq('' => '')
605
605
  end
606
606
  end
607
607
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrake-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.13.4
4
+ version: 4.14.0
5
5
  platform: java
6
6
  authors:
7
7
  - Airbrake Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-09 00:00:00.000000000 Z
11
+ date: 2020-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rbtree-jruby