sentry-raven 2.12.2 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.craft.yml +15 -0
  3. data/.github/workflows/test.yml +77 -0
  4. data/.gitignore +2 -0
  5. data/.rubocop.yml +44 -9
  6. data/.scripts/bump-version.sh +9 -0
  7. data/Gemfile +17 -25
  8. data/README.md +4 -3
  9. data/changelog.md +37 -0
  10. data/lib/raven/backtrace.rb +7 -5
  11. data/lib/raven/base.rb +5 -3
  12. data/lib/raven/breadcrumbs.rb +1 -1
  13. data/lib/raven/breadcrumbs/activesupport.rb +10 -10
  14. data/lib/raven/breadcrumbs/logger.rb +3 -3
  15. data/lib/raven/cli.rb +2 -2
  16. data/lib/raven/client.rb +12 -6
  17. data/lib/raven/configuration.rb +15 -5
  18. data/lib/raven/event.rb +5 -6
  19. data/lib/raven/instance.rb +4 -3
  20. data/lib/raven/integrations/delayed_job.rb +14 -15
  21. data/lib/raven/integrations/rack-timeout.rb +2 -3
  22. data/lib/raven/integrations/rack.rb +4 -3
  23. data/lib/raven/integrations/rails.rb +1 -0
  24. data/lib/raven/integrations/rails/active_job.rb +10 -7
  25. data/lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb +2 -2
  26. data/lib/raven/interface.rb +2 -2
  27. data/lib/raven/interfaces/stack_trace.rb +1 -1
  28. data/lib/raven/linecache.rb +5 -2
  29. data/lib/raven/logger.rb +3 -2
  30. data/lib/raven/processor/cookies.rb +16 -6
  31. data/lib/raven/processor/post_data.rb +2 -0
  32. data/lib/raven/processor/removecircularreferences.rb +1 -0
  33. data/lib/raven/processor/sanitizedata.rb +65 -17
  34. data/lib/raven/processor/utf8conversion.rb +2 -0
  35. data/lib/raven/transports.rb +4 -0
  36. data/lib/raven/transports/http.rb +5 -5
  37. data/lib/raven/utils/exception_cause_chain.rb +1 -0
  38. data/lib/raven/utils/real_ip.rb +1 -1
  39. data/lib/raven/version.rb +2 -2
  40. data/sentry-raven.gemspec +2 -2
  41. metadata +7 -12
  42. data/.travis.yml +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bdc627591fb17683963ae291a87f94ead31ce93c
4
- data.tar.gz: 19a6ba217e9c5808452c3c93e427f87d0a9120af
2
+ SHA256:
3
+ metadata.gz: 766dba6870e025b98287e3d2ecf7a2f14aad5c37169e4ffc99bd5c740f30a7eb
4
+ data.tar.gz: c1b0c1abf8218d480f40e7cd3653b30d4747a5a2c47111a20f269cac219e091c
5
5
  SHA512:
