sentry-raven 0.15.3 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc70253c8534fa8631331cbabf07e6cb4c4d31d2
4
- data.tar.gz: 3d956a4c483a317b359332de520c3b402f8317bf
3
+ metadata.gz: 1c32e6b50c0d7de4f7e17c570e5e8a9bf79903d1
4
+ data.tar.gz: 9be97f5863a940ff07b862be7398f33a488bf8cd
5
5
  SHA512:
6
- metadata.gz: 2354d4020c5379674e12700beae4d39188a8f4b212832fa9bf1862977af062e84c9f9b559f0822a4b7430dd42c3ad2580778b55795a65b95586b9714860df462
7
- data.tar.gz: 1842f5311c0d807b3595f26941b2162d400fb806b0c2d314cd5053d0e280dbcf832d05b3fb9c1a4633f42ea17a12fb7929b88237bdae0a0926d6b1a98167d079
6
+ metadata.gz: 38530147d817ec7c5f49859c3e498892a2fe1e85e3c034f38cf931996739b80a38af16598151507890a17072fdc0beea706146c3caaf6fca80bc6469fff76f74
7
+ data.tar.gz: 6be4d40e98ff009d447ce7667afe959a269b08a002a30945f955f7efc51213af58272195b61b3903d8c12f9792e0e0da2ff68429fa59bd842110bdd3b8d618ae
data/README.md CHANGED
@@ -7,7 +7,7 @@ A client and integration layer for the [Sentry](https://github.com/getsentry/sen
7
7
 
8
8
  ## Requirements
9
9
 
10
- We test on Ruby MRI 1.8.7/REE, 1.9.3, 2.0, 2.1 and 2.2. JRuby support is experimental - check TravisCI to see if the build is passing or failing.
10
+ We test on Ruby MRI 1.8.7/REE through Ruby 2.3 at the latest patchlevel/teeny version. JRuby support is experimental - check TravisCI to see if the build is passing or failing.
11
11
 
12
12
  ## Getting Started
13
13
  ### Install
@@ -7,10 +7,10 @@ module Raven
7
7
  # Handles backtrace parsing line by line
8
8
  class Line
9
9
  # regexp (optionnally allowing leading X: for windows support)
10
- RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}.freeze
10
+ RUBY_INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+|<.*>):(\d+)(?::in `([^']+)')?$}
11
11
 
12
12
  # org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
13
- JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}.freeze
13
+ JAVA_INPUT_FORMAT = %r{^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$}
14
14
 
15
15
  APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/
16
16
 
@@ -84,8 +84,8 @@ module Raven
84
84
  # holder for an Array of Backtrace::Line instances
85
85
  attr_reader :lines
86
86
 
87
- def self.parse(ruby_backtrace, opts = {})
88
- ruby_lines = split_multiline_backtrace(ruby_backtrace)
87
+ def self.parse(backtrace, opts = {})
88
+ ruby_lines = backtrace.is_a?(Array) ? backtrace : backtrace.split(/\n\s*/)
89
89
 
90
90
  filters = opts[:filters] || []
91
91
  filtered_lines = ruby_lines.to_a.map do |line|
@@ -128,13 +128,5 @@ module Raven
128
128
  private
129
129
 
130
130
  attr_writer :lines
131
-
132
- def self.split_multiline_backtrace(backtrace)
133
- if backtrace.to_a.size == 1
134
- backtrace.to_a.first.split(/\n\s*/)
135
- else
136
- backtrace
137
- end
138
- end
139
131
  end
140
132
  end
@@ -21,7 +21,7 @@ if (major == 1 && minor < 9) || (major == 1 && minor == 9 && patch < 2)
21
21
  end
22
22
 
23
23
  module Raven
24
- AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rake]
24
+ AVAILABLE_INTEGRATIONS = %w[delayed_job railties sidekiq rack rake].freeze
25
25
 
26
26
  class << self
27
27
  # The client object is responsible for delivering formatted data to the Sentry server.
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'zlib'
2
3
  require 'base64'
3
4
 
@@ -9,9 +10,9 @@ require 'raven/transports/udp'
9
10
  module Raven
10
11
  # Encodes events and sends them to the Sentry server.
11
12
  class Client
12
- PROTOCOL_VERSION = '5'
13
- USER_AGENT = "raven-ruby/#{Raven::VERSION}"
14
- CONTENT_TYPE = 'application/json'
13
+ PROTOCOL_VERSION = '5'.freeze
14
+ USER_AGENT = "raven-ruby/#{Raven::VERSION}".freeze
15
+ CONTENT_TYPE = 'application/json'.freeze
15
16
 
16
17
  attr_accessor :configuration
17
18
 
@@ -84,7 +84,9 @@ module Raven
84
84
  # Optional Proc to be used to send events asynchronously.
85
85
  attr_reader :async
86
86
 
87
- # Exceptions from these directories to be ignored
87
+ # Directories to be recognized as part of your app. e.g. if you
88
+ # have an `engines` dir at the root of your project, you may want
89
+ # to set this to something like /(app|config|engines|lib)/
88
90
  attr_accessor :app_dirs_pattern
89
91
 
90
92
  # Catch exceptions before they're been processed by
@@ -109,14 +111,14 @@ module Raven
109
111
  'CGI::Session::CookieStore::TamperedWithCookie',
110
112
  'Mongoid::Errors::DocumentNotFound',
111
113
  'Sinatra::NotFound',
112
- ]
114
+ ].freeze
113
115
 
114
116
  def initialize
115
117
  self.server = ENV['SENTRY_DSN'] if ENV['SENTRY_DSN']
116
118
  @context_lines = 3
117
119
  self.current_environment = ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'default'
118
120
  self.send_modules = true
119
- self.excluded_exceptions = IGNORE_DEFAULT
121
+ self.excluded_exceptions = IGNORE_DEFAULT.dup
120
122
  self.processors = [Raven::Processor::RemoveCircularReferences, Raven::Processor::UTF8Conversion, Raven::Processor::SanitizeData]
121
123
  self.ssl_verification = true
122
124
  self.encoding = 'gzip'
@@ -130,15 +132,7 @@ module Raven
130
132
  self.sanitize_credit_cards = true
131
133
  self.environments = []
132
134
 
133
- self.release = ENV['HEROKU_SLUG_COMMIT']
134
-
135
- if self.release.nil? || self.release.empty?
136
- self.release = File.read(File.join(Rails.root, 'REVISION')).strip rescue nil
137
- end
138
-
139
- if self.release.nil? || self.release.empty?
140
- self.release = `git rev-parse --short HEAD`.strip rescue nil
141
- end
135
+ self.release = detect_release
142
136
  end
143
137
 
144
138
  def server=(value)
@@ -168,14 +162,14 @@ module Raven
168
162
  @encoding = encoding
169
163
  end
170
164
 
171
- alias_method :dsn=, :server=
165
+ alias dsn= server=
172
166
 
173
167
  def async=(value)
174
168
  raise ArgumentError.new("async must be callable (or false to disable)") unless value == false || value.respond_to?(:call)
175
169
  @async = value
176
170
  end
177
171
 
178
- alias_method :async?, :async
172
+ alias async? async
179
173
 
180
174
  # Allows config options to be read like a hash
181
175
  #
@@ -202,5 +196,25 @@ module Raven
202
196
  raise Error.new('No secret key specified') unless secret_key
203
197
  raise Error.new('No project ID specified') unless project_id
204
198
  end
199
+
200
+ def detect_release
201
+ detect_release_from_heroku ||
202
+ detect_release_from_capistrano ||
203
+ detect_release_from_git
204
+ end
205
+
206
+ private
207
+
208
+ def detect_release_from_heroku
209
+ ENV['HEROKU_SLUG_COMMIT']
210
+ end
211
+
212
+ def detect_release_from_capistrano
213
+ File.read(File.join(project_root, 'REVISION')).strip rescue nil
214
+ end
215
+
216
+ def detect_release_from_git
217
+ `git rev-parse --short HEAD`.strip if File.directory?(".git") rescue nil
218
+ end
205
219
  end
206
220
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'rubygems'
2
3
  require 'socket'
3
4
  require 'securerandom'
@@ -16,11 +17,11 @@ module Raven
16
17
  "warning" => 30,
17
18
  "error" => 40,
18
19
  "fatal" => 50,
19
- }
20
+ }.freeze
20
21
 
21
22
  BACKTRACE_RE = /^(.+?):(\d+)(?::in `(.+?)')?$/
22
23
 
23
- PLATFORM = "ruby"
24
+ PLATFORM = "ruby".freeze
24
25
 
25
26
  attr_reader :id
26
27
  attr_accessor :project, :message, :timestamp, :time_spent, :level, :logger,
@@ -221,7 +222,7 @@ module Raven
221
222
 
222
223
  def get_file_context(filename, lineno, context)
223
224
  return nil, nil, nil unless Raven::LineCache.is_valid_file(filename)
224
- lines = (2 * context + 1).times.map do |i|
225
+ lines = Array.new(2 * context + 1) do |i|
225
226
  Raven::LineCache.getline(filename, lineno - context + i)
226
227
  end
227
228
  [lines[0..(context - 1)], lines[context], lines[(context + 1)..-1]]
@@ -2,7 +2,6 @@ require 'delayed_job'
2
2
 
3
3
  module Delayed
4
4
  module Plugins
5
-
6
5
  class Raven < ::Delayed::Plugin
7
6
  callbacks do |lifecycle|
8
7
  lifecycle.around(:invoke_job) do |job, *args, &block|
@@ -20,7 +19,7 @@ module Delayed
20
19
  # handlers are YAML objects in strings, we definitely can't
21
20
  # report all of that or the event will get truncated randomly
22
21
  :handler => job.handler[0...100],
23
- :last_error => job.last_error,
22
+ :last_error => job.last_error[0...100],
24
23
  :run_at => job.run_at,
25
24
  :locked_at => job.locked_at,
26
25
  :locked_by => job.locked_by,
@@ -29,7 +28,7 @@ module Delayed
29
28
  }
