as_deprecation_tracker 1.5.0 → 1.6.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 +5 -5
- data/.github/workflows/ci.yml +37 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +1 -1
- data/README.md +10 -1
- data/Rakefile +2 -1
- data/config.ru +1 -0
- data/lib/as_deprecation_tracker/configuration.rb +2 -1
- data/lib/as_deprecation_tracker/railtie.rb +1 -0
- data/lib/as_deprecation_tracker/receiver.rb +1 -0
- data/lib/as_deprecation_tracker/version.rb +2 -1
- data/lib/as_deprecation_tracker/whitelist.rb +2 -1
- data/lib/as_deprecation_tracker/whitelist_entry.rb +6 -4
- data/lib/as_deprecation_tracker/writer.rb +1 -0
- data/lib/as_deprecation_tracker.rb +2 -1
- data/test/as_deprecation_tracker_test.rb +1 -0
- data/test/configuration_test.rb +1 -0
- data/test/internal/config/routes.rb +2 -3
- data/test/railtie_test.rb +1 -0
- data/test/receiver_test.rb +1 -0
- data/test/test_helper.rb +3 -2
- data/test/whitelist_entry_test.rb +3 -2
- data/test/whitelist_test.rb +1 -0
- data/test/writer_test.rb +1 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: afbd5cdcd05ef8e999ba0e809a3f9dd9f47f2379c2d2d1f753a5b308652e6ebb
|
4
|
+
data.tar.gz: cd5f7e4d5934d6f7e8aa67bfbc3487ecc3f21a5498a11ffed3f8bb77223a24dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ea16660167a5744c86895f2722cc85af01acda3b93f3ec8eef5bd4b470c6f4168037d8105b798b64c809b08353282d872f9707925c5b8ec76d48c59cedb5dab
|
7
|
+
data.tar.gz: b22dabfa1a44820bd2c30a98b5c6ee9c1c674bd88e4f1c96f4dcc5c7f384b370a29d0a79a0ed016f2ace836fdcdf69933a0951192a16a66910e6040ed9206b6d
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
name: CI
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
push:
|
7
|
+
|
8
|
+
|
9
|
+
concurrency:
|
10
|
+
group: ${{ github.ref_name }}
|
11
|
+
cancel-in-progress: true
|
12
|
+
|
13
|
+
jobs:
|
14
|
+
ruby:
|
15
|
+
runs-on: ubuntu-latest
|
16
|
+
strategy:
|
17
|
+
fail-fast: false
|
18
|
+
matrix:
|
19
|
+
ruby_version:
|
20
|
+
- '2.7.6'
|
21
|
+
- '3.0.4'
|
22
|
+
- '3.1.2'
|
23
|
+
rails_version:
|
24
|
+
- '6.0.5.1'
|
25
|
+
- '6.1.6.1'
|
26
|
+
- '7.0.3.1'
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- name: Setup Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby_version }}
|
33
|
+
bundler-cache: true
|
34
|
+
env:
|
35
|
+
RAILS_VERSION: ${{ matrix.rails_version }}
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rake
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## 1.6.0
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Fix array splat errors under Ruby 3 (PR thanks to @evgeni)
|
12
|
+
|
8
13
|
## 1.5.0
|
9
14
|
|
10
15
|
### Added
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -143,6 +143,15 @@ initialisation, as deprecation processing can be disabled until the whitelist
|
|
143
143
|
is fully formed. ASDT will queue events while paused and processes them when
|
144
144
|
`resume!` is called.
|
145
145
|
|
146
|
+
## Alternatives
|
147
|
+
|
148
|
+
Shopify have open-sourced a gem that works very similarly to ASDT and is worth
|
149
|
+
a look. It supports more configuration options when seeing a new or removed
|
150
|
+
deprecation warning, and also supports `Kernel#warn`.
|
151
|
+
|
152
|
+
* [Shopify: Introducing the deprecation toolkit](https://engineering.shopify.com/blogs/engineering/introducing-the-deprecation-toolkit)
|
153
|
+
* [deprecation_toolkit (GitHub)](https://github.com/shopify/deprecation_toolkit)
|
154
|
+
|
146
155
|
## License
|
147
156
|
|
148
|
-
Copyright (c) 2016-
|
157
|
+
Copyright (c) 2016-2022 Dominic Cleal. Distributed under the MIT license.
|
data/Rakefile
CHANGED
data/config.ru
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module ASDeprecationTracker
|
3
4
|
# Maintains configuration for one instance (usually global)
|
4
5
|
class Configuration
|
@@ -6,7 +7,7 @@ module ASDeprecationTracker
|
|
6
7
|
alias register_behavior? register_behavior
|
7
8
|
|
8
9
|
def initialize
|
9
|
-
@envs = %w
|
10
|
+
@envs = %w[test]
|
10
11
|
@line_tolerance = 10
|
11
12
|
@register_behavior = ASDeprecationTracker.env('DISABLE').nil?
|
12
13
|
@whitelist_file = File.join('config', 'as_deprecation_whitelist.yaml')
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'as_deprecation_tracker/whitelist_entry'
|
3
4
|
|
4
5
|
module ASDeprecationTracker
|
@@ -12,7 +13,7 @@ module ASDeprecationTracker
|
|
12
13
|
end
|
13
14
|
|
14
15
|
def add_to_list(*entries)
|
15
|
-
entries.flatten.each { |entry| @list << WhitelistEntry.new(entry.symbolize_keys) }
|
16
|
+
entries.flatten.each { |entry| @list << WhitelistEntry.new(**entry.symbolize_keys) }
|
16
17
|
end
|
17
18
|
alias add add_to_list
|
18
19
|
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module ASDeprecationTracker
|
3
4
|
# Configuration of a whitelisted (known) deprecation warning matched by data
|
4
5
|
# such as a message and/or callstack
|
5
6
|
class WhitelistEntry
|
6
|
-
KNOWN_KEYS = %w
|
7
|
+
KNOWN_KEYS = %w[callstack engine message].freeze
|
7
8
|
MESSAGE_CLEANUP_RE = Regexp.new('\ADEPRECATION WARNING: (.+) \(called from.*')
|
8
9
|
CALLSTACK_FILE_RE = Regexp.new('\A(.*?)(?::(\d+))?(?::in `(.+)\')?\z')
|
9
10
|
|
@@ -13,14 +14,13 @@ module ASDeprecationTracker
|
|
13
14
|
@message = message
|
14
15
|
end
|
15
16
|
|
16
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
17
17
|
def matches?(deprecation)
|
18
18
|
return false if @message.present? && !message_matches?(deprecation[:message])
|
19
19
|
return false if @callstack.present? && !callstack_matches?(deprecation[:callstack])
|
20
20
|
return false if @engine_root.present? && !engine_root_matches?(deprecation[:callstack])
|
21
|
+
|
21
22
|
true
|
22
23
|
end
|
23
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
24
24
|
|
25
25
|
private
|
26
26
|
|
@@ -60,11 +60,13 @@ module ASDeprecationTracker
|
|
60
60
|
|
61
61
|
def line_number_within_tolerance(line1, line2)
|
62
62
|
return true if line1.nil? || line2.nil?
|
63
|
+
|
63
64
|
(line1 - line2).abs <= ASDeprecationTracker.config.line_tolerance
|
64
65
|
end
|
65
66
|
|
66
67
|
def method_name_matches(method1, method2)
|
67
68
|
return true if method1.nil? || method2.nil?
|
69
|
+
|
68
70
|
method1 == method2
|
69
71
|
end
|
70
72
|
|
@@ -76,7 +78,7 @@ module ASDeprecationTracker
|
|
76
78
|
::Rails::Engine.descendants.each do |engine|
|
77
79
|
begin
|
78
80
|
return engine.root.to_s if engine_name.to_s == engine.engine_name.to_s
|
79
|
-
rescue NoMethodError, RuntimeError
|
81
|
+
rescue NoMethodError, RuntimeError
|
80
82
|
# Ignore failures with singleton engine subclasses etc.
|
81
83
|
end
|
82
84
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
# Entry point, provides constant with access to global configuration only
|
3
4
|
module ASDeprecationTracker
|
4
5
|
require 'as_deprecation_tracker/configuration'
|
@@ -36,6 +37,6 @@ module ASDeprecationTracker
|
|
36
37
|
end
|
37
38
|
|
38
39
|
def self.env(name)
|
39
|
-
ENV.fetch("AS_DEPRECATION_#{name}", ENV
|
40
|
+
ENV.fetch("AS_DEPRECATION_#{name}", ENV.fetch("ASDT_#{name}", nil))
|
40
41
|
end
|
41
42
|
end
|
data/test/configuration_test.rb
CHANGED
data/test/railtie_test.rb
CHANGED
data/test/receiver_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'minitest/autorun'
|
3
|
-
require 'mocha/
|
4
|
+
require 'mocha/minitest'
|
4
5
|
require 'combustion'
|
5
6
|
|
6
7
|
require 'as_deprecation_tracker'
|
@@ -17,7 +18,7 @@ module ASDeprecationTracker
|
|
17
18
|
ENV.update(new_env)
|
18
19
|
yield
|
19
20
|
ensure
|
20
|
-
new_env.
|
21
|
+
new_env.each_key { |k| ENV.delete(k) }
|
21
22
|
ENV.update(backup)
|
22
23
|
end
|
23
24
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'test_helper'
|
3
4
|
|
4
5
|
class WhitelistEntryTest < ASDeprecationTracker::TestCase
|
@@ -133,9 +134,9 @@ class WhitelistEntryTest < ASDeprecationTracker::TestCase
|
|
133
134
|
|
134
135
|
def entry(overrides = {})
|
135
136
|
entry_hash = default_deprecation.merge(overrides).compact
|
136
|
-
entry_hash[:callstack].map! { |line| line.sub(Rails.root
|
137
|
+
entry_hash[:callstack].map! { |line| line.sub("#{Rails.root}/", '') } if entry_hash[:callstack].is_a?(Array)
|
137
138
|
|
138
139
|
ASDeprecationTracker::WhitelistEntry.any_instance.expects(:engine_root).with(overrides[:engine]).returns("/home/user/engines/#{overrides[:engine]}") if overrides.key?(:engine)
|
139
|
-
ASDeprecationTracker::WhitelistEntry.new(entry_hash)
|
140
|
+
ASDeprecationTracker::WhitelistEntry.new(**entry_hash)
|
140
141
|
end
|
141
142
|
end
|
data/test/whitelist_test.rb
CHANGED
data/test/writer_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: as_deprecation_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dominic Cleal
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -45,6 +45,7 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- ".github/workflows/ci.yml"
|
48
49
|
- CHANGELOG.md
|
49
50
|
- LICENSE
|
50
51
|
- README.md
|
@@ -73,8 +74,9 @@ files:
|
|
73
74
|
homepage: https://github.com/domcleal/as_deprecation_tracker
|
74
75
|
licenses:
|
75
76
|
- MIT
|
76
|
-
metadata:
|
77
|
-
|
77
|
+
metadata:
|
78
|
+
rubygems_mfa_required: 'true'
|
79
|
+
post_install_message:
|
78
80
|
rdoc_options: []
|
79
81
|
require_paths:
|
80
82
|
- lib
|
@@ -89,9 +91,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
89
91
|
- !ruby/object:Gem::Version
|
90
92
|
version: '0'
|
91
93
|
requirements: []
|
92
|
-
|
93
|
-
|
94
|
-
signing_key:
|
94
|
+
rubygems_version: 3.3.7
|
95
|
+
signing_key:
|
95
96
|
specification_version: 4
|
96
97
|
summary: Track known ActiveSupport deprecation warnings
|
97
98
|
test_files: []
|