6
- metadata.gz: 33c2a3c753ced3ce75cdd0c7899d392659570f71f740e8dd57b6c1c473c8fe004e67d828346093056770634063f5a9b676d661d1b44c488a531176bbf25ccbb1
7
- data.tar.gz: de75d311c813b60c94f0ccbd1ba418c2e35c265fab61defda4028c2c3973a26b65484024d31212582f3e878f698e15b64572b3dea0f543f930c0675b4abdec3a
6
+ metadata.gz: 07ef24c7e92460508209ca9fc1d76d09bd317f7a40d693256f1b44afe9e476f1d6f271db3557b848070c15b7c9277c3cff450ebf3882b206d25419eedbd65327
7
+ data.tar.gz: ef792fc072cb8c5e2247d868358c413e64dfedddf2f2232c3d81f66a87d700aa22eb3f6f8563b8df83970d20330b029ce8da299a2bd1cf98f458383ba89fa392
@@ -0,0 +1,15 @@
1
+ minVersion: '0.9.0'
2
+ github:
3
+ owner: getsentry
4
+ repo: raven-ruby
5
+ changelogPolicy: simple
6
+ preReleaseCommand: ruby .scripts/bump-version.sh
7
+ statusProvider:
8
+ name: github
9
+ targets:
10
+ - name: gem
11
+ - name: github
12
+ - name: registry
13
+ type: sdk
14
+ config:
15
+ canonical: 'gem:sentry-raven'
@@ -0,0 +1,77 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ - release/**
8
+ pull_request:
9
+ jobs:
10
+ test:
11
+ name: Test on ruby ${{ matrix.ruby_version }} and rails ${{ matrix.rails_version }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ rails_version: [0, 4.2, 5.2, 6.0]
16
+ ruby_version: [2.3, 2.4, 2.5, 2.6, 2.7, jruby, head]
17
+ os: [ubuntu-latest]
18
+ include:
19
+ - ruby_version: head
20
+ rails_version: 0
21
+ - ruby_version: 2.7
22
+ rails_version: 6.0
23
+ env: RUBYOPT="--enable-frozen-string-literal --debug=frozen-string-literal"
24
+ exclude:
25
+ - ruby_version: 2.3
26
+ rails_version: 6.0
27
+ - ruby_version: 2.4
28
+ rails_version: 6.0
29
+ - ruby_version: 2.7
30
+ rails_version: 4.2
31
+ - ruby_version: head
32
+ rails_version: 4.2
33
+ - ruby_version: head
34
+ rails_version: 5.2
35
+ - ruby_version: head
36
+ rails_version: 6.0
37
+
38
+ steps:
39
+ - uses: actions/checkout@v1
40
+
41
+ - name: Set up Ruby ${{ matrix.ruby_version }}
42
+ uses: ruby/setup-ruby@v1
43
+ with:
44
+ bundler: 1
45
+ ruby-version: ${{ matrix.ruby_version }}
46
+
47
+ - name: Build with Rails ${{ matrix.rails_version }}
48
+ env:
49
+ RAILS_VERSION: ${{ matrix.rails_version }}
50
+ run: |
51
+ bundle install --jobs 4 --retry 3
52
+ bundle exec rake
53
+
54
+ job_zeus:
55
+ name: Zeus
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - uses: actions/checkout@v2
59
+ - uses: actions/setup-node@v1
60
+ - name: Set up Ruby
61
+ uses: ruby/setup-ruby@v1
62
+ with:
63
+ ruby-version: 2.6 # Not needed with a .ruby-version file
64
+ - run: bundle install
65
+ - name: Install Zeus
66
+ run: |
67
+ yarn global add @zeus-ci/cli
68
+ echo "::add-path::$(yarn global bin)"
69
+ - name: Upload to Zeus
70
+ env:
71
+ ZEUS_API_TOKEN: ${{ secrets.ZEUS_API_TOKEN }}
72
+ ZEUS_HOOK_BASE: ${{ secrets.ZEUS_HOOK_BASE }}
73
+ run: |
74
+ zeus job update -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -r $GITHUB_SHA
75
+ gem build sentry-raven.gemspec
76
+ zeus upload -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -t "application/tar+gem" ./*.gem
77
+ zeus job update --status=passed -b $GITHUB_RUN_ID -j $GITHUB_RUN_NUMBER -r $GITHUB_SHA
data/.gitignore CHANGED
@@ -11,3 +11,5 @@ Gemfile.lock
11
11
  .ruby-gemset
12
12
  .idea
13
13
  *.rdb
14
+
15
+ examples/**/node_modules
@@ -13,33 +13,45 @@ Metrics/ClassLength:
13
13
  Metrics/AbcSize:
14
14
  Max: 40
15
15
 
16
+ Metrics/BlockLength:
17
+ Enabled: false
18
+
16
19
  Metrics/CyclomaticComplexity:
17
20
  Max: 12
18
21
 
19
22
  Metrics/PerceivedComplexity:
20
23
  Max: 11
21
24
 
22
- Metrics/LineLength:
23
- Max: 155
24
-
25
25
  Metrics/MethodLength:
26
26
  Max: 30
27
27
 
28
- Style/SignalException:
28
+ Style/SymbolArray:
29
+ Enabled: false
30
+
31
+ Style/PercentLiteralDelimiters:
32
+ Enabled: false
33
+
34
+ Style/FrozenStringLiteralComment:
29
35
  Enabled: false
30
36
 
31
- Performance/Casecmp:
37
+ Style/SignalException:
32
38
  Enabled: false
33
39
 
