leftovers 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +7 -7
  4. data/docs/Configuration.md +141 -32
  5. data/docs/Custom-Precompilers.md +6 -0
  6. data/leftovers.gemspec +2 -1
  7. data/lib/config/actioncable.yml +36 -0
  8. data/lib/config/actionmailbox.yml +28 -0
  9. data/lib/config/actionmailer.yml +87 -11
  10. data/lib/config/actionpack.yml +130 -34
  11. data/lib/config/actiontext.yml +56 -0
  12. data/lib/config/actionview.yml +194 -44
  13. data/lib/config/activejob.yml +15 -8
  14. data/lib/config/activemodel.yml +175 -18
  15. data/lib/config/activerecord.yml +397 -86
  16. data/lib/config/activestorage.yml +26 -0
  17. data/lib/config/activesupport.yml +167 -24
  18. data/lib/config/leftovers.yml +48 -0
  19. data/lib/config/rails.yml +7 -3
  20. data/lib/config/railties.yml +7 -0
  21. data/lib/config/ruby.yml +438 -83
  22. data/lib/config/test-unit.yml +8 -0
  23. data/lib/leftovers/ast/array_node.rb +12 -0
  24. data/lib/leftovers/ast/block_node.rb +12 -0
  25. data/lib/leftovers/ast/builder.rb +24 -5
  26. data/lib/leftovers/ast/casgn_node.rb +20 -0
  27. data/lib/leftovers/ast/const_node.rb +15 -0
  28. data/lib/leftovers/ast/def_node.rb +15 -0
  29. data/lib/leftovers/ast/defs_node.rb +15 -0
  30. data/lib/leftovers/ast/false_node.rb +24 -0
  31. data/lib/leftovers/ast/has_arguments.rb +31 -0
  32. data/lib/leftovers/ast/hash_node.rb +17 -0
  33. data/lib/leftovers/ast/module_node.rb +16 -0
  34. data/lib/leftovers/ast/nil_node.rb +23 -0
  35. data/lib/leftovers/ast/node.rb +33 -90
  36. data/lib/leftovers/ast/numeric_node.rb +22 -0
  37. data/lib/leftovers/ast/send_node.rb +25 -0
  38. data/lib/leftovers/ast/str_node.rb +24 -0
  39. data/lib/leftovers/ast/sym_node.rb +25 -0
  40. data/lib/leftovers/ast/true_node.rb +24 -0
  41. data/lib/leftovers/ast/var_node.rb +14 -0
  42. data/lib/leftovers/ast/vasgn_node.rb +20 -0
  43. data/lib/leftovers/ast.rb +18 -0
  44. data/lib/leftovers/cli.rb +7 -1
  45. data/lib/leftovers/comparable_instance.rb +18 -0
  46. data/lib/leftovers/config_loader/argument_position_schema.rb +3 -1
  47. data/lib/leftovers/config_loader/array_schema.rb +53 -0
  48. data/lib/leftovers/config_loader/document_schema.rb +3 -2
  49. data/lib/leftovers/config_loader/dynamic_schema.rb +1 -0
  50. data/lib/leftovers/config_loader/has_value_schema.rb +4 -0
  51. data/lib/leftovers/config_loader/keyword_argument_schema.rb +13 -0
  52. data/lib/leftovers/config_loader/regexp_schema.rb +27 -0
  53. data/lib/leftovers/config_loader/rule_pattern_schema.rb +2 -0
  54. data/lib/leftovers/config_loader/scalar_value_schema.rb +8 -0
  55. data/lib/leftovers/config_loader/schema.rb +10 -0
  56. data/lib/leftovers/config_loader/string_enum_schema.rb +1 -1
  57. data/lib/leftovers/config_loader/string_pattern_schema.rb +1 -1
  58. data/lib/leftovers/config_loader/transform_schema.rb +12 -6
  59. data/lib/leftovers/config_loader/value_matcher_condition_schema.rb +13 -0
  60. data/lib/leftovers/config_loader/value_matcher_schema.rb +4 -1
  61. data/lib/leftovers/config_loader/value_or_array_schema.rb +2 -34
  62. data/lib/leftovers/config_loader/value_processor_schema.rb +2 -2
  63. data/lib/leftovers/config_loader.rb +11 -4
  64. data/lib/leftovers/definition_collection.rb +37 -0
  65. data/lib/leftovers/definition_node_set.rb +10 -2
  66. data/lib/leftovers/file.rb +1 -1
  67. data/lib/leftovers/file_collector/comments_processor.rb +1 -1
  68. data/lib/leftovers/file_collector/node_processor.rb +7 -7
  69. data/lib/leftovers/file_collector.rb +26 -32
  70. data/lib/leftovers/file_list.rb +3 -2
  71. data/lib/leftovers/matcher_builders/and.rb +26 -9
  72. data/lib/leftovers/matcher_builders/node.rb +32 -20
  73. data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +3 -1
  74. data/lib/leftovers/matcher_builders/node_pair_key.rb +16 -0
  75. data/lib/leftovers/matcher_builders/node_type.rb +9 -9
  76. data/lib/leftovers/matcher_builders/node_value.rb +23 -9
  77. data/lib/leftovers/matcher_builders/or.rb +22 -7
  78. data/lib/leftovers/matcher_builders/path.rb +3 -1
  79. data/lib/leftovers/matcher_builders.rb +1 -1
  80. data/lib/leftovers/matchers/all.rb +4 -0
  81. data/lib/leftovers/matchers/and.rb +4 -0
  82. data/lib/leftovers/matchers/any.rb +2 -0
  83. data/lib/leftovers/matchers/node_has_any_keyword_argument.rb +7 -4
  84. data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +5 -4
  85. data/lib/leftovers/matchers/node_has_positional_argument.rb +5 -1
  86. data/lib/leftovers/matchers/node_has_positional_argument_with_value.rb +6 -1
  87. data/lib/leftovers/matchers/node_has_receiver.rb +4 -0
  88. data/lib/leftovers/matchers/node_is_proc.rb +13 -0
  89. data/lib/leftovers/matchers/node_name.rb +9 -3
  90. data/lib/leftovers/matchers/node_pair_key.rb +23 -0
  91. data/lib/leftovers/matchers/node_pair_value.rb +7 -3
  92. data/lib/leftovers/matchers/node_path.rb +7 -3
  93. data/lib/leftovers/matchers/node_privacy.rb +7 -3
  94. data/lib/leftovers/matchers/node_scalar_value.rb +6 -1
  95. data/lib/leftovers/matchers/node_type.rb +7 -3
  96. data/lib/leftovers/matchers/not.rb +2 -0
  97. data/lib/leftovers/matchers/or.rb +2 -0
  98. data/lib/leftovers/matchers/path.rb +21 -0
  99. data/lib/leftovers/matchers.rb +3 -1
  100. data/lib/leftovers/merged_config.rb +26 -25
  101. data/lib/leftovers/parser.rb +7 -4
  102. data/lib/leftovers/precompilers.rb +5 -5
  103. data/lib/leftovers/processor_builders/action.rb +55 -37
  104. data/lib/leftovers/processor_builders/add_prefix.rb +18 -10
  105. data/lib/leftovers/processor_builders/add_suffix.rb +18 -10
  106. data/lib/leftovers/processor_builders/argument.rb +28 -11
  107. data/lib/leftovers/processor_builders/dynamic.rb +37 -31
  108. data/lib/leftovers/processor_builders/each.rb +82 -10
  109. data/lib/leftovers/processor_builders/itself.rb +2 -2
  110. data/lib/leftovers/processor_builders/keyword.rb +7 -6
  111. data/lib/leftovers/processor_builders/keyword_argument.rb +4 -2
  112. data/lib/leftovers/processor_builders/receiver.rb +13 -0
  113. data/lib/leftovers/processor_builders/transform.rb +55 -44
  114. data/lib/leftovers/processor_builders/transform_chain.rb +1 -1
  115. data/lib/leftovers/processor_builders/transform_set.rb +9 -29
  116. data/lib/leftovers/processor_builders/value.rb +4 -4
  117. data/lib/leftovers/processor_builders.rb +1 -3
  118. data/lib/leftovers/processors/add_call.rb +14 -0
  119. data/lib/leftovers/processors/add_definition_node.rb +16 -0
  120. data/lib/leftovers/processors/add_dynamic_prefix.rb +29 -0
  121. data/lib/leftovers/processors/add_dynamic_suffix.rb +29 -0
  122. data/lib/leftovers/{value_processors → processors}/add_prefix.rb +7 -3
  123. data/lib/leftovers/{value_processors → processors}/add_suffix.rb +7 -3
  124. data/lib/leftovers/processors/append_sym.rb +13 -0
  125. data/lib/leftovers/{value_processors → processors}/camelize.rb +7 -3
  126. data/lib/leftovers/{value_processors → processors}/capitalize.rb +7 -3
  127. data/lib/leftovers/{value_processors → processors}/deconstantize.rb +7 -3
  128. data/lib/leftovers/{value_processors → processors}/delete_after.rb +9 -5
  129. data/lib/leftovers/processors/delete_after_last.rb +26 -0
  130. data/lib/leftovers/processors/delete_before.rb +27 -0
  131. data/lib/leftovers/processors/delete_before_last.rb +27 -0
  132. data/lib/leftovers/{value_processors → processors}/delete_prefix.rb +7 -3
  133. data/lib/leftovers/{value_processors → processors}/delete_suffix.rb +7 -3
  134. data/lib/leftovers/{value_processors → processors}/demodulize.rb +7 -3
  135. data/lib/leftovers/{value_processors → processors}/downcase.rb +7 -3
  136. data/lib/leftovers/processors/each.rb +25 -0
  137. data/lib/leftovers/processors/each_for_definition_set.rb +33 -0
  138. data/lib/leftovers/processors/each_keyword.rb +29 -0
  139. data/lib/leftovers/processors/each_keyword_argument.rb +29 -0
  140. data/lib/leftovers/processors/each_positional_argument.rb +27 -0
  141. data/lib/leftovers/processors/each_positional_argument_from.rb +30 -0
  142. data/lib/leftovers/processors/eval.rb +16 -0
  143. data/lib/leftovers/processors/itself.rb +21 -0
  144. data/lib/leftovers/processors/keyword_argument.rb +30 -0
  145. data/lib/leftovers/processors/match_current_node.rb +26 -0
  146. data/lib/leftovers/processors/match_matched_node.rb +26 -0
  147. data/lib/leftovers/{value_processors → processors}/parameterize.rb +7 -3
  148. data/lib/leftovers/{value_processors → processors}/placeholder.rb +5 -4
  149. data/lib/leftovers/{value_processors → processors}/pluralize.rb +7 -3
  150. data/lib/leftovers/{value_processors → processors}/positional_argument.rb +8 -6
  151. data/lib/leftovers/processors/receiver.rb +24 -0
  152. data/lib/leftovers/{value_processors → processors}/replace_value.rb +7 -3
  153. data/lib/leftovers/processors/set_default_privacy.rb +21 -0
  154. data/lib/leftovers/processors/set_privacy.rb +23 -0
  155. data/lib/leftovers/{value_processors → processors}/singularize.rb +7 -3
  156. data/lib/leftovers/{value_processors → processors}/split.rb +8 -4
  157. data/lib/leftovers/{value_processors → processors}/swapcase.rb +7 -3
  158. data/lib/leftovers/{value_processors → processors}/titleize.rb +7 -3
  159. data/lib/leftovers/{value_processors → processors}/underscore.rb +7 -3
  160. data/lib/leftovers/{value_processors → processors}/upcase.rb +7 -3
  161. data/lib/leftovers/processors.rb +49 -0
  162. data/lib/leftovers/version.rb +1 -1
  163. data/lib/leftovers.rb +3 -12
  164. metadata +97 -52
  165. data/lib/leftovers/dynamic_processors/call.rb +0 -22
  166. data/lib/leftovers/dynamic_processors/call_definition.rb +0 -34
  167. data/lib/leftovers/dynamic_processors/definition.rb +0 -27
  168. data/lib/leftovers/dynamic_processors/each.rb +0 -19
  169. data/lib/leftovers/dynamic_processors/null.rb +0 -9
  170. data/lib/leftovers/dynamic_processors/set_default_privacy.rb +0 -18
  171. data/lib/leftovers/dynamic_processors/set_privacy.rb +0 -23
  172. data/lib/leftovers/dynamic_processors.rb +0 -13
  173. data/lib/leftovers/matcher_builders/node_pair_name.rb +0 -18
  174. data/lib/leftovers/matchers/predicate.rb +0 -19
  175. data/lib/leftovers/processor_builders/each_action.rb +0 -51
  176. data/lib/leftovers/processor_builders/each_dynamic.rb +0 -50
  177. data/lib/leftovers/processor_builders/each_for_definition_set.rb +0 -40
  178. data/lib/leftovers/value_processors/add_dynamic_prefix.rb +0 -24
  179. data/lib/leftovers/value_processors/add_dynamic_suffix.rb +0 -24
  180. data/lib/leftovers/value_processors/delete_before.rb +0 -22
  181. data/lib/leftovers/value_processors/each.rb +0 -21
  182. data/lib/leftovers/value_processors/each_for_definition_set.rb +0 -23
  183. data/lib/leftovers/value_processors/each_keyword.rb +0 -27
  184. data/lib/leftovers/value_processors/each_keyword_argument.rb +0 -27
  185. data/lib/leftovers/value_processors/each_positional_argument.rb +0 -25
  186. data/lib/leftovers/value_processors/itself.rb +0 -17
  187. data/lib/leftovers/value_processors/keyword.rb +0 -28
  188. data/lib/leftovers/value_processors/keyword_argument.rb +0 -28
  189. data/lib/leftovers/value_processors/return_definition_node.rb +0 -14
  190. data/lib/leftovers/value_processors/return_sym.rb +0 -14
  191. data/lib/leftovers/value_processors.rb +0 -40
