deprecation_collector 0.0.6 → 0.2.0
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 +4 -4
- data/.rubocop.yml +15 -3
- data/Appraisals +13 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile +13 -8
- data/Gemfile.lock +136 -102
- data/README.md +4 -0
- data/deprecation_collector.gemspec +2 -1
- data/gemfiles/rails_6.gemfile +12 -0
- data/gemfiles/rails_6.gemfile.lock +194 -0
- data/gemfiles/rails_7.gemfile +12 -0
- data/gemfiles/rails_7.gemfile.lock +187 -0
- data/gemfiles/rails_none.gemfile +11 -0
- data/gemfiles/rails_none.gemfile.lock +49 -0
- data/lib/deprecation_collector/collectors.rb +3 -3
- data/lib/deprecation_collector/deprecation.rb +8 -3
- data/lib/deprecation_collector/version.rb +1 -1
- data/lib/deprecation_collector.rb +30 -11
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21042fb4a7a9045647774128efd65fd4a27b182b6122738a0407da13af1b8786
|
4
|
+
data.tar.gz: eef445a5a47d88e3b7dc55f90ee07f9cfda0539b2a059ce7bc5286773a5d17e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0309b7c02fcfe4f458feed01b3f3dd37d8510269c8b5b1296cbc545be250d73bb232bdd6a0d8a41595cadf2e268baefa60b0c0158eb87bb8bb186072560056c
|
7
|
+
data.tar.gz: 736342d4de1fef5b3326f1866f01b22e4642792a013853b849ed1ba42a32e68bc93c843f332d83b824e6f7a840b3364dc83acbfaf2f1c34c4e634bbfc21c94ff
|
data/.rubocop.yml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-rake
|
4
|
+
- rubocop-performance
|
5
|
+
|
1
6
|
AllCops:
|
2
|
-
#
|
3
|
-
TargetRubyVersion: 2.
|
7
|
+
# note additional conf in spec/
|
8
|
+
TargetRubyVersion: 2.5
|
4
9
|
NewCops: enable
|
10
|
+
SuggestExtensions: false
|
11
|
+
Exclude:
|
12
|
+
- gemfiles/*
|
5
13
|
|
6
14
|
Style/StringLiterals:
|
7
15
|
Enabled: true
|
@@ -14,7 +22,11 @@ Style/StringLiteralsInInterpolation:
|
|
14
22
|
Layout/LineLength:
|
15
23
|
Max: 120
|
16
24
|
|
17
|
-
Metrics/ClassLength: { Max:
|
25
|
+
Metrics/ClassLength: { Max: 230 }
|
18
26
|
Metrics/MethodLength: { Max: 15 }
|
27
|
+
Metrics/AbcSize: { Max: 23 }
|
19
28
|
Metrics/CyclomaticComplexity: { Max: 9 }
|
20
29
|
Metrics/PerceivedComplexity: { Max: 9 }
|
30
|
+
|
31
|
+
RSpec/ExampleLength: { Enabled: false }
|
32
|
+
RSpec/MultipleExpectations: { Enabled: false }
|
data/Appraisals
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
== 0.2.0
|
2
|
+
- ability to add custom deprecation fingerprint (for example - controller+action), use `config.fingerprinter`
|
3
|
+
|
4
|
+
== 0.1.0
|
5
|
+
- kinda-breaking: ruby 2.4 was in fact not supported, so changed requirement to 2.5
|
6
|
+
- prevent recursion when deprecation fires in `context_saver` hook
|
7
|
+
- prevent recursion in most cases if a deprecation fires in collector itself
|
8
|
+
|
9
|
+
- changed all `caller` use to `caller_locations` to match rails (and take advantage of it), `#collect` now expects backtrace with an array of `Thread::Backtrace::Location`
|
10
|
+
- added GitHub Actions CI
|
11
|
+
- added ability to run without rails
|
12
|
+
|
1
13
|
== 0.0.6
|
2
14
|
- added custom context saving ability
|
3
15
|
|
data/Gemfile
CHANGED
@@ -10,13 +10,18 @@ gem "rake", "~> 13.0"
|
|
10
10
|
gem "rspec", "~> 3.0"
|
11
11
|
gem "timecop"
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
gem "rubocop
|
16
|
-
gem "rubocop-
|
17
|
-
gem "rubocop-
|
13
|
+
unless defined?(Appraisal)
|
14
|
+
group :lint do
|
15
|
+
gem "rubocop", "~> 1.21"
|
16
|
+
gem "rubocop-performance"
|
17
|
+
gem "rubocop-rails"
|
18
|
+
gem "rubocop-rake"
|
19
|
+
gem "rubocop-rspec"
|
20
|
+
end
|
18
21
|
|
19
|
-
|
20
|
-
gem
|
22
|
+
gem "rails", "~>6.0.0"
|
23
|
+
gem 'simplecov'
|
24
|
+
end
|
21
25
|
|
22
|
-
gem
|
26
|
+
gem "fakeredis"
|
27
|
+
gem "redis", "~>4.8"
|
data/Gemfile.lock
CHANGED
@@ -1,172 +1,200 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
deprecation_collector (0.0
|
4
|
+
deprecation_collector (0.2.0)
|
5
5
|
redis (>= 3.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (6.0.
|
11
|
-
actionpack (= 6.0.
|
10
|
+
actioncable (6.0.6)
|
11
|
+
actionpack (= 6.0.6)
|
12
12
|
nio4r (~> 2.0)
|
13
13
|
websocket-driver (>= 0.6.1)
|
14
|
-
actionmailbox (6.0.
|
15
|
-
actionpack (= 6.0.
|
16
|
-
activejob (= 6.0.
|
17
|
-
activerecord (= 6.0.
|
18
|
-
activestorage (= 6.0.
|
19
|
-
activesupport (= 6.0.
|
14
|
+
actionmailbox (6.0.6)
|
15
|
+
actionpack (= 6.0.6)
|
16
|
+
activejob (= 6.0.6)
|
17
|
+
activerecord (= 6.0.6)
|
18
|
+
activestorage (= 6.0.6)
|
19
|
+
activesupport (= 6.0.6)
|
20
20
|
mail (>= 2.7.1)
|
21
|
-
actionmailer (6.0.
|
22
|
-
actionpack (= 6.0.
|
23
|
-
actionview (= 6.0.
|
24
|
-
activejob (= 6.0.
|
21
|
+
actionmailer (6.0.6)
|
22
|
+
actionpack (= 6.0.6)
|
23
|
+
actionview (= 6.0.6)
|
24
|
+
activejob (= 6.0.6)
|
25
25
|
mail (~> 2.5, >= 2.5.4)
|
26
26
|
rails-dom-testing (~> 2.0)
|
27
|
-
actionpack (6.0.
|
28
|
-
actionview (= 6.0.
|
29
|
-
activesupport (= 6.0.
|
30
|
-
rack (~> 2.0)
|
27
|
+
actionpack (6.0.6)
|
28
|
+
actionview (= 6.0.6)
|
29
|
+
activesupport (= 6.0.6)
|
30
|
+
rack (~> 2.0, >= 2.0.8)
|
31
31
|
rack-test (>= 0.6.3)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
33
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
34
|
-
actiontext (6.0.
|
35
|
-
actionpack (= 6.0.
|
36
|
-
activerecord (= 6.0.
|
37
|
-
activestorage (= 6.0.
|
38
|
-
activesupport (= 6.0.
|
34
|
+
actiontext (6.0.6)
|
35
|
+
actionpack (= 6.0.6)
|
36
|
+
activerecord (= 6.0.6)
|
37
|
+
activestorage (= 6.0.6)
|
38
|
+
activesupport (= 6.0.6)
|
39
39
|
nokogiri (>= 1.8.5)
|
40
|
-
actionview (6.0.
|
41
|
-
activesupport (= 6.0.
|
40
|
+
actionview (6.0.6)
|
41
|
+
activesupport (= 6.0.6)
|
42
42
|
builder (~> 3.1)
|
43
43
|
erubi (~> 1.4)
|
44
44
|
rails-dom-testing (~> 2.0)
|
45
45
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
46
|
-
activejob (6.0.
|
47
|
-
activesupport (= 6.0.
|
46
|
+
activejob (6.0.6)
|
47
|
+
activesupport (= 6.0.6)
|
48
48
|
globalid (>= 0.3.6)
|
49
|
-
activemodel (6.0.
|
50
|
-
activesupport (= 6.0.
|
51
|
-
activerecord (6.0.
|
52
|
-
activemodel (= 6.0.
|
53
|
-
activesupport (= 6.0.
|
54
|
-
activestorage (6.0.
|
55
|
-
actionpack (= 6.0.
|
56
|
-
activejob (= 6.0.
|
57
|
-
activerecord (= 6.0.
|
58
|
-
marcel (~> 0
|
59
|
-
activesupport (6.0.
|
49
|
+
activemodel (6.0.6)
|
50
|
+
activesupport (= 6.0.6)
|
51
|
+
activerecord (6.0.6)
|
52
|
+
activemodel (= 6.0.6)
|
53
|
+
activesupport (= 6.0.6)
|
54
|
+
activestorage (6.0.6)
|
55
|
+
actionpack (= 6.0.6)
|
56
|
+
activejob (= 6.0.6)
|
57
|
+
activerecord (= 6.0.6)
|
58
|
+
marcel (~> 1.0)
|
59
|
+
activesupport (6.0.6)
|
60
60
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
61
61
|
i18n (>= 0.7, < 2)
|
62
62
|
minitest (~> 5.1)
|
63
63
|
tzinfo (~> 1.1)
|
64
|
-
zeitwerk (~> 2.
|
64
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
65
|
+
appraisal (2.4.1)
|
66
|
+
bundler
|
67
|
+
rake
|
68
|
+
thor (>= 0.14.0)
|
65
69
|
ast (2.4.2)
|
66
70
|
builder (3.2.4)
|
67
71
|
concurrent-ruby (1.1.10)
|
68
72
|
crass (1.0.6)
|
73
|
+
date (3.3.1)
|
69
74
|
diff-lcs (1.5.0)
|
70
|
-
|
75
|
+
docile (1.4.0)
|
76
|
+
erubi (1.11.0)
|
77
|
+
fakeredis (0.8.0)
|
78
|
+
redis (~> 4.1)
|
71
79
|
globalid (1.0.0)
|
72
80
|
activesupport (>= 5.0)
|
73
|
-
i18n (1.
|
81
|
+
i18n (1.12.0)
|
74
82
|
concurrent-ruby (~> 1.0)
|
75
|
-
|
83
|
+
json (2.6.3)
|
84
|
+
loofah (2.19.1)
|
76
85
|
crass (~> 1.0.2)
|
77
86
|
nokogiri (>= 1.5.9)
|
78
|
-
mail (2.
|
87
|
+
mail (2.8.0)
|
79
88
|
mini_mime (>= 0.1.1)
|
80
|
-
|
81
|
-
|
89
|
+
net-imap
|
90
|
+
net-pop
|
91
|
+
net-smtp
|
92
|
+
marcel (1.0.2)
|
82
93
|
method_source (1.0.0)
|
83
|
-
mimemagic (0.3.10)
|
84
|
-
nokogiri (~> 1)
|
85
|
-
rake
|
86
94
|
mini_mime (1.1.2)
|
87
|
-
mini_portile2 (2.8.
|
88
|
-
minitest (5.
|
95
|
+
mini_portile2 (2.8.1)
|
96
|
+
minitest (5.16.3)
|
97
|
+
net-imap (0.3.2)
|
98
|
+
date
|
99
|
+
net-protocol
|
100
|
+
net-pop (0.1.2)
|
101
|
+
net-protocol
|
102
|
+
net-protocol (0.2.1)
|
103
|
+
timeout
|
104
|
+
net-smtp (0.3.3)
|
105
|
+
net-protocol
|
89
106
|
nio4r (2.5.8)
|
90
|
-
nokogiri (1.
|
107
|
+
nokogiri (1.14.0)
|
91
108
|
mini_portile2 (~> 2.8.0)
|
92
109
|
racc (~> 1.4)
|
93
|
-
nokogiri (1.
|
110
|
+
nokogiri (1.14.0-arm64-darwin)
|
111
|
+
racc (~> 1.4)
|
112
|
+
nokogiri (1.14.0-x86_64-darwin)
|
113
|
+
racc (~> 1.4)
|
114
|
+
nokogiri (1.14.0-x86_64-linux)
|
94
115
|
racc (~> 1.4)
|
95
116
|
parallel (1.22.1)
|
96
|
-
parser (3.1.
|
117
|
+
parser (3.1.3.0)
|
97
118
|
ast (~> 2.4.1)
|
98
|
-
racc (1.6.
|
99
|
-
rack (2.2.
|
100
|
-
rack-test (
|
101
|
-
rack (>= 1.
|
102
|
-
rails (6.0.
|
103
|
-
actioncable (= 6.0.
|
104
|
-
actionmailbox (= 6.0.
|
105
|
-
actionmailer (= 6.0.
|
106
|
-
actionpack (= 6.0.
|
107
|
-
actiontext (= 6.0.
|
108
|
-
actionview (= 6.0.
|
109
|
-
activejob (= 6.0.
|
110
|
-
activemodel (= 6.0.
|
111
|
-
activerecord (= 6.0.
|
112
|
-
activestorage (= 6.0.
|
113
|
-
activesupport (= 6.0.
|
119
|
+
racc (1.6.2)
|
120
|
+
rack (2.2.4)
|
121
|
+
rack-test (2.0.2)
|
122
|
+
rack (>= 1.3)
|
123
|
+
rails (6.0.6)
|
124
|
+
actioncable (= 6.0.6)
|
125
|
+
actionmailbox (= 6.0.6)
|
126
|
+
actionmailer (= 6.0.6)
|
127
|
+
actionpack (= 6.0.6)
|
128
|
+
actiontext (= 6.0.6)
|
129
|
+
actionview (= 6.0.6)
|
130
|
+
activejob (= 6.0.6)
|
131
|
+
activemodel (= 6.0.6)
|
132
|
+
activerecord (= 6.0.6)
|
133
|
+
activestorage (= 6.0.6)
|
134
|
+
activesupport (= 6.0.6)
|
114
135
|
bundler (>= 1.3.0)
|
115
|
-
railties (= 6.0.
|
136
|
+
railties (= 6.0.6)
|
116
137
|
sprockets-rails (>= 2.0.0)
|
117
138
|
rails-dom-testing (2.0.3)
|
118
139
|
activesupport (>= 4.2.0)
|
119
140
|
nokogiri (>= 1.6)
|
120
|
-
rails-html-sanitizer (1.4.
|
121
|
-
loofah (~> 2.
|
122
|
-
railties (6.0.
|
123
|
-
actionpack (= 6.0.
|
124
|
-
activesupport (= 6.0.
|
141
|
+
rails-html-sanitizer (1.4.4)
|
142
|
+
loofah (~> 2.19, >= 2.19.1)
|
143
|
+
railties (6.0.6)
|
144
|
+
actionpack (= 6.0.6)
|
145
|
+
activesupport (= 6.0.6)
|
125
146
|
method_source
|
126
147
|
rake (>= 0.8.7)
|
127
148
|
thor (>= 0.20.3, < 2.0)
|
128
149
|
rainbow (3.1.1)
|
129
150
|
rake (13.0.6)
|
130
151
|
redis (4.8.0)
|
131
|
-
regexp_parser (2.
|
152
|
+
regexp_parser (2.6.1)
|
132
153
|
rexml (3.2.5)
|
133
|
-
rspec (3.
|
134
|
-
rspec-core (~> 3.
|
135
|
-
rspec-expectations (~> 3.
|
136
|
-
rspec-mocks (~> 3.
|
137
|
-
rspec-core (3.
|
138
|
-
rspec-support (~> 3.
|
139
|
-
rspec-expectations (3.
|
154
|
+
rspec (3.12.0)
|
155
|
+
rspec-core (~> 3.12.0)
|
156
|
+
rspec-expectations (~> 3.12.0)
|
157
|
+
rspec-mocks (~> 3.12.0)
|
158
|
+
rspec-core (3.12.0)
|
159
|
+
rspec-support (~> 3.12.0)
|
160
|
+
rspec-expectations (3.12.0)
|
140
161
|
diff-lcs (>= 1.2.0, < 2.0)
|
141
|
-
rspec-support (~> 3.
|
142
|
-
rspec-mocks (3.
|
162
|
+
rspec-support (~> 3.12.0)
|
163
|
+
rspec-mocks (3.12.1)
|
143
164
|
diff-lcs (>= 1.2.0, < 2.0)
|
144
|
-
rspec-support (~> 3.
|
145
|
-
rspec-support (3.
|
146
|
-
rubocop (1.
|
165
|
+
rspec-support (~> 3.12.0)
|
166
|
+
rspec-support (3.12.0)
|
167
|
+
rubocop (1.40.0)
|
168
|
+
json (~> 2.3)
|
147
169
|
parallel (~> 1.10)
|
148
|
-
parser (>= 3.1.
|
170
|
+
parser (>= 3.1.2.1)
|
149
171
|
rainbow (>= 2.2.2, < 4.0)
|
150
172
|
regexp_parser (>= 1.8, < 3.0)
|
151
173
|
rexml (>= 3.2.5, < 4.0)
|
152
|
-
rubocop-ast (>= 1.
|
174
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
153
175
|
ruby-progressbar (~> 1.7)
|
154
176
|
unicode-display_width (>= 1.4.0, < 3.0)
|
155
|
-
rubocop-ast (1.
|
177
|
+
rubocop-ast (1.24.0)
|
156
178
|
parser (>= 3.1.1.0)
|
157
|
-
rubocop-performance (1.
|
179
|
+
rubocop-performance (1.15.1)
|
158
180
|
rubocop (>= 1.7.0, < 2.0)
|
159
181
|
rubocop-ast (>= 0.4.0)
|
160
|
-
rubocop-rails (2.
|
182
|
+
rubocop-rails (2.17.3)
|
161
183
|
activesupport (>= 4.2.0)
|
162
184
|
rack (>= 1.1)
|
163
|
-
rubocop (>= 1.
|
185
|
+
rubocop (>= 1.33.0, < 2.0)
|
164
186
|
rubocop-rake (0.6.0)
|
165
187
|
rubocop (~> 1.0)
|
166
|
-
rubocop-rspec (2.
|
167
|
-
rubocop (~> 1.
|
188
|
+
rubocop-rspec (2.16.0)
|
189
|
+
rubocop (~> 1.33)
|
168
190
|
ruby-progressbar (1.11.0)
|
169
|
-
|
191
|
+
simplecov (0.22.0)
|
192
|
+
docile (~> 1.1)
|
193
|
+
simplecov-html (~> 0.11)
|
194
|
+
simplecov_json_formatter (~> 0.1)
|
195
|
+
simplecov-html (0.12.3)
|
196
|
+
simplecov_json_formatter (0.1.4)
|
197
|
+
sprockets (4.1.1)
|
170
198
|
concurrent-ruby (~> 1.0)
|
171
199
|
rack (> 1, < 3)
|
172
200
|
sprockets-rails (3.4.2)
|
@@ -175,22 +203,27 @@ GEM
|
|
175
203
|
sprockets (>= 3.0.0)
|
176
204
|
thor (1.2.1)
|
177
205
|
thread_safe (0.3.6)
|
178
|
-
timecop (0.9.
|
179
|
-
|
206
|
+
timecop (0.9.6)
|
207
|
+
timeout (0.3.1)
|
208
|
+
tzinfo (1.2.10)
|
180
209
|
thread_safe (~> 0.1)
|
181
|
-
unicode-display_width (2.
|
210
|
+
unicode-display_width (2.3.0)
|
182
211
|
websocket-driver (0.7.5)
|
183
212
|
websocket-extensions (>= 0.1.0)
|
184
213
|
websocket-extensions (0.1.5)
|
185
|
-
zeitwerk (2.
|
214
|
+
zeitwerk (2.6.6)
|
186
215
|
|
187
216
|
PLATFORMS
|
217
|
+
arm64-darwin
|
188
218
|
ruby
|
189
|
-
x86_64-darwin
|
219
|
+
x86_64-darwin
|
220
|
+
x86_64-linux
|
190
221
|
|
191
222
|
DEPENDENCIES
|
223
|
+
appraisal
|
192
224
|
deprecation_collector!
|
193
|
-
|
225
|
+
fakeredis
|
226
|
+
rails (~> 6.0.0)
|
194
227
|
rake (~> 13.0)
|
195
228
|
redis (~> 4.8)
|
196
229
|
rspec (~> 3.0)
|
@@ -199,6 +232,7 @@ DEPENDENCIES
|
|
199
232
|
rubocop-rails
|
200
233
|
rubocop-rake
|
201
234
|
rubocop-rspec
|
235
|
+
simplecov
|
202
236
|
timecop
|
203
237
|
|
204
238
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -37,6 +37,10 @@ Add an initializer with configuration, like
|
|
37
37
|
# this will only be called for new deprecations, return value must be json-compatible
|
38
38
|
{ some: "custom", context: "for example request.id" }
|
39
39
|
end
|
40
|
+
instance.fingerprinter do |deprecation|
|
41
|
+
# this will be added to fingerprint; this will be ignored for recursive deprecations
|
42
|
+
"return_string_here"
|
43
|
+
end
|
40
44
|
end
|
41
45
|
end
|
42
46
|
```
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Collects and aggregates warnings and deprecations. Optimized for production environment."
|
13
13
|
spec.homepage = "https://github.com/Vasfed/deprecation_collector"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 2.5.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/Vasfed/deprecation_collector"
|
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ["lib"]
|
29
29
|
|
30
30
|
spec.add_dependency "redis", ">= 3.0"
|
31
|
+
spec.add_development_dependency "appraisal"
|
31
32
|
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
deprecation_collector (0.2.0)
|
5
|
+
redis (>= 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (6.1.7.1)
|
11
|
+
actionpack (= 6.1.7.1)
|
12
|
+
activesupport (= 6.1.7.1)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (6.1.7.1)
|
16
|
+
actionpack (= 6.1.7.1)
|
17
|
+
activejob (= 6.1.7.1)
|
18
|
+
activerecord (= 6.1.7.1)
|
19
|
+
activestorage (= 6.1.7.1)
|
20
|
+
activesupport (= 6.1.7.1)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
actionmailer (6.1.7.1)
|
23
|
+
actionpack (= 6.1.7.1)
|
24
|
+
actionview (= 6.1.7.1)
|
25
|
+
activejob (= 6.1.7.1)
|
26
|
+
activesupport (= 6.1.7.1)
|
27
|
+
mail (~> 2.5, >= 2.5.4)
|
28
|
+
rails-dom-testing (~> 2.0)
|
29
|
+
actionpack (6.1.7.1)
|
30
|
+
actionview (= 6.1.7.1)
|
31
|
+
activesupport (= 6.1.7.1)
|
32
|
+
rack (~> 2.0, >= 2.0.9)
|
33
|
+
rack-test (>= 0.6.3)
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
+
actiontext (6.1.7.1)
|
37
|
+
actionpack (= 6.1.7.1)
|
38
|
+
activerecord (= 6.1.7.1)
|
39
|
+
activestorage (= 6.1.7.1)
|
40
|
+
activesupport (= 6.1.7.1)
|
41
|
+
nokogiri (>= 1.8.5)
|
42
|
+
actionview (6.1.7.1)
|
43
|
+
activesupport (= 6.1.7.1)
|
44
|
+
builder (~> 3.1)
|
45
|
+
erubi (~> 1.4)
|
46
|
+
rails-dom-testing (~> 2.0)
|
47
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
+
activejob (6.1.7.1)
|
49
|
+
activesupport (= 6.1.7.1)
|
50
|
+
globalid (>= 0.3.6)
|
51
|
+
activemodel (6.1.7.1)
|
52
|
+
activesupport (= 6.1.7.1)
|
53
|
+
activerecord (6.1.7.1)
|
54
|
+
activemodel (= 6.1.7.1)
|
55
|
+
activesupport (= 6.1.7.1)
|
56
|
+
activestorage (6.1.7.1)
|
57
|
+
actionpack (= 6.1.7.1)
|
58
|
+
activejob (= 6.1.7.1)
|
59
|
+
activerecord (= 6.1.7.1)
|
60
|
+
activesupport (= 6.1.7.1)
|
61
|
+
marcel (~> 1.0)
|
62
|
+
mini_mime (>= 1.1.0)
|
63
|
+
activesupport (6.1.7.1)
|
64
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
65
|
+
i18n (>= 1.6, < 2)
|
66
|
+
minitest (>= 5.1)
|
67
|
+
tzinfo (~> 2.0)
|
68
|
+
zeitwerk (~> 2.3)
|
69
|
+
appraisal (2.4.1)
|
70
|
+
bundler
|
71
|
+
rake
|
72
|
+
thor (>= 0.14.0)
|
73
|
+
builder (3.2.4)
|
74
|
+
concurrent-ruby (1.1.10)
|
75
|
+
crass (1.0.6)
|
76
|
+
diff-lcs (1.5.0)
|
77
|
+
digest (3.1.1)
|
78
|
+
erubi (1.12.0)
|
79
|
+
fakeredis (0.8.0)
|
80
|
+
redis (~> 4.1)
|
81
|
+
globalid (1.0.0)
|
82
|
+
activesupport (>= 5.0)
|
83
|
+
i18n (1.12.0)
|
84
|
+
concurrent-ruby (~> 1.0)
|
85
|
+
io-wait (0.3.0)
|
86
|
+
loofah (2.19.1)
|
87
|
+
crass (~> 1.0.2)
|
88
|
+
nokogiri (>= 1.5.9)
|
89
|
+
mail (2.8.0.1)
|
90
|
+
mini_mime (>= 0.1.1)
|
91
|
+
net-imap
|
92
|
+
net-pop
|
93
|
+
net-smtp
|
94
|
+
marcel (1.0.2)
|
95
|
+
method_source (1.0.0)
|
96
|
+
mini_mime (1.1.2)
|
97
|
+
minitest (5.15.0)
|
98
|
+
net-imap (0.2.2)
|
99
|
+
digest
|
100
|
+
net-protocol
|
101
|
+
strscan
|
102
|
+
net-pop (0.1.2)
|
103
|
+
net-protocol
|
104
|
+
net-protocol (0.1.2)
|
105
|
+
io-wait
|
106
|
+
timeout
|
107
|
+
net-smtp (0.3.0)
|
108
|
+
digest
|
109
|
+
net-protocol
|
110
|
+
timeout
|
111
|
+
nio4r (2.5.8)
|
112
|
+
nokogiri (1.12.5-x86_64-darwin)
|
113
|
+
racc (~> 1.4)
|
114
|
+
nokogiri (1.12.5-x86_64-linux)
|
115
|
+
racc (~> 1.4)
|
116
|
+
racc (1.6.2)
|
117
|
+
rack (2.2.6.1)
|
118
|
+
rack-test (2.0.2)
|
119
|
+
rack (>= 1.3)
|
120
|
+
rails (6.1.7.1)
|
121
|
+
actioncable (= 6.1.7.1)
|
122
|
+
actionmailbox (= 6.1.7.1)
|
123
|
+
actionmailer (= 6.1.7.1)
|
124
|
+
actionpack (= 6.1.7.1)
|
125
|
+
actiontext (= 6.1.7.1)
|
126
|
+
actionview (= 6.1.7.1)
|
127
|
+
activejob (= 6.1.7.1)
|
128
|
+
activemodel (= 6.1.7.1)
|
129
|
+
activerecord (= 6.1.7.1)
|
130
|
+
activestorage (= 6.1.7.1)
|
131
|
+
activesupport (= 6.1.7.1)
|
132
|
+
bundler (>= 1.15.0)
|
133
|
+
railties (= 6.1.7.1)
|
134
|
+
sprockets-rails (>= 2.0.0)
|
135
|
+
rails-dom-testing (2.0.3)
|
136
|
+
activesupport (>= 4.2.0)
|
137
|
+
nokogiri (>= 1.6)
|
138
|
+
rails-html-sanitizer (1.4.4)
|
139
|
+
loofah (~> 2.19, >= 2.19.1)
|
140
|
+
railties (6.1.7.1)
|
141
|
+
actionpack (= 6.1.7.1)
|
142
|
+
activesupport (= 6.1.7.1)
|
143
|
+
method_source
|
144
|
+
rake (>= 12.2)
|
145
|
+
thor (~> 1.0)
|
146
|
+
rake (13.0.6)
|
147
|
+
redis (4.8.0)
|
148
|
+
rspec (3.12.0)
|
149
|
+
rspec-core (~> 3.12.0)
|
150
|
+
rspec-expectations (~> 3.12.0)
|
151
|
+
rspec-mocks (~> 3.12.0)
|
152
|
+
rspec-core (3.12.0)
|
153
|
+
rspec-support (~> 3.12.0)
|
154
|
+
rspec-expectations (3.12.2)
|
155
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
156
|
+
rspec-support (~> 3.12.0)
|
157
|
+
rspec-mocks (3.12.3)
|
158
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
159
|
+
rspec-support (~> 3.12.0)
|
160
|
+
rspec-support (3.12.0)
|
161
|
+
sprockets (4.2.0)
|
162
|
+
concurrent-ruby (~> 1.0)
|
163
|
+
rack (>= 2.2.4, < 4)
|
164
|
+
sprockets-rails (3.4.2)
|
165
|
+
actionpack (>= 5.2)
|
166
|
+
activesupport (>= 5.2)
|
167
|
+
sprockets (>= 3.0.0)
|
168
|
+
strscan (3.0.5)
|
169
|
+
thor (1.2.1)
|
170
|
+
timecop (0.9.6)
|
171
|
+
timeout (0.3.1)
|
172
|
+
tzinfo (2.0.5)
|
173
|
+
concurrent-ruby (~> 1.0)
|
174
|
+
websocket-driver (0.7.5)
|
175
|
+
websocket-extensions (>= 0.1.0)
|
176
|
+
websocket-extensions (0.1.5)
|
177
|
+
zeitwerk (2.6.6)
|
178
|
+
|
179
|
+
PLATFORMS
|
180
|
+
x86_64-darwin-21
|
181
|
+
x86_64-linux
|
182
|
+
|
183
|
+
DEPENDENCIES
|
184
|
+
appraisal
|
185
|
+
deprecation_collector!
|
186
|
+
fakeredis
|
187
|
+
rails (~> 6.0)
|
188
|
+
rake (~> 13.0)
|
189
|
+
redis (~> 4.8)
|
190
|
+
rspec (~> 3.0)
|
191
|
+
timecop
|
192
|
+
|
193
|
+
BUNDLED WITH
|
194
|
+
2.3.10
|
@@ -0,0 +1,187 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
deprecation_collector (0.2.0)
|
5
|
+
redis (>= 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (7.0.4.1)
|
11
|
+
actionpack (= 7.0.4.1)
|
12
|
+
activesupport (= 7.0.4.1)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (7.0.4.1)
|
16
|
+
actionpack (= 7.0.4.1)
|
17
|
+
activejob (= 7.0.4.1)
|
18
|
+
activerecord (= 7.0.4.1)
|
19
|
+
activestorage (= 7.0.4.1)
|
20
|
+
activesupport (= 7.0.4.1)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
net-imap
|
23
|
+
net-pop
|
24
|
+
net-smtp
|
25
|
+
actionmailer (7.0.4.1)
|
26
|
+
actionpack (= 7.0.4.1)
|
27
|
+
actionview (= 7.0.4.1)
|
28
|
+
activejob (= 7.0.4.1)
|
29
|
+
activesupport (= 7.0.4.1)
|
30
|
+
mail (~> 2.5, >= 2.5.4)
|
31
|
+
net-imap
|
32
|
+
net-pop
|
33
|
+
net-smtp
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
actionpack (7.0.4.1)
|
36
|
+
actionview (= 7.0.4.1)
|
37
|
+
activesupport (= 7.0.4.1)
|
38
|
+
rack (~> 2.0, >= 2.2.0)
|
39
|
+
rack-test (>= 0.6.3)
|
40
|
+
rails-dom-testing (~> 2.0)
|
41
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
42
|
+
actiontext (7.0.4.1)
|
43
|
+
actionpack (= 7.0.4.1)
|
44
|
+
activerecord (= 7.0.4.1)
|
45
|
+
activestorage (= 7.0.4.1)
|
46
|
+
activesupport (= 7.0.4.1)
|
47
|
+
globalid (>= 0.6.0)
|
48
|
+
nokogiri (>= 1.8.5)
|
49
|
+
actionview (7.0.4.1)
|
50
|
+
activesupport (= 7.0.4.1)
|
51
|
+
builder (~> 3.1)
|
52
|
+
erubi (~> 1.4)
|
53
|
+
rails-dom-testing (~> 2.0)
|
54
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
55
|
+
activejob (7.0.4.1)
|
56
|
+
activesupport (= 7.0.4.1)
|
57
|
+
globalid (>= 0.3.6)
|
58
|
+
activemodel (7.0.4.1)
|
59
|
+
activesupport (= 7.0.4.1)
|
60
|
+
activerecord (7.0.4.1)
|
61
|
+
activemodel (= 7.0.4.1)
|
62
|
+
activesupport (= 7.0.4.1)
|
63
|
+
activestorage (7.0.4.1)
|
64
|
+
actionpack (= 7.0.4.1)
|
65
|
+
activejob (= 7.0.4.1)
|
66
|
+
activerecord (= 7.0.4.1)
|
67
|
+
activesupport (= 7.0.4.1)
|
68
|
+
marcel (~> 1.0)
|
69
|
+
mini_mime (>= 1.1.0)
|
70
|
+
activesupport (7.0.4.1)
|
71
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
72
|
+
i18n (>= 1.6, < 2)
|
73
|
+
minitest (>= 5.1)
|
74
|
+
tzinfo (~> 2.0)
|
75
|
+
appraisal (2.4.1)
|
76
|
+
bundler
|
77
|
+
rake
|
78
|
+
thor (>= 0.14.0)
|
79
|
+
builder (3.2.4)
|
80
|
+
concurrent-ruby (1.1.10)
|
81
|
+
crass (1.0.6)
|
82
|
+
date (3.3.3)
|
83
|
+
diff-lcs (1.5.0)
|
84
|
+
erubi (1.12.0)
|
85
|
+
fakeredis (0.8.0)
|
86
|
+
redis (~> 4.1)
|
87
|
+
globalid (1.0.0)
|
88
|
+
activesupport (>= 5.0)
|
89
|
+
i18n (1.12.0)
|
90
|
+
concurrent-ruby (~> 1.0)
|
91
|
+
loofah (2.19.1)
|
92
|
+
crass (~> 1.0.2)
|
93
|
+
nokogiri (>= 1.5.9)
|
94
|
+
mail (2.8.0.1)
|
95
|
+
mini_mime (>= 0.1.1)
|
96
|
+
net-imap
|
97
|
+
net-pop
|
98
|
+
net-smtp
|
99
|
+
marcel (1.0.2)
|
100
|
+
method_source (1.0.0)
|
101
|
+
mini_mime (1.1.2)
|
102
|
+
minitest (5.17.0)
|
103
|
+
net-imap (0.3.4)
|
104
|
+
date
|
105
|
+
net-protocol
|
106
|
+
net-pop (0.1.2)
|
107
|
+
net-protocol
|
108
|
+
net-protocol (0.2.1)
|
109
|
+
timeout
|
110
|
+
net-smtp (0.3.3)
|
111
|
+
net-protocol
|
112
|
+
nio4r (2.5.8)
|
113
|
+
nokogiri (1.14.0-x86_64-darwin)
|
114
|
+
racc (~> 1.4)
|
115
|
+
nokogiri (1.14.0-x86_64-linux)
|
116
|
+
racc (~> 1.4)
|
117
|
+
racc (1.6.2)
|
118
|
+
rack (2.2.6.1)
|
119
|
+
rack-test (2.0.2)
|
120
|
+
rack (>= 1.3)
|
121
|
+
rails (7.0.4.1)
|
122
|
+
actioncable (= 7.0.4.1)
|
123
|
+
actionmailbox (= 7.0.4.1)
|
124
|
+
actionmailer (= 7.0.4.1)
|
125
|
+
actionpack (= 7.0.4.1)
|
126
|
+
actiontext (= 7.0.4.1)
|
127
|
+
actionview (= 7.0.4.1)
|
128
|
+
activejob (= 7.0.4.1)
|
129
|
+
activemodel (= 7.0.4.1)
|
130
|
+
activerecord (= 7.0.4.1)
|
131
|
+
activestorage (= 7.0.4.1)
|
132
|
+
activesupport (= 7.0.4.1)
|
133
|
+
bundler (>= 1.15.0)
|
134
|
+
railties (= 7.0.4.1)
|
135
|
+
rails-dom-testing (2.0.3)
|
136
|
+
activesupport (>= 4.2.0)
|
137
|
+
nokogiri (>= 1.6)
|
138
|
+
rails-html-sanitizer (1.4.4)
|
139
|
+
loofah (~> 2.19, >= 2.19.1)
|
140
|
+
railties (7.0.4.1)
|
141
|
+
actionpack (= 7.0.4.1)
|
142
|
+
activesupport (= 7.0.4.1)
|
143
|
+
method_source
|
144
|
+
rake (>= 12.2)
|
145
|
+
thor (~> 1.0)
|
146
|
+
zeitwerk (~> 2.5)
|
147
|
+
rake (13.0.6)
|
148
|
+
redis (4.8.0)
|
149
|
+
rspec (3.12.0)
|
150
|
+
rspec-core (~> 3.12.0)
|
151
|
+
rspec-expectations (~> 3.12.0)
|
152
|
+
rspec-mocks (~> 3.12.0)
|
153
|
+
rspec-core (3.12.0)
|
154
|
+
rspec-support (~> 3.12.0)
|
155
|
+
rspec-expectations (3.12.2)
|
156
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
157
|
+
rspec-support (~> 3.12.0)
|
158
|
+
rspec-mocks (3.12.3)
|
159
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
160
|
+
rspec-support (~> 3.12.0)
|
161
|
+
rspec-support (3.12.0)
|
162
|
+
thor (1.2.1)
|
163
|
+
timecop (0.9.6)
|
164
|
+
timeout (0.3.1)
|
165
|
+
tzinfo (2.0.5)
|
166
|
+
concurrent-ruby (~> 1.0)
|
167
|
+
websocket-driver (0.7.5)
|
168
|
+
websocket-extensions (>= 0.1.0)
|
169
|
+
websocket-extensions (0.1.5)
|
170
|
+
zeitwerk (2.6.6)
|
171
|
+
|
172
|
+
PLATFORMS
|
173
|
+
x86_64-darwin-21
|
174
|
+
x86_64-linux
|
175
|
+
|
176
|
+
DEPENDENCIES
|
177
|
+
appraisal
|
178
|
+
deprecation_collector!
|
179
|
+
fakeredis
|
180
|
+
rails (~> 7.0)
|
181
|
+
rake (~> 13.0)
|
182
|
+
redis (~> 4.8)
|
183
|
+
rspec (~> 3.0)
|
184
|
+
timecop
|
185
|
+
|
186
|
+
BUNDLED WITH
|
187
|
+
2.3.10
|
@@ -0,0 +1,49 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
deprecation_collector (0.2.0)
|
5
|
+
redis (>= 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.4.1)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
diff-lcs (1.5.0)
|
15
|
+
fakeredis (0.8.0)
|
16
|
+
redis (~> 4.1)
|
17
|
+
rake (13.0.6)
|
18
|
+
redis (4.8.0)
|
19
|
+
rspec (3.12.0)
|
20
|
+
rspec-core (~> 3.12.0)
|
21
|
+
rspec-expectations (~> 3.12.0)
|
22
|
+
rspec-mocks (~> 3.12.0)
|
23
|
+
rspec-core (3.12.0)
|
24
|
+
rspec-support (~> 3.12.0)
|
25
|
+
rspec-expectations (3.12.2)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.12.0)
|
28
|
+
rspec-mocks (3.12.3)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.12.0)
|
31
|
+
rspec-support (3.12.0)
|
32
|
+
thor (1.2.1)
|
33
|
+
timecop (0.9.6)
|
34
|
+
|
35
|
+
PLATFORMS
|
36
|
+
x86_64-darwin-21
|
37
|
+
x86_64-linux
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
appraisal
|
41
|
+
deprecation_collector!
|
42
|
+
fakeredis
|
43
|
+
rake (~> 13.0)
|
44
|
+
redis (~> 4.8)
|
45
|
+
rspec (~> 3.0)
|
46
|
+
timecop
|
47
|
+
|
48
|
+
BUNDLED WITH
|
49
|
+
2.3.10
|
@@ -39,7 +39,7 @@ class DeprecationCollector
|
|
39
39
|
remove_method :warn
|
40
40
|
end
|
41
41
|
module_function(define_method(:warn) do |*messages, **kwargs|
|
42
|
-
KernelWarningCollector.warn(*messages, backtrace:
|
42
|
+
KernelWarningCollector.warn(*messages, backtrace: caller_locations, **kwargs)
|
43
43
|
end)
|
44
44
|
end
|
45
45
|
end
|
@@ -83,7 +83,7 @@ class DeprecationCollector
|
|
83
83
|
# taps into ruby core Warning#warn
|
84
84
|
module WarningCollector
|
85
85
|
def warn(str)
|
86
|
-
backtrace =
|
86
|
+
backtrace = caller_locations
|
87
87
|
MultipartWarningJoiner.handle(str) do |multi_str|
|
88
88
|
DeprecationCollector.collect(multi_str, backtrace, :warning)
|
89
89
|
end
|
@@ -95,7 +95,7 @@ class DeprecationCollector
|
|
95
95
|
module_function
|
96
96
|
|
97
97
|
def warn(*messages, backtrace: nil, **_kwargs)
|
98
|
-
backtrace ||=
|
98
|
+
backtrace ||= caller_locations
|
99
99
|
str = messages.map(&:to_s).join("\n").strip
|
100
100
|
DeprecationCollector.collect(str, backtrace, :kernel)
|
101
101
|
# not passing to `super` - it will pass to Warning#warn, we do not want that
|
@@ -4,7 +4,7 @@ class DeprecationCollector
|
|
4
4
|
# :nodoc:
|
5
5
|
class Deprecation
|
6
6
|
attr_reader :message, :realm, :gem_traceline, :app_traceline, :occurences, :first_timestamp, :full_backtrace
|
7
|
-
attr_accessor :context
|
7
|
+
attr_accessor :context, :custom_fingerprint
|
8
8
|
|
9
9
|
CLEANUP_REGEXES = {
|
10
10
|
# rails views generated methods names are unique per-worker
|
@@ -55,7 +55,8 @@ class DeprecationCollector
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def digest_base
|
58
|
-
"1:#{RUBY_VERSION}:#{defined?(Rails) && Rails.version}:#{message_for_digest}:#{gem_traceline}:#{app_traceline}"
|
58
|
+
"1:#{RUBY_VERSION}:#{defined?(Rails) && Rails.version}:#{message_for_digest}:#{gem_traceline}:#{app_traceline}" \
|
59
|
+
"#{":#{custom_fingerprint}" if custom_fingerprint}"
|
59
60
|
end
|
60
61
|
|
61
62
|
def as_json(_options = {})
|
@@ -76,12 +77,16 @@ class DeprecationCollector
|
|
76
77
|
}.compact
|
77
78
|
end
|
78
79
|
|
80
|
+
def to_json(_options = {})
|
81
|
+
as_json.to_json
|
82
|
+
end
|
83
|
+
|
79
84
|
protected
|
80
85
|
|
81
86
|
def find_app_traceline(backtrace)
|
82
87
|
app_root = DeprecationCollector.instance.app_root_prefix
|
83
88
|
backtrace.find do |line|
|
84
|
-
line = line.
|
89
|
+
line = line.path if line.respond_to?(:path) # in production always passes, strings should only come in test
|
85
90
|
(!line.start_with?("/") || line.start_with?(app_root)) && !line.include?("/gems/")
|
86
91
|
end&.to_s&.dup&.delete_prefix(app_root)
|
87
92
|
end
|
@@ -6,6 +6,7 @@ require_relative "deprecation_collector/collectors"
|
|
6
6
|
require "time"
|
7
7
|
require "redis"
|
8
8
|
require "json"
|
9
|
+
require "set"
|
9
10
|
|
10
11
|
# singleton class for collector
|
11
12
|
class DeprecationCollector
|
@@ -56,7 +57,7 @@ class DeprecationCollector
|
|
56
57
|
:write_interval, :write_interval_jitter,
|
57
58
|
:app_revision, :app_root,
|
58
59
|
:print_to_stderr, :print_recurring
|
59
|
-
attr_writer :redis, :context_saver
|
60
|
+
attr_writer :redis, :context_saver, :fingerprinter
|
60
61
|
|
61
62
|
def initialize(mutex: nil)
|
62
63
|
# on cruby hash itself is threadsafe, but we need to prevent races
|
@@ -87,11 +88,17 @@ class DeprecationCollector
|
|
87
88
|
end
|
88
89
|
|
89
90
|
def context_saver(&block)
|
90
|
-
return @context_saver unless
|
91
|
+
return @context_saver unless block
|
91
92
|
|
92
93
|
@context_saver = block
|
93
94
|
end
|
94
95
|
|
96
|
+
def fingerprinter(&block)
|
97
|
+
return @fingerprinter unless block
|
98
|
+
|
99
|
+
@fingerprinter = block
|
100
|
+
end
|
101
|
+
|
95
102
|
def app_root_prefix
|
96
103
|
"#{app_root}/"
|
97
104
|
end
|
@@ -100,17 +107,20 @@ class DeprecationCollector
|
|
100
107
|
@cleanup_prefixes ||= Gem.path + [app_root_prefix]
|
101
108
|
end
|
102
109
|
|
103
|
-
def collect(message, backtrace, realm = :unknown)
|
110
|
+
def collect(message, backtrace = caller_locations, realm = :unknown)
|
104
111
|
return if !@enabled || exclude_realms.include?(realm) || @ignore_message_regexp&.match?(message)
|
105
112
|
raise "Deprecation: #{message}" if @raise_on_deprecation
|
106
113
|
|
114
|
+
recursion_iterations_detected = backtrace.count { |l| l.path == __FILE__ && l.base_label == __method__.to_s }
|
115
|
+
return if recursion_iterations_detected > 1 # we have a loop, ignore deep nested deprecations
|
116
|
+
|
107
117
|
deprecation = Deprecation.new(message, realm, backtrace, cleanup_prefixes)
|
108
|
-
fresh = store_deprecation(deprecation)
|
118
|
+
fresh = store_deprecation(deprecation, allow_context: recursion_iterations_detected.zero?)
|
109
119
|
log_deprecation_if_needed(deprecation, fresh)
|
110
120
|
end
|
111
121
|
|
112
122
|
def unsent_data?
|
113
|
-
|
123
|
+
unsent_deprecations.any?
|
114
124
|
end
|
115
125
|
|
116
126
|
def count?
|
@@ -123,7 +133,7 @@ class DeprecationCollector
|
|
123
133
|
@redis
|
124
134
|
end
|
125
135
|
|
126
|
-
def write_to_redis(force: false)
|
136
|
+
def write_to_redis(force: false)
|
127
137
|
return unless force || (@enabled && (current_time > @last_write_time + @write_interval))
|
128
138
|
|
129
139
|
deprecations_to_flush = nil
|
@@ -232,11 +242,17 @@ class DeprecationCollector
|
|
232
242
|
|
233
243
|
protected
|
234
244
|
|
235
|
-
def
|
245
|
+
def unsent_deprecations
|
246
|
+
@deprecations
|
247
|
+
end
|
248
|
+
|
249
|
+
def store_deprecation(deprecation, allow_context: true)
|
236
250
|
return if deprecation.ignored?
|
237
|
-
fresh = !@deprecations.key?(deprecation.digest)
|
238
|
-
deprecation.context = context_saver.call if context_saver
|
239
251
|
|
252
|
+
deprecation.context = context_saver.call if context_saver && allow_context
|
253
|
+
deprecation.custom_fingerprint = fingerprinter.call(deprecation) if fingerprinter && allow_context
|
254
|
+
|
255
|
+
fresh = !@deprecations.key?(deprecation.digest)
|
240
256
|
@deprecations_mutex.synchronize do
|
241
257
|
(@deprecations[deprecation.digest] ||= deprecation).touch
|
242
258
|
end
|
@@ -248,8 +264,9 @@ class DeprecationCollector
|
|
248
264
|
def log_deprecation_if_needed(deprecation, fresh)
|
249
265
|
return unless print_to_stderr && !deprecation.ignored?
|
250
266
|
return unless fresh || print_recurring
|
267
|
+
|
251
268
|
msg = deprecation.message
|
252
|
-
msg = "DEPRECATION: #{msg}" unless msg.start_with?(
|
269
|
+
msg = "DEPRECATION: #{msg}" unless msg.start_with?("DEPRECAT")
|
253
270
|
$stderr.puts(msg) # rubocop:disable Style/StderrPuts
|
254
271
|
end
|
255
272
|
|
@@ -261,11 +278,13 @@ class DeprecationCollector
|
|
261
278
|
|
262
279
|
def decode_deprecation(digest, data, count, notes)
|
263
280
|
return nil unless data
|
281
|
+
|
264
282
|
data = JSON.parse(data, symbolize_names: true)
|
265
283
|
unless data.is_a?(Hash)
|
266
|
-
|
284
|
+
# this should not happen (this means broken Deprecation#to_json or some data curruption)
|
267
285
|
return nil
|
268
286
|
end
|
287
|
+
|
269
288
|
data[:digest] = digest
|
270
289
|
data[:notes] = JSON.parse(notes, symbolize_names: true) if notes
|
271
290
|
data[:count] = count.to_i if count
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deprecation_collector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Fedoseyev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: appraisal
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
description: Collects and aggregates warnings and deprecations. Optimized for production
|
28
42
|
environment.
|
29
43
|
email:
|
@@ -34,6 +48,7 @@ extra_rdoc_files: []
|
|
34
48
|
files:
|
35
49
|
- ".rspec"
|
36
50
|
- ".rubocop.yml"
|
51
|
+
- Appraisals
|
37
52
|
- CHANGELOG.md
|
38
53
|
- Gemfile
|
39
54
|
- Gemfile.lock
|
@@ -42,6 +57,12 @@ files:
|
|
42
57
|
- README.md
|
43
58
|
- Rakefile
|
44
59
|
- deprecation_collector.gemspec
|
60
|
+
- gemfiles/rails_6.gemfile
|
61
|
+
- gemfiles/rails_6.gemfile.lock
|
62
|
+
- gemfiles/rails_7.gemfile
|
63
|
+
- gemfiles/rails_7.gemfile.lock
|
64
|
+
- gemfiles/rails_none.gemfile
|
65
|
+
- gemfiles/rails_none.gemfile.lock
|
45
66
|
- lib/deprecation_collector.rb
|
46
67
|
- lib/deprecation_collector/collectors.rb
|
47
68
|
- lib/deprecation_collector/deprecation.rb
|
@@ -62,14 +83,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
83
|
requirements:
|
63
84
|
- - ">="
|
64
85
|
- !ruby/object:Gem::Version
|
65
|
-
version: 2.
|
86
|
+
version: 2.5.0
|
66
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
88
|
requirements:
|
68
89
|
- - ">="
|
69
90
|
- !ruby/object:Gem::Version
|
70
91
|
version: '0'
|
71
92
|
requirements: []
|
72
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.4.1
|
73
94
|
signing_key:
|
74
95
|
specification_version: 4
|
75
96
|
summary: Collector for ruby/rails deprecations and warnings, suitable for production
|