34
40
  Style/ClassAndModuleChildren:
35
41
  Enabled: false
36
42
 
43
+ Style/RescueStandardError:
44
+ Enabled: false
45
+
37
46
  Style/ParallelAssignment:
38
47
  Enabled: false
39
48
 
40
49
  Style/Documentation:
41
50
  Enabled: false
42
51
 
52
+ Style/CommentedKeyword:
53
+ Enabled: false
54
+
43
55
  Style/RescueModifier:
44
56
  Enabled: false
45
57
 
@@ -52,10 +64,11 @@ Style/CaseEquality:
52
64
  Style/DoubleNegation:
53
65
  Enabled: false
54
66
 
55
- Style/FileName:
56
- Exclude:
57
- - 'lib/sentry-raven-without-integrations.rb'
58
- - 'lib/sentry-raven.rb'
67
+ Style/GuardClause:
68
+ Enabled: false
69
+
70
+ Style/RedundantBegin:
71
+ Enabled: false
59
72
 
60
73
  Style/NumericLiterals:
61
74
  Exclude:
@@ -64,6 +77,9 @@ Style/NumericLiterals:
64
77
  Style/HashSyntax:
65
78
  EnforcedStyle: hash_rockets
66
79
 
80
+ Style/IfUnlessModifier:
81
+ Enabled: false
82
+
67
83
  Lint/RescueException:
68
84
  Exclude:
69
85
  - 'lib/raven/base.rb'
@@ -72,3 +88,22 @@ Lint/RescueException:
72
88
  - 'lib/raven/integrations/rack.rb'
73
89
  - 'lib/raven/integrations/sidekiq.rb'
74
90
  - 'spec/raven/event_spec.rb'
91
+
92
+ Lint/SuppressedException:
93
+ Enabled: false
94
+
95
+ Lint/AssignmentInCondition:
96
+ Enabled: false
97
+
98
+ Layout/LineLength:
99
+ Max: 155
100
+
101
+ Naming/FileName:
102
+ Exclude:
103
+ - 'lib/sentry-raven-without-integrations.rb'
104
+ - 'lib/sentry-raven.rb'
105
+ - 'lib/raven/integrations/rack-timeout.rb'
106
+
107
+ Naming/MethodParameterName:
108
+ Enabled: false
109
+
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ file_names = ['lib/raven/version.rb']
4
+
5
+ file_names.each do |file_name|
6
+ text = File.read(file_name)
7
+ new_contents = text.gsub(/\d.\d.\d/, ARGV[1])
8
+ File.open(file_name, "w") {|file| file.puts new_contents }
9
+ end
data/Gemfile CHANGED
@@ -2,37 +2,29 @@ source "https://rubygems.org/"
2
2
 
3
3
  gemspec
4
4
 
5
- if ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 4)
6
- gem "rails", "< 5"
7
- gem "rspec-rails", "> 3"
8
- elsif ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 0)
9
- # no-op. No Rails.
10
- else
11
- gem "rails", "< 6"
12
- gem "rspec-rails", "> 3"
13
- end
5
+ rails_version = ENV["RAILS_VERSION"].to_f
14
6
 
15
- if RUBY_VERSION < '2.0'
16
- gem "mime-types", "< 3.0.0"
17
- gem "nokogiri", "~> 1.6.8"
18
- gem "rack", "~> 1.6.8"
19
- gem "sidekiq", "< 3.2"
20
- gem "rack-timeout", "0.3.0"
21
- else
22
- gem "rack"
23
- gem "sidekiq"
24
- gem "rack-timeout"
7
+ if rails_version != 0
8
+ gem "rails", "~> #{rails_version}"
9
+ gem "rspec-rails", "~> 4.0"
25
10
  end
11
+
12
+ gem "sidekiq"
13
+
14
+ gem "rack"
15
+ gem "rack-timeout"
16
+
26
17
  gem "pry"
27
- gem "pry-coolline"
28
18
  gem "benchmark-ips"
29
- gem "benchmark-ipsa" if RUBY_VERSION > '2.0'
19
+ gem "benchmark-ipsa"
30
20
  gem "ruby-prof", platform: :mri
31
21
  gem "rake", "> 12"
