deprecation_toolkit 2.0.0 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +16 -5
- data/.github/workflows/cla.yml +26 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +6 -6
- data/README.md +6 -9
- data/deprecation_toolkit.gemspec +1 -1
- data/lib/deprecation_toolkit/behaviors/raise.rb +2 -2
- data/lib/deprecation_toolkit/collector.rb +17 -5
- data/lib/deprecation_toolkit/read_write_helper.rb +1 -1
- data/lib/deprecation_toolkit/version.rb +1 -1
- data/lib/deprecation_toolkit.rb +25 -10
- data/lib/minitest/deprecation_toolkit_plugin.rb +1 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a215b859ad3948057d353332378a89f8ff22199296677f2ecab9f318d24a73b3
|
4
|
+
data.tar.gz: 99a5d3368ab2a066a4118ba0330a913223214ba686c5779138cc685610eea4ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6b2c17228b8091e8d2260fb6aa001153b859fcc029412133552b6fb074cb547735bbd27e1194c36128f390658c4e8b82e76018244388a91a56528f6fad05256
|
7
|
+
data.tar.gz: 4199799c0190b92530119d4ad093e359a6b076f35a1ceb039081bbdf6c0b26bd3731cd36fedb6f6025e3bc4bedd7fc38cd43c13e21652b7a3ac898a9a86c3d37
|
data/.github/workflows/ci.yml
CHANGED
@@ -3,13 +3,13 @@ name: CI
|
|
3
3
|
on: [push, pull_request]
|
4
4
|
|
5
5
|
jobs:
|
6
|
-
|
6
|
+
functionality:
|
7
7
|
runs-on: ubuntu-latest
|
8
8
|
name: Ruby ${{ matrix.ruby }} / ${{ matrix.gemfile }}
|
9
9
|
strategy:
|
10
10
|
matrix:
|
11
11
|
gemfile: [gemfiles/activesupport_5.2.gemfile, gemfiles/activesupport_6.0.gemfile, gemfiles/activesupport_6.1.gemfile, gemfiles/activesupport_7.0.gemfile, gemfiles/activesupport_edge.gemfile]
|
12
|
-
ruby: ["2.
|
12
|
+
ruby: ["2.7", "3.0", "3.1", "3.2"]
|
13
13
|
exclude:
|
14
14
|
# Active Support requires Ruby >= 2.7 as of 7.0
|
15
15
|
- gemfile: "gemfiles/activesupport_7.0.gemfile"
|
@@ -29,11 +29,22 @@ jobs:
|
|
29
29
|
ruby-version: ${{ matrix.ruby }}
|
30
30
|
bundler-cache: true
|
31
31
|
|
32
|
-
- name: RuboCop
|
33
|
-
run: bundle exec rubocop
|
34
|
-
|
35
32
|
- name: Tests
|
36
33
|
run: bundle exec rake test
|
37
34
|
|
38
35
|
- name: Specs
|
39
36
|
run: bundle exec rspec
|
37
|
+
style:
|
38
|
+
runs-on: ubuntu-latest
|
39
|
+
name: Rubocop
|
40
|
+
steps:
|
41
|
+
- name: Check out code
|
42
|
+
uses: actions/checkout@v3
|
43
|
+
|
44
|
+
- uses: ruby/setup-ruby@v1
|
45
|
+
with:
|
46
|
+
ruby-version: "3.2"
|
47
|
+
bundler-cache: true
|
48
|
+
|
49
|
+
- name: RuboCop
|
50
|
+
run: bundle exec rubocop
|
@@ -0,0 +1,26 @@
|
|
1
|
+
name: Contributor License Agreement (CLA)
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request_target:
|
5
|
+
types: [opened, synchronize]
|
6
|
+
issue_comment:
|
7
|
+
types: [created]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
pull-requests: write # to set the label
|
11
|
+
actions: write # to re-run the workflow when a comment is received
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
cla:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
if: |
|
17
|
+
(github.event.issue.pull_request
|
18
|
+
&& !github.event.issue.pull_request.merged_at
|
19
|
+
&& contains(github.event.comment.body, 'signed')
|
20
|
+
)
|
21
|
+
|| (github.event.pull_request && !github.event.pull_request.merged)
|
22
|
+
steps:
|
23
|
+
- uses: Shopify/shopify-cla-action@v1
|
24
|
+
with:
|
25
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
26
|
+
cla-token: ${{ secrets.CLA_TOKEN }}
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## main (unreleased)
|
4
4
|
|
5
|
+
## 2.0.3 (2023-02-10)
|
6
|
+
|
7
|
+
* [#80](https://github.com/Shopify/deprecation_toolkit/pull/80): Filter out stack trace from Gem::Deprecate deprecation messages
|
8
|
+
|
9
|
+
## 2.0.2 (2023-02-08)
|
10
|
+
|
11
|
+
* [#78](https://github.com/Shopify/deprecation_toolkit/pull/78): Show deprecations without stacktrace. (@shioyama)
|
12
|
+
|
13
|
+
## 2.0.1 (2022-11-18)
|
14
|
+
|
15
|
+
* [#74](https://github.com/Shopify/deprecation_toolkit/pull/74): Add support for `Rails.application.deprecators`. (@gmcgibbon)
|
16
|
+
|
5
17
|
## 2.0.0 (2022-03-16)
|
6
18
|
|
7
19
|
* [#58](https://github.com/Shopify/deprecation_toolkit/pull/58): Drop support for Ruby < 2.6 & Active Support < 5.2. (@sambostock)
|
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
deprecation_toolkit (2.0.
|
4
|
+
deprecation_toolkit (2.0.3)
|
5
5
|
activesupport (>= 5.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activesupport (7.0.2
|
10
|
+
activesupport (7.0.4.2)
|
11
11
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
12
|
i18n (>= 1.6, < 2)
|
13
13
|
minitest (>= 5.1)
|
14
14
|
tzinfo (~> 2.0)
|
15
15
|
ast (2.4.2)
|
16
|
-
concurrent-ruby (1.
|
16
|
+
concurrent-ruby (1.2.0)
|
17
17
|
diff-lcs (1.5.0)
|
18
|
-
i18n (1.
|
18
|
+
i18n (1.12.0)
|
19
19
|
concurrent-ruby (~> 1.0)
|
20
20
|
minitest (5.15.0)
|
21
21
|
parallel (1.21.0)
|
@@ -52,7 +52,7 @@ GEM
|
|
52
52
|
rubocop-shopify (2.5.0)
|
53
53
|
rubocop (~> 1.25)
|
54
54
|
ruby-progressbar (1.11.0)
|
55
|
-
tzinfo (2.0.
|
55
|
+
tzinfo (2.0.6)
|
56
56
|
concurrent-ruby (~> 1.0)
|
57
57
|
unicode-display_width (2.1.0)
|
58
58
|
|
@@ -68,4 +68,4 @@ DEPENDENCIES
|
|
68
68
|
rubocop-shopify
|
69
69
|
|
70
70
|
BUNDLED WITH
|
71
|
-
2.
|
71
|
+
2.4.4
|
data/README.md
CHANGED
@@ -6,10 +6,9 @@ Deprecation Toolkit is a gem that helps you get rid of deprecations in your code
|
|
6
6
|
Having deprecations in your application usually means that something will break whenever you upgrade third-party dependencies. The sooner the better to fix them!
|
7
7
|
Fixing all deprecations at once might be tough depending on the size of your app and the number of deprecations. You might have to progressively resolve them while making sure your team doesn't add new ones. This is where this gem comes handy!
|
8
8
|
|
9
|
-
|
10
9
|
## How it works
|
11
10
|
|
12
|
-
The Deprecation Toolkit gem works by using a [shitlist approach](https://
|
11
|
+
The Deprecation Toolkit gem works by using a [shitlist approach](https://www.youtube.com/watch?v=20pj_ajDBOg).
|
13
12
|
First, the gem records all existing deprecations into `.yml` files. When running a test that have non-recorded deprecations after the initial recording, Deprecation Toolkit triggers a behavior of your choice (by default it raises an error).
|
14
13
|
|
15
14
|
## Recording Deprecations
|
@@ -44,15 +43,13 @@ end
|
|
44
43
|
|
45
44
|
Behaviors define what happens when non-recorded deprecations are encountered.
|
46
45
|
|
47
|
-
|
48
|
-
|
49
|
-
This gem provides 3 behaviors, the default one being `DeprecationToolkit::Behaviors::Raise`.
|
46
|
+
This gem provides 4 behaviors, the default one being `DeprecationToolkit::Behaviors::Raise`.
|
50
47
|
|
51
48
|
* `DeprecationToolkit::Behaviors::Raise` will raise either:
|
52
|
-
- `DeprecationToolkit::DeprecationIntroduced` error if a new deprecation is introduced.
|
53
|
-
- `DeprecationToolkit::DeprecationRemoved` error if a deprecation was removed (compare to the one recorded in the shitlist).
|
49
|
+
- `DeprecationToolkit::Behaviors::DeprecationIntroduced` error if a new deprecation is introduced.
|
50
|
+
- `DeprecationToolkit::Behaviors::DeprecationRemoved` error if a deprecation was removed (compare to the one recorded in the shitlist).
|
54
51
|
* `DeprecationToolkit::Behaviors::Record` will record deprecations.
|
55
|
-
* `DeprecationToolkit::Behaviors::CIRecordHelper` See
|
52
|
+
* `DeprecationToolkit::Behaviors::CIRecordHelper` See separate explanation below.
|
56
53
|
* `DeprecationToolkit::Behaviors::Disabled` will do nothing.
|
57
54
|
- This is useful if you want to disable this gem for a moment without removing the gem from your Gemfile.
|
58
55
|
|
@@ -72,7 +69,7 @@ end
|
|
72
69
|
DeprecationToolkit::Configuration.behavior = StatsdBehavior
|
73
70
|
```
|
74
71
|
|
75
|
-
|
72
|
+
#### DeprecationToolkit::Behaviors::CIRecordHelper
|
76
73
|
|
77
74
|
This is a special type of behaviour meant to help you record deprecations if you have a lof of them.
|
78
75
|
Imagine if you have thousands of tests and need to record deprecations for each on your machine, this is going to take ages.
|
data/deprecation_toolkit.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
22
22
|
|
23
|
-
spec.required_ruby_version = ">= 2.
|
23
|
+
spec.required_ruby_version = ">= 2.7"
|
24
24
|
|
25
25
|
spec.files = %x(git ls-files -z).split("\x0").reject do |f|
|
26
26
|
f.match(%r{^(test)/})
|
@@ -77,9 +77,9 @@ module DeprecationToolkit
|
|
77
77
|
#{record_message}
|
78
78
|
|
79
79
|
===== Expected
|
80
|
-
#{recorded_deprecations.
|
80
|
+
#{recorded_deprecations.deprecations_without_stacktrace.join("\n")}
|
81
81
|
===== Actual
|
82
|
-
#{current_deprecations.
|
82
|
+
#{current_deprecations.deprecations_without_stacktrace.join("\n")}
|
83
83
|
EOM
|
84
84
|
|
85
85
|
super(message)
|
@@ -35,11 +35,9 @@ module DeprecationToolkit
|
|
35
35
|
|
36
36
|
def deprecations_without_stacktrace
|
37
37
|
deprecations.map do |deprecation|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
deprecation.sub(/ \(called from .*\)$/, "")
|
42
|
-
end
|
38
|
+
deprecation
|
39
|
+
.sub(*active_support_deprecation_sub_params)
|
40
|
+
.sub(*gem_deprecate_sub_params)
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
@@ -63,5 +61,19 @@ module DeprecationToolkit
|
|
63
61
|
def flaky?
|
64
62
|
size == 1 && deprecations.first["flaky"] == true
|
65
63
|
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
def active_support_deprecation_sub_params
|
68
|
+
if ActiveSupport.gem_version.to_s < "5.0"
|
69
|
+
[/\W\s\(called from .*\)$/, ""]
|
70
|
+
else
|
71
|
+
[/ \(called from .*\)$/, ""]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def gem_deprecate_sub_params
|
76
|
+
[/NOTE: (.*is deprecated.*)\n.* called from.*:\d+\.\n/, "\\1"]
|
77
|
+
end
|
66
78
|
end
|
67
79
|
end
|
data/lib/deprecation_toolkit.rb
CHANGED
@@ -18,20 +18,35 @@ module DeprecationToolkit
|
|
18
18
|
autoload :CIRecordHelper, "deprecation_toolkit/behaviors/ci_record_helper"
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
class << self
|
22
|
+
def add_notify_behavior
|
23
|
+
notify = ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:notify]
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
each_deprecator do |deprecator|
|
26
|
+
behaviors = deprecator.behavior
|
27
|
+
|
28
|
+
unless behaviors.find { |behavior| behavior == notify }
|
29
|
+
deprecator.behavior = (behaviors << notify)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def attach_subscriber
|
35
|
+
return if DeprecationSubscriber.already_attached?
|
36
|
+
|
37
|
+
Configuration.attach_to.each do |gem_name|
|
38
|
+
DeprecationSubscriber.attach_to(gem_name)
|
39
|
+
end
|
27
40
|
end
|
28
|
-
end
|
29
41
|
|
30
|
-
|
31
|
-
return if DeprecationSubscriber.already_attached?
|
42
|
+
private
|
32
43
|
|
33
|
-
|
34
|
-
|
44
|
+
def each_deprecator(&block)
|
45
|
+
if defined?(Rails.application) && Rails.application.respond_to?(:deprecators)
|
46
|
+
Rails.application.deprecators.each(&block)
|
47
|
+
else
|
48
|
+
block.call(ActiveSupport::Deprecation)
|
49
|
+
end
|
35
50
|
end
|
36
51
|
end
|
37
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deprecation_toolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -32,6 +32,7 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- ".github/workflows/ci.yml"
|
35
|
+
- ".github/workflows/cla.yml"
|
35
36
|
- ".gitignore"
|
36
37
|
- ".rspec"
|
37
38
|
- ".rubocop.yml"
|
@@ -91,14 +92,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
92
|
requirements:
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
|
-
version: '2.
|
95
|
+
version: '2.7'
|
95
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
97
|
requirements:
|
97
98
|
- - ">="
|
98
99
|
- !ruby/object:Gem::Version
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
+
rubygems_version: 3.3.3
|
102
103
|
signing_key:
|
103
104
|
specification_version: 4
|
104
105
|
summary: Deprecation Toolkit around ActiveSupport::Deprecation
|