@@ -1,43 +1,145 @@
1
- # THIS IS INCOMPLETE (you can help by expanding it)
2
- # rails is _really complicated_ and has a lot of magic which calls methods for you.
3
- # some is currently impossible to handle (with_options).
4
- # Some is just corners of rails I haven't hit yet.
1
+ # https://guides.rubyonrails.org/active_record_basics.html
5
2
 
6
- exclude_paths:
7
- - db/migrate/*
3
+
4
+ gems:
5
+ - activesupport
6
+ - activemodel
7
+
8
+ keep:
9
+ # https://guides.rubyonrails.org/active_record_migrations.html#migration-overview
10
+ - path: db/migrate/*
11
+ type: Constant
12
+ - path: db/migrate/*
13
+ name: [up, down, change]
8
14
 
9
15
  dynamic:
16
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html
10
17
  - names:
11
- - after_find
12
- - after_touch
13
- - before_save
14
- - around_save
15
- - after_save
16
- - before_create
17
- - around_create
18
- - after_create
19
- - before_update
20
- - around_update
21
- - after_update
22
- - before_destroy
23
- - around_destroy
24
- - after_destroy
25
- - after_commit
26
- - after_rollback
27
- - after_create_commit
28
- - after_update_commit
29
- - after_destroy_commit
30
- - after_save_commit
18
+ - validates_associated
19
+ - validates_absence_of
20
+ - validates_length_of
21
+ - validates_size_of
22
+ - validates_numericality_of
23
+ - validates_presence_of
24
+ - validates_uniqueness_of
25
+ calls: ['*', if, unless]
26
+
27
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Aggregations/ClassMethods.html
28
+ # i had to read the code for this
29
+ - name: composed_of
31
30
  calls:
32
- - arguments: 0
33
- - arguments: [if, unless]
31
+ - argument: class_name
32
+ split: '::'
33
+ - argument: [converter, constructor]
34
+ defines:
35
+ argument: 0
36
+ transforms:
37
+ - original
38
+ - add_suffix: '='
39
+
40
+ - name: composed_of
41
+ unless:
42
+ has_argument: class_name
43
+ calls:
44
+ argument: 0
45
+ camelize: true
46
+ split: '::'
47
+
48
+ - name: composed_of
49
+ unless:
50
+ has_argument: constructor
51
+ calls:
52
+ value: new
53
+
54
+ - name: composed_of
55
+ has_argument:
56
+ at: mapping
57
+ has_value:
58
+ has_argument:
59
+ at: 0
60
+ has_value:
61
+ type: Array
62
+ calls:
63
+ argument: mapping
64
+ nested:
65
+ argument: '*'
34
66
  nested:
35
- arguments: '*'
67
+ argument: 1
68
+ transforms:
69
+ - original
70
+ - add_suffix: '='
71
+
72
+ - name: composed_of
73
+ has_argument:
74
+ at: mapping
75
+ has_value:
76
+ has_argument:
77
+ at: 0
78
+ unless:
79
+ has_value:
80
+ type: Array
81
+ calls:
82
+ argument: mapping
83
+ nested:
84
+ argument: 1
85
+ transforms:
86
+ - original
87
+ - add_suffix: '='
88
+
89
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html
90
+ - name: has_one
91
+ defines:
92
+ argument: 0
93
+ transforms:
94
+ - original
95
+ - add_suffix: '='
96
+ - add_prefix: build_
97
+ - add_prefix: create_
98
+ - { add_prefix: create_, add_suffix: '!' }
99
+ - add_prefix: reload_
100
+
101
+ - name: belongs_to
102
+ has_argument: polymorphic
103
+ defines:
104
+ argument: 0
105
+ transforms:
106
+ - original
107
+ - add_suffix: '='
108
+ - add_prefix: reload_
109
+ - add_suffix: _changed?
110
+ - add_suffix: _previously_changed?
111
+
112
+ - name: belongs_to
113
+ unless:
114
+ has_argument: polymorphic
115
+ defines:
116
+ argument: 0
117
+ transforms:
118
+ - original
119
+ - add_suffix: '='
120
+ - add_prefix: build_
121
+ - add_prefix: create_
122
+ - { add_prefix: create_, add_suffix: '!' }
123
+ - add_prefix: reload_
124
+ - add_suffix: _changed?
125
+ - add_suffix: _previously_changed?
126
+
127
+ - name: [has_and_belongs_to_many, has_many]
128
+ defines:
129
+ argument: 0
130
+ transforms:
131
+ - original
132
+ - add_suffix: '='
133
+ - singularize: true
134
+ add_suffix: _ids
135
+ - singularize: true
136
+ add_suffix: _ids=
137
+
36
138
  - name:
37
139
  - has_one
38
140
  - belongs_to
39
141
  unless:
40
- has_argument: class_name
142
+ has_argument: [class_name, polymorphic]
41
143
  calls:
42
144
  argument: 0
43
145
  camelize: true
@@ -47,24 +149,13 @@ dynamic:
47
149
  - has_many
48
150
  - has_and_belongs_to_many
49
151
  unless:
50
- has_argument: class_name
152
+ has_argument: [class_name, polymorphic]
51
153
  calls:
52
154
  - argument: 0
53
155
  camelize: true
54
156
  singularize: true
55
157
  split: '::'
56
- - name:
57
- - has_many
58
- - has_and_belongs_to_many
59
- defines:
60
- - argument: 0
61
- transforms:
62
- - original
63
- - add_suffix: '='
64
- - singularize: true
65
- add_suffix: _ids
66
- - singularize: true
67
- add_suffix: _ids=
158
+
68
159
  - name:
69
160
  - has_many
70
161
  - has_one
@@ -80,19 +171,7 @@ dynamic:
80
171
  - source_type
81
172
  - source
82
173
  - through
83
- - name:
84
- - has_one
85
- - belongs_to
86
- defines:
87
- - argument: 0
88
- transforms:
89
- - original
90
- - add_suffix: '='
91
- - add_prefix: build_
92
- - add_prefix: create_
93
- - add_prefix: create_
94
- add_suffix: '!'
95
- - add_prefix: reload
174
+
96
175
  - name: belongs_to
97
176
  unless:
98
177
  has_argument:
@@ -112,33 +191,165 @@ dynamic:
112
191
  - argument: inverse_of
113
192
  - argument: touch
114
193
  add_suffix: '='
194
+
195
+ - name: belongs_to
196
+ calls:
197
+ argument: ensuring_owner_was
198
+
199
+ # these arguments cause something to be done to the association regardless of it being called directly
115
200
  - name:
116
201
  - has_one
117
202
  - has_many
118
203
  - belongs_to
119
204
  - has_and_belongs_to_many
120
205
  has_argument:
121
- at: [dependent, inverse_of, touch, validate]
206
+ at:
207
+ - dependent
208
+ - before_add
209
+ - after_add
210
+ - before_remove
211
+ - after_remove
212
+ - inverse_of
213
+ - touch
214
+ - validate
215
+ - autosave
122
216
  unless:
123
- has_value: false
217
+ has_value: [false, null]
124
218
  calls:
125
219
  argument: 0
126
- - name: scope
127
- has_argument:
128
- at: 1
129
- has_value:
130
- type: Proc
131
- defines:
132
- argument: 0
133
220
 
221
+ - name: [has_one, has_many, belongs_to, has_and_belongs_to_many]
222
+ calls:
223
+ argument: [before_add, after_add, before_remove, after_remove]
224
+ nested: '*'
225
+
226
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Associations/CollectionProxy.html
134
227
  - name:
135
228
  - create
136
229
  - create!
137
230
  - update
138
231
  - update!
232
+ - build
139
233
  calls:
140
- keyword: '**'
234
+ - keyword: '**'
235
+ add_suffix: '='
236
+ - argument: 0
237
+ nested:
238
+ argument: '*'
239
+ keyword: '**'
240
+ add_suffix: '='
241
+
242
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html#method-i-attribute
243
+ - name: attribute
244
+ defines:
245
+ argument: 0
246
+ transforms:
247
+ - original
248
+ - add_suffix: '='
249
+ - add_suffix: '?'
250
+ - add_suffix: _before_type_cast
251
+ - add_suffix: _before_last_save
252
+ - add_suffix: _change_to_be_saved
253
+ - add_suffix: _in_database
254
+ - add_prefix: saved_change_to_
255
+ - { add_prefix: saved_change_to_, add_suffix: '?' }
256
+ - { add_prefix: will_save_change_to_, add_suffix: '?' }
257
+ - add_prefix: find_by_
258
+
259
+ - name: { match: 'find_by_\w+_and_\w+' }
260
+ calls:
261
+ itself: true
262
+ delete_prefix: find_by_
263
+ split: '_and_'
264
+
265
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods.html#method-i-5B-5D
266
+ - name: '[]'
267
+ calls: 0
268
+
269
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods.html#method-i-5B-5D=
270
+ - name: '[]='
271
+ calls:
272
+ argument: 0
141
273
  add_suffix: '='
274
+
275
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods.html#method-i-attribute_for_inspect
276
+ - name: attribute_for_inspect
277
+ calls: 0
278
+
279
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods.html#method-i-attribute_present?
280
+ - name: attribute_present?
281
+ calls: 0
282
+
283
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/BeforeTypeCast.html#method-i-read_attribute_before_type_cast
284
+ - name: read_attribute_before_type_cast
285
+ calls: 0
286
+
287
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html#method-i-attribute_before_last_save
288
+ - name: attribute_before_last_save
289
+ calls: 0
290
+
291
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html#method-i-attribute_change_to_be_save
292
+ - name: attribute_change_to_be_saved
293
+ calls: 0
294
+
295
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html#method-i-saved_change_to_attribute
296
+ - name: saved_change_to_attribute
297
+ calls: 0
298
+
299
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html#method-i-saved_change_to_attribute-3F
300
+ - name: saved_change_to_attribute?
301
+ calls: 0
302
+
303
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Dirty.html#method-i-saved_change_to_attribute-3F
304
+ - name: will_save_change_to_attribute?
305
+ calls: 0
306
+
307
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Read.html#method-i-read_attribute
308
+ - name: read_attribute
309
+ calls: 0
310
+
311
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Serialization/ClassMethods.html#method-i-serialize
312
+ - name: serialize
313
+ calls: 0
314
+
315
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/AttributeMethods/Write.html
316
+ - name: write_attribute
317
+ calls: 0
318
+
319
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/DelegatedType.html#method-i-delegated_type
320
+ - name: delegated_type
321
+ calls:
322
+ argument: types
323
+ nested: '*'
324
+ split: '::'
325
+
326
+ - names:
327
+ - after_commit
328
+ - after_create
329
+ - after_create_commit
330
+ - after_destroy
331
+ - after_destroy_commit
332
+ - after_find
333
+ - after_rollback
334
+ - after_save
335
+ - after_save_commit
336
+ - after_touch
337
+ - after_update
338
+ - after_update_commit
339
+ - around_create
340
+ - around_destroy
341
+ - around_save
342
+ - around_update
343
+ - before_create
344
+ - before_destroy
345
+ - before_save
346
+ - before_update
347
+ calls:
348
+ - arguments: 0
349
+ - arguments: [if, unless]
350
+ nested:
351
+ arguments: '*'
352
+
142
353
  - name:
143
354
  - includes
144
355
  - preload
@@ -149,26 +360,9 @@ dynamic:
149
360
  calls:
150
361
  arguments: ['*', '**']
151
362
  keywords: '**'
152
- - name:
153
- - string
154
- - text
155
- - integer
156
- - bigint
157
- - float
158
- - decimal
159
- - numeric
160
- - datetime
161
- - time
162
- - date
163
- - binary
164
- - boolean
165
- path: /db/schema.rb
166
- calls:
167
- argument: 0
168
- transforms:
169
- - original
170
- - add_suffix: '='
171
- - add_suffix: '?'
363
+ recursive: true
364
+
365
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/NestedAttributes/ClassMethods.html
172
366
  - name: accepts_nested_attributes_for
173
367
  defines:
174
368
  argument: '*'
@@ -177,3 +371,120 @@ dynamic:
177
371
  - add_suffix: _attributes=
178
372
  calls:
179
373
  argument: reject_if
374
+
375
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-update_attribute
376
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-update_attribute-21
377
+ - name: [update_attribute, update_attribute!]
378
+ calls:
379
+ argument: 0
380
+ add_suffix: '='
381
+
382
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-create_with
383
+ - name: create_with
384
+ calls:
385
+ keyword: '**'
386
+ add_suffix: '='
387
+
388
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html#method-i-reflect_on_aggregation
389
+ - name: reflect_on_aggregation
390
+ calls: 0
391
+
392
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Reflection/ClassMethods.html#method-i-reflect_on_association
393
+ - name: reflect_on_association
394
+ calls: 0
395
+
396
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Relation.html#method-i-create_or_find_by
397
+ - name: [create_or_find_by, create_or_find_by!, find_or_create_by, find_or_create_by!, find_or_initialize_by]
398
+ calls:
399
+ keyword: '**'
400
+
401
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Scoping/Named/ClassMethods.html#method-i-scope
402
+ - name: scope
403
+ has_argument:
404
+ at: 1
405
+ has_value:
406
+ type: Proc
407
+ defines:
408
+ argument: 0
409
+
410
+ # https://edgeapi.rubyonrails.org/classes/ActiveRecord/Store.html
411
+ - name: store
412
+ defines:
413
+ argument: accessors
414
+ nested: '*'
415
+ add_prefix:
416
+ - value: ''
417
+ unless:
418
+ has_argument: prefix
419
+ - has_argument:
420
+ at: prefix
421
+ has_value: true
422
+ argument: 0
423
+ add_suffix: _
424
+ - has_argument:
425
+ at: prefix
426
+ has_value:
427
+ type: [String, Symbol]
428
+ argument: prefix
429
+ add_suffix: _
430
+ add_suffix:
431
+ - value: ''
432
+ unless:
433
+ has_argument: suffix
434
+ - has_argument:
435
+ at: suffix
436
+ has_value: true
437
+ argument: 0
438
+ add_prefix: _
439
+ - has_argument:
440
+ at: suffix
441
+ has_value:
442
+ type: [String, Symbol]
443
+ argument: suffix
444
+ add_prefix: _
445
+ transforms:
446
+ - original
447
+ - add_suffix: '='
448
+ - add_suffix: _changed?
449
+ - add_suffix: _was
450
+ - add_suffix: _change
451
+
452
+ - name: store_accessor
453
+ defines:
454
+ arguments: 1+
455
+ add_prefix:
456
+ - value: ''
457
+ unless:
458
+ has_argument: prefix
459
+ - has_argument:
460
+ at: prefix
461
+ has_value: true
462
+ argument: 0
463
+ add_suffix: _
464
+ - has_argument:
465
+ at: prefix
466
+ has_value:
467
+ type: [String, Symbol]
468
+ argument: prefix
469
+ add_suffix: _
470
+ add_suffix:
471
+ - value: ''
472
+ unless:
473
+ has_argument: suffix
474
+ - has_argument:
475
+ at: suffix
476
+ has_value: true
477
+ argument: 0
478
+ add_prefix: _
479
+ - has_argument:
480
+ at: suffix
481
+ has_value:
482
+ type: [String, Symbol]
483
+ argument: suffix
484
+ add_prefix: _
485
+ transforms:
486
+ - original
487
+ - add_suffix: '='
488
+ - add_suffix: _changed?
489
+ - add_suffix: _was
490
+ - add_suffix: _change
@@ -0,0 +1,26 @@
1
+ # https://guides.rubyonrails.org/active_storage_overview.html
2
+ gems:
3
+ - activesupport
4
+ - actionpack
5
+ - activejob
6
+ - activerecord
7
+
8
+ dynamic:
9
+ - name: has_one_attached
10
+ defines:
11
+ argument: 0
12
+ transforms:
13
+ - original
14
+ - add_prefix: with_attached_
15
+ - add_suffix: _attachment
16
+ - add_suffix: _blob
17
+
18
+ - name: has_many_attached
19
+ defines:
20
+ argument: 0
21
+ transforms:
22
+ - original
23
+ - add_prefix: with_attached
24
+ - add_suffix: _attachments
25
+ - add_suffix: _blobs
26
+