32
- gem "rubocop", "~> 0.41.1" # Last version that supported 1.9, upgrade to 0.50 after we drop 1.9
33
- gem "rspec", "> 3"
34
- gem "capybara" # rspec system tests
22
+ gem "rubocop", "~> 0.81.0"
23
+ gem "rspec", "~> 3.9.0"
24
+ gem "capybara", "~> 3.15.0" # rspec system tests
35
25
  gem "puma" # rspec system tests
36
26
 
37
27
  gem "timecop"
38
- gem "test-unit", platform: :mri if RUBY_VERSION > '2.2'
28
+ gem "test-unit"
29
+ gem "simplecov"
30
+ gem "codecov"
data/README.md CHANGED
@@ -8,7 +8,8 @@
8
8
  # Raven-Ruby, the Ruby Client for Sentry
9
9
 
10
10
  [![Gem Version](https://img.shields.io/gem/v/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven)
11
- [![Build Status](https://img.shields.io/travis/getsentry/raven-ruby/master.svg)](https://travis-ci.org/getsentry/raven-ruby)
11
+ ![Build Status](https://github.com/getsentry/raven-ruby/workflows/Test/badge.svg)
12
+ [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/raven-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/raven-ruby/branch/master)
12
13
  [![Gem](https://img.shields.io/gem/dt/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven/)
13
14
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)
14
15
 
@@ -19,7 +20,7 @@ The official Ruby-language client and integration layer for the [Sentry](https:/
19
20
 
20
21
  ## Requirements
21
22
 
22
- We test on Ruby 1.9, 2.2, 2.3, and 2.4 at the latest patchlevel/teeny version. We also support JRuby 1.7 and 9.0. Our Rails integration works with Rails 4.2+ (including Rails 5).
23
+ We test on Ruby 2.3, 2.4, 2.5, 2.6 and 2.7 at the latest patchlevel/teeny version. We also support JRuby 9.0. Our Rails integration works with Rails 4.2+, including Rails 5 and Rails 6.
23
24
 
24
25
  ## Getting Started
25
26
 
@@ -133,4 +134,4 @@ For more information, see [Context](https://docs.sentry.io/clients/ruby/context/
133
134
  * [Documentation](https://docs.sentry.io/clients/ruby/)
134
135
  * [Bug Tracker](https://github.com/getsentry/raven-ruby/issues)
135
136
  * [Forum](https://forum.sentry.io/)
136
- * [IRC](irc://irc.freenode.net/sentry>) (irc.freenode.net, #sentry)
137
+ - [Discord](https://discord.gg/ez5KZN7)
@@ -1,3 +1,40 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 3.0.2
6
+
7
+ * fix: Add gem target for craft
8
+
9
+ ## 3.0.1
10
+
11
+ * fix: Improve SanitizeData processor (#984)
12
+ * fix: Masking cookies as key/pair instead of a single string (#983)
13
+ * fix: Transports classes' requiring issue (#986)
14
+ * fix: Frozen string issues (#977)
15
+ * feat: Officially support Rails 6 (#982)
16
+
17
+ 3.0.0
18
+ ----
19
+
20
+ * SDK now requires Ruby >= 2.3
21
+ * REF: Retain any literal "HTTP-" in header names [@elliterate, #950]
22
+ * REF: Delete JSON spec for recursive hashes [@ksylvest, #952]
23
+ * FEAT: Bump faraday version to latest [@ksylvest, #946]
24
+
25
+ 2.13.0
26
+ ----
27
+
28
+ * FIX: Sanitize event data before they are sent to async job. [@edariedl, #895]
29
+ * FIX: Serialization MongoDB ObjectId to JSON problem with gem delayed_job_mongoid conjunction. [@eagleas, #935]
30
+ * FEAT: Skip ActiveJob integration if there is a better one [@fsateler, #909]
31
+ * FIX: Bugs with send_event in asynchronous mode (#940) [@cstyles, #940]
32
+
33
+ 2.12.3
34
+ ----
35
+
36
+ * FIX: crash when Process.wait is used [@asBrettisay, #895]
37
+
1
38
  2.12.2
2
39
  ----
3
40
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ## Inspired by Rails' and Airbrake's backtrace parsers.
2
4
 
3
5
  module Raven
@@ -5,16 +7,16 @@ module Raven
5
7
  class Backtrace
6
8
  # Handles backtrace parsing line by line
7
9
  class Line
8
- RB_EXTENSION = ".rb".freeze
10
+ RB_EXTENSION = ".rb"
9
11
  # regexp (optional leading X: on windows, or JRuby9000 class-prefix)
10
12
  RUBY_INPUT_FORMAT = /
11
13
  ^ \s* (?: [a-zA-Z]: | uri:classloader: )? ([^:]+ | <.*>):
12
14
  (\d+)
13
15
  (?: :in \s `([^']+)')?$
14
- /x
16
+ /x.freeze
15
17
 
16
18
  # org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:170)
17
- JAVA_INPUT_FORMAT = /^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$/
19
+ JAVA_INPUT_FORMAT = /^(.+)\.([^\.]+)\(([^\:]+)\:(\d+)\)$/.freeze
18
20
 
19
21
  # The file portion of the line (such as app/models/user.rb)
20
22
  attr_reader :file
@@ -74,7 +76,7 @@ module Raven
74
76
 
75
77
  def self.in_app_pattern
76
78
  @in_app_pattern ||= begin
77
- project_root = Raven.configuration.project_root && Raven.configuration.project_root.to_s
79
+ project_root = Raven.configuration.project_root&.to_s
78
80
  Regexp.new("^(#{project_root}/)?#{Raven.configuration.app_dirs_pattern || APP_DIRS_PATTERN}")
79
81
  end
80
82
  end
@@ -84,7 +86,7 @@ module Raven
84
86
  attr_writer :file, :number, :method, :module_name
85
87
  end
86
88
 
87
- APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/
89
+ APP_DIRS_PATTERN = /(bin|exe|app|config|lib|test)/.freeze
88
90
 
89
91
  # holder for an Array of Backtrace::Line instances
90
92
  attr_reader :lines
@@ -85,12 +85,13 @@ module Raven
85
85
 
86
86
  def load_integration(integration)
87
87
  require "raven/integrations/#{integration}"
88
- rescue Exception => error
89
- logger.warn "Unable to load raven/integrations/#{integration}: #{error}"
88
+ rescue Exception => e
89
+ logger.warn "Unable to load raven/integrations/#{integration}: #{e}"
90
90
  end
91
91
 
92
92
  def safely_prepend(module_name, opts = {})
93
93
  return if opts[:to].nil? || opts[:from].nil?
94
+
94
95
  if opts[:to].respond_to?(:prepend, true)
95
96
  opts[:to].send(:prepend, opts[:from].const_get(module_name))
96
97
  else
@@ -100,7 +101,8 @@ module Raven
100
101
 
101
102
  def sys_command(command)
102
103
  result = `#{command} 2>&1` rescue nil
103
- return if result.nil? || result.empty? || $CHILD_STATUS.exitstatus != 0
104
+ return if result.nil? || result.empty? || ($CHILD_STATUS && $CHILD_STATUS.exitstatus != 0)
105
+
104
106
  result.strip
105
107
  end
106
108
  end
@@ -64,7 +64,7 @@ module Raven
64
64
  end
65
65
 
66
66
  def empty?
67
- !members.any?
67
+ members.none?
68
68
  end
69
69
 
70
70
  def to_hash
@@ -1,19 +1,19 @@
1
1
  module Raven
2
2
  module ActiveSupportBreadcrumbs
3
3
  class << self
4
- def add(name, started, _finished, _unique_id, data)
5
- Raven.breadcrumbs.record do |crumb|
6
- crumb.data = data
7
- crumb.category = name
8
- crumb.timestamp = started.to_i
9
- end
4
+ def add(name, started, _finished, _unique_id, data)
5
+ Raven.breadcrumbs.record do |crumb|
6
+ crumb.data = data
7
+ crumb.category = name
8
+ crumb.timestamp = started.to_i
10
9
  end
10
+ end
11
11
 
12
- def inject
13
- ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
14
- add(name, started, finished, unique_id, data)
15
- end
12
+ def inject
13
+ ActiveSupport::Notifications.subscribe(/.*/) do |name, started, finished, unique_id, data|
14
+ add(name, started, finished, unique_id, data)
16
15
  end
16
+ end
17
17
  end
18
18
  end
19
19
  end