30
29
  }
31
30
  if job.respond_to?('payload_object') && job.payload_object.respond_to?('job_data')
32
- extra.merge!(:active_job => job.payload_object.job_data)
31
+ extra[:active_job] = job.payload_object.job_data
33
32
  end
34
33
  ::Raven.capture_exception(exception,
35
34
  :logger => 'delayed_job',
@@ -32,8 +32,8 @@ module Raven
32
32
  end
33
33
  end
34
34
  class << self
35
- alias_method :capture_message, :capture_type
36
- alias_method :capture_exception, :capture_type
35
+ alias capture_message capture_type
36
+ alias capture_exception capture_type
37
37
  end
38
38
 
39
39
  def initialize(app)
@@ -17,6 +17,7 @@ module Raven
17
17
  Raven.configure do |config|
18
18
  config.logger ||= ::Rails.logger
19
19
  config.project_root ||= ::Rails.root
20
+ config.release = config.detect_release # if project_root has changed, need to re-check
20
21
  end
21
22
 
22
23
  if Raven.configuration.catch_debugged_exceptions
@@ -17,7 +17,7 @@ module Raven
17
17
 
18
18
  # Add provider_job_id details if Rails 5
19
19
  if defined?(provider_job_id)
20
- active_job_details.merge!(:provider_job_id => provider_job_id)
20
+ active_job_details[:provider_job_id] = provider_job_id
21
21
  end
22
22
 
23
23
  Raven.capture_exception(exception, :extra => active_job_details)
@@ -1,6 +1,7 @@
1
1
  module Raven
2
2
 
3
- INTERFACES = {}
3
+ # TODO: a constant isn't appropriate here, refactor
4
+ INTERFACES = {} # rubocop:disable Style/MutableConstant
4
5
 
5
6
  class Interface
6
7
  def initialize(attributes = nil)
@@ -3,7 +3,10 @@
3
3
  module Raven
4
4
  class LineCache
5
5
  class << self
6
- CACHE = {}
6
+ # TODO: a constant isn't appropriate here, refactor
7
+ # also would there be threading bugs essentially using this as a class
8
+ # variable?
9
+ CACHE = {} # rubocop:disable Style/MutableConstant
7
10
 
8
11
  def is_valid_file(path)
9
12
  lines = getlines(path)
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  module Raven
2
3
  class Logger
3
- LOG_PREFIX = "** [Raven] "
4
+ LOG_PREFIX = "** [Raven] ".freeze
4
5
 
5
6
  [
6
7
  :fatal,
@@ -1,11 +1,12 @@
1
+ # frozen_string_literal: true
1
2
  require 'json'
2
3
  module Raven
3
4
  class Processor::SanitizeData < Processor
4
- STRING_MASK = '********'
5
+ STRING_MASK = '********'.freeze
5
6
  INT_MASK = 0
6
- DEFAULT_FIELDS = %w(authorization password passwd secret ssn social(.*)?sec)
7
+ DEFAULT_FIELDS = %w(authorization password passwd secret ssn social(.*)?sec).freeze
7
8
  CREDIT_CARD_RE = /^(?:\d[ -]*?){13,16}$/
8
- REGEX_SPECIAL_CHARACTERS = %w(. $ ^ { [ ( | ) * + ?)
9
+ REGEX_SPECIAL_CHARACTERS = %w(. $ ^ { [ ( | ) * + ?).freeze
9
10
 
10
11
  attr_accessor :sanitize_fields, :sanitize_credit_cards
11
12
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Raven
2
- VERSION = "0.15.3"
3
+ VERSION = "0.15.4".freeze
3
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-raven
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.36.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.36.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement