leftovers 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/config/actionmailbox.yml +4 -1
- data/lib/config/actionmailer.yml +4 -1
- data/lib/config/actionpack.yml +12 -4
- data/lib/config/activejob.yml +2 -3
- data/lib/config/activemodel.yml +37 -26
- data/lib/config/activerecord.yml +19 -4
- data/lib/config/activesupport.yml +13 -3
- data/lib/leftovers/reporter.rb +2 -2
- data/lib/leftovers/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16d46e25de2c0e4f243f396b910e3eb61e6342dd626fcceb9f30bd3734196d7b
|
4
|
+
data.tar.gz: e8c6c55c70e25167126fa2fa5ac3037f41a37b9ae8415f10b86cfea183436be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 609975369757068764cc179848f973aa6579dcf422a36ad54a7e7697cb257b1ec1043c3da8b106741869d1a0f113e4aa95bf824c7dca1c9766b05db90cddb7a8
|
7
|
+
data.tar.gz: c74f1643e44ad2f87490f8f2745c35286f746881bcac839c43bc0400863c0733a5246c5cf4d4b5be88d1501512aa6fb35debc637404262ee0902766e28a87b86
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# v0.11.0
|
2
|
+
- Fixed an issue with active_record's `before_save` with multiple callbacks #18, #17 - thanks @palexvs for raising the issue and creating a pr
|
3
|
+
- Due to this pr, i reviewed everything else that i think calls `ActiveSupport::Callbacks.set_callback`, and ensured they all:
|
4
|
+
- can have multiple args if relevant
|
5
|
+
- accept single values and array values for the if/unless args
|
6
|
+
- don't eval strings, that's not been a rails feature for a while
|
7
|
+
- Fix active_model & active_record validation methods to more comprehensively handle all the keys that could be given symbols of method names, instead of only the documented ones
|
8
|
+
|
1
9
|
# v0.10.0
|
2
10
|
- Fixed an issue with t.belongs_to (within the migration generated by rails active_storage:install - thanks @veganstraightedge)
|
3
11
|
- this was two issues:
|
@@ -15,7 +15,10 @@ keep:
|
|
15
15
|
dynamic:
|
16
16
|
# https://api.rubyonrails.org/v7.0.2.2/classes/ActionMailbox/Base.html
|
17
17
|
- names: [before_processing, after_processing, around_processing]
|
18
|
-
calls:
|
18
|
+
calls:
|
19
|
+
- arguments: '*'
|
20
|
+
- arguments: [if, unless]
|
21
|
+
nested: '*'
|
19
22
|
|
20
23
|
# https://guides.rubyonrails.org/action_mailbox_basics.html#examples
|
21
24
|
# i'm guessing a lot about how this is supposed to work
|
data/lib/config/actionmailer.yml
CHANGED
@@ -26,7 +26,10 @@ dynamic:
|
|
26
26
|
- before_action
|
27
27
|
- after_action
|
28
28
|
- around_action
|
29
|
-
calls:
|
29
|
+
calls:
|
30
|
+
- arguments: '*'
|
31
|
+
- arguments: [if, unless]
|
32
|
+
nested: '*'
|
30
33
|
|
31
34
|
# https://guides.rubyonrails.org/action_mailer_basics.html#intercepting-emails
|
32
35
|
- names: interceptors=
|
data/lib/config/actionpack.yml
CHANGED
@@ -37,21 +37,29 @@ dynamic:
|
|
37
37
|
- prepend_around_action
|
38
38
|
- prepend_before_action
|
39
39
|
calls:
|
40
|
-
- arguments:
|
40
|
+
- arguments: '*'
|
41
|
+
- arguments: [if, unless]
|
42
|
+
nested: '*'
|
41
43
|
|
42
44
|
- names:
|
43
45
|
- skip_after_action
|
44
46
|
- skip_around_action
|
45
47
|
- skip_before_action
|
46
|
-
calls:
|
48
|
+
calls:
|
49
|
+
arguments: [if, unless]
|
50
|
+
nested: '*'
|
47
51
|
|
48
52
|
- names: protect_from_forgery
|
49
|
-
calls:
|
53
|
+
calls:
|
54
|
+
arguments: [if, unless]
|
55
|
+
nested: '*'
|
50
56
|
|
51
57
|
|
52
58
|
# https://edgeapi.rubyonrails.org/classes/ActionController/Logging/ClassMethods.html#method-i-log_at
|
53
59
|
- names: log_at
|
54
|
-
calls:
|
60
|
+
calls:
|
61
|
+
arguments: [if, unless]
|
62
|
+
nested: '*'
|
55
63
|
|
56
64
|
|
57
65
|
- name: helper
|
data/lib/config/activejob.yml
CHANGED
@@ -23,10 +23,9 @@ dynamic:
|
|
23
23
|
- around_perform
|
24
24
|
- after_perform
|
25
25
|
calls:
|
26
|
-
- arguments:
|
26
|
+
- arguments: '*'
|
27
27
|
- arguments: [if, unless]
|
28
|
-
nested:
|
29
|
-
arguments: '*'
|
28
|
+
nested: '*'
|
30
29
|
|
31
30
|
# https://api.rubyonrails.org/v7.0.2.2/classes/ActiveJob/Exceptions/ClassMethods.html#method-i-discard_on
|
32
31
|
# https://api.rubyonrails.org/v7.0.2.2/classes/ActiveJob/Exceptions/ClassMethods.html#method-i-retry_on
|
data/lib/config/activemodel.yml
CHANGED
@@ -82,25 +82,26 @@ dynamic:
|
|
82
82
|
- before_validation
|
83
83
|
- after_validation
|
84
84
|
calls:
|
85
|
-
- arguments:
|
85
|
+
- arguments: '*'
|
86
86
|
- arguments: [if, unless]
|
87
|
-
nested:
|
88
|
-
arguments: '*'
|
87
|
+
nested: '*'
|
89
88
|
- name:
|
90
89
|
- validates_associated
|
91
90
|
calls:
|
92
|
-
- arguments:
|
91
|
+
- arguments: '*'
|
92
|
+
- arguments: [if, unless]
|
93
|
+
nested: '*'
|
94
|
+
|
93
95
|
# https://api.rubyonrails.org/classes/ActiveModel/Validations/ClassMethods.html#method-i-validates
|
94
96
|
- name: [validates, validates!]
|
95
97
|
calls:
|
96
98
|
- arguments:
|
97
99
|
- '*'
|
100
|
+
- 'in'
|
98
101
|
- within
|
99
|
-
- inclusion
|
100
|
-
- exclusion
|
101
102
|
- scope
|
102
|
-
-
|
103
|
-
-
|
103
|
+
- with
|
104
|
+
- without
|
104
105
|
- arguments: [if, unless]
|
105
106
|
nested: '*'
|
106
107
|
- arguments: [inclusion, exclusion]
|
@@ -108,6 +109,17 @@ dynamic:
|
|
108
109
|
arguments:
|
109
110
|
- 'in'
|
110
111
|
- within
|
112
|
+
- arguments: format
|
113
|
+
nested:
|
114
|
+
arguments:
|
115
|
+
- with
|
116
|
+
- without
|
117
|
+
- arguments: length
|
118
|
+
nested:
|
119
|
+
arguments:
|
120
|
+
- is
|
121
|
+
- minimum
|
122
|
+
- maximum
|
111
123
|
- arguments: [comparison, numericality]
|
112
124
|
nested:
|
113
125
|
arguments:
|
@@ -118,14 +130,10 @@ dynamic:
|
|
118
130
|
- less_than_or_equal_to
|
119
131
|
- other_than
|
120
132
|
- keywords:
|
121
|
-
unless: [if, unless]
|
133
|
+
unless: [if, unless, 'on', allow_blank, allow_nil, strict]
|
122
134
|
camelize: true
|
123
135
|
add_suffix: Validator
|
124
136
|
split: '::'
|
125
|
-
eval:
|
126
|
-
- arguments: [if, unless]
|
127
|
-
- arguments: [if, unless]
|
128
|
-
nested: '*'
|
129
137
|
|
130
138
|
- name: validates_confirmation_of
|
131
139
|
calls:
|
@@ -139,10 +147,9 @@ dynamic:
|
|
139
147
|
argument: '*'
|
140
148
|
add_suffix: _confirmation
|
141
149
|
|
142
|
-
- name: validates_comparison_of
|
150
|
+
- name: [validates_comparison_of, validates_numericality_of]
|
143
151
|
calls:
|
144
152
|
argument:
|
145
|
-
- '*'
|
146
153
|
- greater_than
|
147
154
|
- greater_than_or_equal_to
|
148
155
|
- equal_to
|
@@ -150,13 +157,24 @@ dynamic:
|
|
150
157
|
- less_than_or_equal_to
|
151
158
|
- other_than
|
152
159
|
|
160
|
+
# why!?
|
161
|
+
- name: validates_numericality_of
|
162
|
+
calls:
|
163
|
+
argument:
|
164
|
+
- only_integer
|
165
|
+
|
153
166
|
- name: [validates_exclusion_of, validates_inclusion_of]
|
154
167
|
calls:
|
155
168
|
argument:
|
156
|
-
- '*'
|
157
169
|
- 'in'
|
158
170
|
- within
|
159
171
|
|
172
|
+
- name: validates_length_of
|
173
|
+
calls: [is, minimum, maximum]
|
174
|
+
|
175
|
+
- name: validates_format_of
|
176
|
+
calls: [with, without]
|
177
|
+
|
160
178
|
- name:
|
161
179
|
- validates_absence_of
|
162
180
|
- validates_acceptance_of
|
@@ -170,9 +188,7 @@ dynamic:
|
|
170
188
|
- validates_presence_of
|
171
189
|
- validates_size_of
|
172
190
|
calls:
|
173
|
-
- arguments:
|
174
|
-
eval:
|
175
|
-
- arguments: [if, unless]
|
191
|
+
- arguments: '*'
|
176
192
|
- arguments: [if, unless]
|
177
193
|
nested: '*'
|
178
194
|
|
@@ -183,9 +199,7 @@ dynamic:
|
|
183
199
|
- validate_associated
|
184
200
|
- validates_each
|
185
201
|
calls:
|
186
|
-
- arguments:
|
187
|
-
eval:
|
188
|
-
- arguments: [if, unless]
|
202
|
+
- arguments: '*'
|
189
203
|
- arguments: [if, unless]
|
190
204
|
nested: '*'
|
191
205
|
|
@@ -193,10 +207,7 @@ dynamic:
|
|
193
207
|
- name: validates_with
|
194
208
|
calls:
|
195
209
|
arguments: [if, unless]
|
196
|
-
|
197
|
-
- arguments: [if, unless]
|
198
|
-
- arguments: [if, unless]
|
199
|
-
nested: '*'
|
210
|
+
nested: '*'
|
200
211
|
|
201
212
|
# https://api.rubyonrails.org/classes/ActiveModel/AttributeMethods/ClassMethods.html#method-i-alias_attribute
|
202
213
|
# https://api.rubyonrails.org/classes/ActiveModel/Dirty.html
|
data/lib/config/activerecord.yml
CHANGED
@@ -22,7 +22,23 @@ dynamic:
|
|
22
22
|
- validates_numericality_of
|
23
23
|
- validates_presence_of
|
24
24
|
- validates_uniqueness_of
|
25
|
-
calls:
|
25
|
+
calls:
|
26
|
+
- arguments: '*'
|
27
|
+
- arguments: [if, unless]
|
28
|
+
nested: '*'
|
29
|
+
|
30
|
+
- name: validates_uniqueness_of
|
31
|
+
calls:
|
32
|
+
arguments: scope
|
33
|
+
nested: '*'
|
34
|
+
|
35
|
+
- name: [validates, validates!]
|
36
|
+
calls:
|
37
|
+
- arguments: scope
|
38
|
+
- arguments: uniqueness
|
39
|
+
nested:
|
40
|
+
arguments: scope
|
41
|
+
nested: '*'
|
26
42
|
|
27
43
|
# https://edgeapi.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMethods.html
|
28
44
|
# i had to read the code for this
|
@@ -367,10 +383,9 @@ dynamic:
|
|
367
383
|
- before_save
|
368
384
|
- before_update
|
369
385
|
calls:
|
370
|
-
- arguments:
|
386
|
+
- arguments: '*'
|
371
387
|
- arguments: [if, unless]
|
372
|
-
nested:
|
373
|
-
arguments: '*'
|
388
|
+
nested: '*'
|
374
389
|
|
375
390
|
- name:
|
376
391
|
- includes
|
@@ -146,8 +146,12 @@ dynamic:
|
|
146
146
|
|
147
147
|
# https://api.rubyonrails.org/classes/ActiveSupport/Callbacks/ClassMethods.html#method-i-set_callback
|
148
148
|
- name: set_callback
|
149
|
-
calls:
|
149
|
+
calls:
|
150
|
+
- arguments: '2+'
|
151
|
+
- arguments: [if, unless]
|
152
|
+
nested: '*'
|
150
153
|
|
154
|
+
# The second argument indicates whether the callback is to be run :before, :after, or :around the event. If omitted, :before is assumed.
|
151
155
|
- name: set_callback
|
152
156
|
calls: 1
|
153
157
|
unless:
|
@@ -156,7 +160,9 @@ dynamic:
|
|
156
160
|
|
157
161
|
# https://api.rubyonrails.org/classes/ActiveSupport/Callbacks/ClassMethods.html#method-i-skip_callback
|
158
162
|
- name: skip_callback
|
159
|
-
calls:
|
163
|
+
calls:
|
164
|
+
arguments: [if, unless]
|
165
|
+
nested: '*'
|
160
166
|
|
161
167
|
# https://api.rubyonrails.org/classes/ActiveSupport/Configurable/ClassMethods.html#method-i-config_accessor
|
162
168
|
- name: config_accessor
|
@@ -203,7 +209,11 @@ dynamic:
|
|
203
209
|
# https://api.rubyonrails.org/classes/ActiveSupport/Reloader.html#method-c-to_prepare
|
204
210
|
# this is not well documented but uses set_callback internally so we can just guess
|
205
211
|
- name: [before_class_unload, after_class_unload, to_prepare]
|
206
|
-
calls:
|
212
|
+
calls:
|
213
|
+
- arguments: '*'
|
214
|
+
- arguments: [if, unless]
|
215
|
+
nested:
|
216
|
+
arguments: '*'
|
207
217
|
|
208
218
|
# https://api.rubyonrails.org/classes/Module/Concerning.html#method-i-concern
|
209
219
|
- name: concern
|
data/lib/leftovers/reporter.rb
CHANGED
@@ -35,8 +35,8 @@ module Leftovers
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def print_definition(definition)
|
38
|
-
puts "#{aqua definition.location_s} "\
|
39
|
-
"#{definition} "\
|
38
|
+
puts "#{aqua definition.location_s} " \
|
39
|
+
"#{definition} " \
|
40
40
|
"#{grey definition.highlighted_source("\e[33m", "\e[0;2m")}"
|
41
41
|
end
|
42
42
|
|
data/lib/leftovers/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leftovers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -588,8 +588,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
588
588
|
- !ruby/object:Gem::Version
|
589
589
|
version: '0'
|
590
590
|
requirements: []
|
591
|
-
|
592
|
-
rubygems_version: 2.7.6
|
591
|
+
rubygems_version: 3.2.15
|
593
592
|
signing_key:
|
594
593
|
specification_version: 4
|
595
594
|
summary: Find unused methods and classes/modules
|