leftovers 0.8.0 → 0.11.0

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