leftovers 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/docs/Configuration.md +46 -11
  4. data/lib/config/actioncable.yml +4 -0
  5. data/lib/config/actionmailer.yml +22 -0
  6. data/lib/config/actionpack.yml +190 -0
  7. data/lib/config/actionview.yml +64 -0
  8. data/lib/config/activejob.yml +29 -0
  9. data/lib/config/activemodel.yml +74 -0
  10. data/lib/config/activerecord.yml +179 -0
  11. data/lib/config/activesupport.yml +98 -0
  12. data/lib/config/haml.yml +2 -0
  13. data/lib/config/rails.yml +11 -450
  14. data/lib/config/ruby.yml +6 -0
  15. data/lib/leftovers/ast/node.rb +14 -0
  16. data/lib/leftovers/config.rb +8 -0
  17. data/lib/leftovers/config_validator/schema_hash.rb +50 -5
  18. data/lib/leftovers/file.rb +2 -3
  19. data/lib/leftovers/matcher_builders/node.rb +2 -0
  20. data/lib/leftovers/matcher_builders/node_has_argument.rb +11 -7
  21. data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +14 -10
  22. data/lib/leftovers/matcher_builders/node_has_positional_argument.rb +17 -13
  23. data/lib/leftovers/matcher_builders/node_has_receiver.rb +15 -0
  24. data/lib/leftovers/matcher_builders/node_type.rb +7 -6
  25. data/lib/leftovers/matcher_builders/node_value.rb +42 -0
  26. data/lib/leftovers/matcher_builders.rb +3 -2
  27. data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +4 -1
  28. data/lib/leftovers/matchers/node_has_positional_argument.rb +0 -4
  29. data/lib/leftovers/matchers/node_has_receiver.rb +20 -0
  30. data/lib/leftovers/matchers/predicate.rb +19 -0
  31. data/lib/leftovers/matchers.rb +2 -0
  32. data/lib/leftovers/merged_config.rb +19 -1
  33. data/lib/leftovers/todo_reporter.rb +9 -6
  34. data/lib/leftovers/version.rb +1 -1
  35. data/lib/leftovers.rb +95 -92
  36. metadata +14 -3
  37. data/lib/leftovers/matcher_builders/argument_node_value.rb +0 -21
