leftovers 0.4.3 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/docs/Configuration.md +46 -11
  4. data/lib/.DS_Store +0 -0
  5. data/lib/config/actioncable.yml +4 -0
  6. data/lib/config/actionmailer.yml +22 -0
  7. data/lib/config/actionpack.yml +190 -0
  8. data/lib/config/actionview.yml +64 -0
  9. data/lib/config/activejob.yml +29 -0
  10. data/lib/config/activemodel.yml +74 -0
  11. data/lib/config/activerecord.yml +179 -0
  12. data/lib/config/activesupport.yml +99 -0
  13. data/lib/config/haml.yml +2 -0
  14. data/lib/config/rails.yml +11 -450
  15. data/lib/config/ruby.yml +6 -0
  16. data/lib/leftovers/ast/node.rb +14 -0
  17. data/lib/leftovers/config.rb +8 -0
  18. data/lib/leftovers/config_validator/schema_hash.rb +62 -29
  19. data/lib/leftovers/erb.rb +2 -2
  20. data/lib/leftovers/file.rb +2 -3
  21. data/lib/leftovers/matcher_builders/node.rb +2 -0
  22. data/lib/leftovers/matcher_builders/node_has_argument.rb +11 -7
  23. data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +14 -10
  24. data/lib/leftovers/matcher_builders/node_has_positional_argument.rb +17 -13
  25. data/lib/leftovers/matcher_builders/node_has_receiver.rb +15 -0
  26. data/lib/leftovers/matcher_builders/node_type.rb +7 -6
  27. data/lib/leftovers/matcher_builders/node_value.rb +50 -0
  28. data/lib/leftovers/matcher_builders.rb +3 -2
  29. data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +4 -1
  30. data/lib/leftovers/matchers/node_has_positional_argument.rb +0 -4
  31. data/lib/leftovers/matchers/node_has_receiver.rb +20 -0
  32. data/lib/leftovers/matchers/predicate.rb +19 -0
  33. data/lib/leftovers/matchers.rb +2 -0
  34. data/lib/leftovers/merged_config.rb +19 -1
  35. data/lib/leftovers/todo_reporter.rb +9 -6
  36. data/lib/leftovers/value_processors/camelize.rb +1 -1
  37. data/lib/leftovers/value_processors/deconstantize.rb +1 -1
  38. data/lib/leftovers/value_processors/demodulize.rb +1 -1
  39. data/lib/leftovers/value_processors/parameterize.rb +1 -1
  40. data/lib/leftovers/value_processors/pluralize.rb +1 -1
  41. data/lib/leftovers/value_processors/singularize.rb +1 -1
  42. data/lib/leftovers/value_processors/titleize.rb +1 -1
  43. data/lib/leftovers/value_processors/underscore.rb +1 -1
  44. data/lib/leftovers/version.rb +1 -1
  45. data/lib/leftovers.rb +95 -92
  46. metadata +16 -4
  47. 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,99 @@
1
+ requires:
2
+ - 'active_support'
3
+ - 'active_support/core_ext/string'
4
+ - 'active_support/inflections'
5
+ - './config/initializers/inflections'
6
+
7
+ # THIS IS INCOMPLETE (you can help by expanding it)
8
+ # rails is _really complicated_ and has a lot of magic which calls methods for you.
9
+ # some is currently impossible to handle (with_options).
10
+ # Some is just corners of rails I haven't hit yet.
11
+ keep:
12
+ - ClassMethods # ActiveSupport::Concern
13
+ - process_action # ActiveSupport::LogSubscriber
14
+ - format_message # ActiveSupport::Logger
15
+ - APP_PATH
16
+ - APP_ROOT
17
+
18
+ dynamic:
19
+ - name: delegate
20
+ has_argument:
21
+ at: prefix
22
+ has_value: true
23
+ defines:
24
+ - argument: '*'
25
+ add_prefix:
26
+ argument: to
27
+ add_suffix: '_'
28
+ calls:
29
+ - argument: to
30
+ - argument: '*'
31
+ - name: delegate
32
+ has_argument:
33
+ at: prefix
34
+ has_value:
35
+ type: [String, Symbol]
36
+ defines:
37
+ - argument: '*'
38
+ add_prefix:
39
+ argument: prefix
40
+ add_suffix: '_'
41
+ calls:
42
+ - argument: to
43
+ - argument: '*'
44
+ - name: delegate
45
+ unless:
46
+ has_argument:
47
+ - at: prefix
48
+ has_value: true
49
+ - at: prefix
50
+ has_value:
51
+ type: [String, Symbol]
52
+ calls:
53
+ - argument: to
54
+ - name:
55
+ - cattr_accessor
56
+ - mattr_accessor
57
+ defines:
58
+ - argument: '*'
59
+ - argument: '*'
60
+ add_suffix: '='
61
+ calls:
62
+ - argument: '*'
63
+ add_prefix: '@'
64
+ - name:
65
+ - cattr_reader
66
+ - mattr_reader
67
+ defines:
68
+ - argument: '*'
69
+ calls:
70
+ - argument: '*'
71
+ add_prefix: '@'
72
+ - name:
73
+ - cattr_writer
74
+ - mattr_writer
75
+ defines:
76
+ - argument: '*'
77
+ add_suffix: '='
78
+
79
+ - name:
80
+ - thread_cattr_accessor
81
+ - thread_mattr_accessor
82
+ defines:
83
+ - argument: '*'
84
+ - argument: '*'
85
+ add_suffix: '='
86
+ - name:
87
+ - thread_cattr_reader
88
+ - thread_mattr_reader
89
+ defines:
90
+ argument: '*'
91
+ - name:
92
+ - thread_cattr_writer
93
+ - thread_mattr_writer
94
+ defines:
95
+ argument: '*'
96
+ add_suffix: '='
97
+ - name: delegate_missing_to
98
+ calls:
99
+ argument: 0
data/lib/config/haml.yml CHANGED
@@ -1,2 +1,4 @@
1
1
  include_paths:
2
2
  - '*.haml'
3
+ haml_paths:
4
+ - '*.haml'