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