@@ -0,0 +1,179 @@
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.
5
+
6
+ exclude_paths:
7
+ - db/migrate/*
8
+
9
+ dynamic:
10
+ - 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
31
+ calls:
32
+ - arguments: 0
33
+ - arguments: [if, unless]
34
+ nested:
35
+ arguments: '*'
36
+ - name:
37
+ - has_one
38
+ - belongs_to
39
+ unless:
40
+ has_argument: class_name
41
+ calls:
42
+ argument: 0
43
+ camelize: true
44
+ split: '::'
45
+
46
+ - name:
47
+ - has_many
48
+ - has_and_belongs_to_many
49
+ unless:
50
+ has_argument: class_name
51
+ calls:
52
+ - argument: 0
53
+ camelize: true
54
+ singularize: true
55
+ 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=
68
+ - name:
69
+ - has_many
70
+ - has_one
71
+ - has_and_belongs_to_many
72
+ calls:
73
+ argument:
74
+ - as
75
+ - name:
76
+ - has_one
77
+ - has_many
78
+ calls:
79
+ - argument:
80
+ - source_type
81
+ - source
82
+ - 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
96
+ - name: belongs_to
97
+ unless:
98
+ has_argument:
99
+ at: optional
100
+ has_value: true
101
+ calls:
102
+ argument: 0
103
+
104
+ - name:
105
+ - has_one
106
+ - has_many
107
+ - belongs_to
108
+ - has_and_belongs_to_many
109
+ calls:
110
+ - argument: class_name
111
+ split: '::'
112
+ - argument: inverse_of
113
+ - argument: touch
114
+ add_suffix: '='
115
+ - name:
116
+ - has_one
117
+ - has_many
118
+ - belongs_to
119
+ - has_and_belongs_to_many
120
+ has_argument:
121
+ at: [dependent, inverse_of, touch, validate]
122
+ unless:
123
+ has_value: false
124
+ calls:
125
+ argument: 0
126
+ - name: scope
127
+ has_argument:
128
+ at: 1
129
+ has_value:
130
+ type: Proc
131
+ defines:
132
+ argument: 0
133
+
134
+ - name:
135
+ - create
136
+ - create!
137
+ - update
138
+ - update!
139
+ calls:
140
+ keyword: '**'
141
+ add_suffix: '='
142
+ - name:
143
+ - includes
144
+ - preload
145
+ - eager_load
146
+ - joins
147
+ - left_joins
148
+ - left_outer_joins
149
+ calls:
150
+ arguments: ['*', '**']
151
+ 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: '?'
172
+ - name: accepts_nested_attributes_for
173
+ defines:
174
+ argument: '*'
175
+ transforms:
176
+ - add_suffix: _attributes
177
+ - add_suffix: _attributes=
178
+ calls:
179
+ argument: reject_if
@@ -0,0 +1,98 @@
1
+ requires:
2
+ - 'active_support/core_ext/string'
3
+ - 'active_support/inflections'
4
+ - './config/initializers/inflections'
5
+
6
+ # THIS IS INCOMPLETE (you can help by expanding it)
7
+ # rails is _really complicated_ and has a lot of magic which calls methods for you.
8
+ # some is currently impossible to handle (with_options).
9
+ # Some is just corners of rails I haven't hit yet.
10
+ keep:
11
+ - ClassMethods # ActiveSupport::Concern
12
+ - process_action # ActiveSupport::LogSubscriber
13
+ - format_message # ActiveSupport::Logger
14
+ - APP_PATH
15
+ - APP_ROOT
16
+
17
+ dynamic:
18
+ - name: delegate
19
+ has_argument:
20
+ at: prefix
21
+ has_value: true
22
+ defines:
23
+ - argument: '*'
24
+ add_prefix:
25
+ argument: to
26
+ add_suffix: '_'
27
+ calls:
28
+ - argument: to
29
+ - argument: '*'
30
+ - name: delegate
31
+ has_argument:
32
+ at: prefix
33
+ has_value:
34
+ type: [String, Symbol]
35
+ defines:
36
+ - argument: '*'
37
+ add_prefix:
38
+ argument: prefix
39
+ add_suffix: '_'
40
+ calls:
41
+ - argument: to
42
+ - argument: '*'
43
+ - name: delegate
44
+ unless:
45
+ has_argument:
46
+ - at: prefix
47
+ has_value: true
48
+ - at: prefix
49
+ has_value:
50
+ type: [String, Symbol]
51
+ calls:
52
+ - argument: to
53
+ - name:
54
+ - cattr_accessor
55
+ - mattr_accessor
56
+ defines:
57
+ - argument: '*'
58
+ - argument: '*'
59
+ add_suffix: '='
60
+ calls:
61
+ - argument: '*'
62
+ add_prefix: '@'
63
+ - name:
64
+ - cattr_reader
65
+ - mattr_reader
66
+ defines:
67
+ - argument: '*'
68
+ calls:
69
+ - argument: '*'
70
+ add_prefix: '@'
71
+ - name:
72
+ - cattr_writer
73
+ - mattr_writer
74
+ defines:
75
+ - argument: '*'
76
+ add_suffix: '='
77
+
78
+ - name:
79
+ - thread_cattr_accessor
80
+ - thread_mattr_accessor
81
+ defines:
82
+ - argument: '*'
83
+ - argument: '*'
84
+ add_suffix: '='
85
+ - name:
86
+ - thread_cattr_reader
87
+ - thread_mattr_reader
88
+ defines:
89
+ argument: '*'
90
+ - name:
91
+ - thread_cattr_writer
92
+ - thread_mattr_writer
93
+ defines:
94
+ argument: '*'
95
+ add_suffix: '='
96
+ - name: delegate_missing_to
97
+ calls:
98
+ argument: 0
data/lib/config/haml.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  include_paths:
2
2
  - '*.haml'
3
+ haml_paths:
4
+ - '*.haml'