leftovers 0.2.3 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (147) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/README.md +65 -49
  4. data/docs/Configuration.md +627 -0
  5. data/exe/leftovers +2 -2
  6. data/leftovers.gemspec +13 -6
  7. data/lib/config/attr_encrypted.yml +3 -4
  8. data/lib/config/audited.yml +9 -4
  9. data/lib/config/datagrid.yml +1 -1
  10. data/lib/config/flipper.yml +1 -3
  11. data/lib/config/graphql.yml +15 -13
  12. data/lib/config/okcomputer.yml +1 -3
  13. data/lib/config/parser.yml +89 -91
  14. data/lib/config/rails.yml +126 -107
  15. data/lib/config/redcarpet.yml +35 -38
  16. data/lib/config/rollbar.yml +1 -3
  17. data/lib/config/rspec.yml +18 -10
  18. data/lib/config/ruby.yml +42 -49
  19. data/lib/config/selenium-webdriver.yml +19 -0
  20. data/lib/config/sidekiq.yml +4 -8
  21. data/lib/config/will_paginate.yml +12 -14
  22. data/lib/leftovers.rb +66 -54
  23. data/lib/leftovers/ast.rb +8 -0
  24. data/lib/leftovers/ast/builder.rb +6 -3
  25. data/lib/leftovers/ast/node.rb +66 -107
  26. data/lib/leftovers/backports.rb +24 -40
  27. data/lib/leftovers/cli.rb +27 -15
  28. data/lib/leftovers/collector.rb +8 -11
  29. data/lib/leftovers/config.rb +38 -13
  30. data/lib/leftovers/config_validator.rb +60 -0
  31. data/lib/leftovers/config_validator/error_processor.rb +196 -0
  32. data/lib/leftovers/config_validator/schema_hash.rb +496 -0
  33. data/lib/leftovers/definition.rb +16 -41
  34. data/lib/leftovers/definition_node.rb +36 -0
  35. data/lib/leftovers/definition_set.rb +17 -24
  36. data/lib/leftovers/dynamic_processors.rb +11 -0
  37. data/lib/leftovers/dynamic_processors/call.rb +25 -0
  38. data/lib/leftovers/dynamic_processors/call_definition.rb +31 -0
  39. data/lib/leftovers/dynamic_processors/definition.rb +26 -0
  40. data/lib/leftovers/dynamic_processors/each.rb +19 -0
  41. data/lib/leftovers/dynamic_processors/null.rb +9 -0
  42. data/lib/leftovers/erb.rb +2 -2
  43. data/lib/leftovers/file.rb +3 -5
  44. data/lib/leftovers/file_collector.rb +79 -61
  45. data/lib/leftovers/file_list.rb +9 -15
  46. data/lib/leftovers/haml.rb +9 -12
  47. data/lib/leftovers/matcher_builders.rb +24 -0
  48. data/lib/leftovers/matcher_builders/and.rb +19 -0
  49. data/lib/leftovers/matcher_builders/and_not.rb +14 -0
  50. data/lib/leftovers/matcher_builders/argument_node_value.rb +21 -0
  51. data/lib/leftovers/matcher_builders/name.rb +29 -0
  52. data/lib/leftovers/matcher_builders/node.rb +40 -0
  53. data/lib/leftovers/matcher_builders/node_has_argument.rb +71 -0
  54. data/lib/leftovers/matcher_builders/node_has_keyword_argument.rb +22 -0
  55. data/lib/leftovers/matcher_builders/node_has_positional_argument.rb +24 -0
  56. data/lib/leftovers/matcher_builders/node_name.rb +15 -0
  57. data/lib/leftovers/matcher_builders/node_pair_name.rb +18 -0
  58. data/lib/leftovers/matcher_builders/node_pair_value.rb +16 -0
  59. data/lib/leftovers/matcher_builders/node_path.rb +14 -0
  60. data/lib/leftovers/matcher_builders/node_type.rb +28 -0
  61. data/lib/leftovers/matcher_builders/or.rb +73 -0
  62. data/lib/leftovers/matcher_builders/path.rb +15 -0
  63. data/lib/leftovers/matcher_builders/string.rb +11 -0
  64. data/lib/leftovers/matcher_builders/string_pattern.rb +19 -0
  65. data/lib/leftovers/matcher_builders/unless.rb +13 -0
  66. data/lib/leftovers/matchers.rb +26 -0
  67. data/lib/leftovers/matchers/all.rb +25 -0
  68. data/lib/leftovers/matchers/and.rb +24 -0
  69. data/lib/leftovers/matchers/any.rb +27 -0
  70. data/lib/leftovers/matchers/node_has_any_keyword_argument.rb +28 -0
  71. data/lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb +25 -0
  72. data/lib/leftovers/matchers/node_has_positional_argument.rb +23 -0
  73. data/lib/leftovers/matchers/node_has_positional_argument_with_value.rb +25 -0
  74. data/lib/leftovers/matchers/node_name.rb +23 -0
  75. data/lib/leftovers/matchers/node_pair_value.rb +23 -0
  76. data/lib/leftovers/matchers/node_path.rb +23 -0
  77. data/lib/leftovers/matchers/node_scalar_value.rb +25 -0
  78. data/lib/leftovers/matchers/node_type.rb +23 -0
  79. data/lib/leftovers/matchers/not.rb +23 -0
  80. data/lib/leftovers/matchers/or.rb +26 -0
  81. data/lib/leftovers/merged_config.rb +29 -14
  82. data/lib/leftovers/parser.rb +1 -4
  83. data/lib/leftovers/processor_builders.rb +22 -0
  84. data/lib/leftovers/processor_builders/action.rb +63 -0
  85. data/lib/leftovers/processor_builders/add_prefix.rb +20 -0
  86. data/lib/leftovers/processor_builders/add_suffix.rb +20 -0
  87. data/lib/leftovers/processor_builders/argument.rb +25 -0
  88. data/lib/leftovers/processor_builders/dynamic.rb +27 -0
  89. data/lib/leftovers/processor_builders/each.rb +36 -0
  90. data/lib/leftovers/processor_builders/each_action.rb +51 -0
  91. data/lib/leftovers/processor_builders/each_dynamic.rb +54 -0
  92. data/lib/leftovers/processor_builders/each_for_definition_set.rb +36 -0
  93. data/lib/leftovers/processor_builders/itself.rb +13 -0
  94. data/lib/leftovers/processor_builders/keyword.rb +24 -0
  95. data/lib/leftovers/processor_builders/keyword_argument.rb +14 -0
  96. data/lib/leftovers/processor_builders/transform.rb +55 -0
  97. data/lib/leftovers/processor_builders/transform_chain.rb +24 -0
  98. data/lib/leftovers/processor_builders/transform_set.rb +47 -0
  99. data/lib/leftovers/processor_builders/value.rb +13 -0
  100. data/lib/leftovers/rake_task.rb +4 -4
  101. data/lib/leftovers/reporter.rb +56 -4
  102. data/lib/leftovers/todo_reporter.rb +124 -0
  103. data/lib/leftovers/value_processors.rb +40 -0
  104. data/lib/leftovers/value_processors/add_dynamic_prefix.rb +31 -0
  105. data/lib/leftovers/value_processors/add_dynamic_suffix.rb +31 -0
  106. data/lib/leftovers/value_processors/add_prefix.rb +20 -0
  107. data/lib/leftovers/value_processors/add_suffix.rb +20 -0
  108. data/lib/leftovers/value_processors/camelize.rb +24 -0
  109. data/lib/leftovers/value_processors/capitalize.rb +19 -0
  110. data/lib/leftovers/value_processors/deconstantize.rb +24 -0
  111. data/lib/leftovers/value_processors/delete_after.rb +22 -0
  112. data/lib/leftovers/value_processors/delete_before.rb +22 -0
  113. data/lib/leftovers/value_processors/delete_prefix.rb +26 -0
  114. data/lib/leftovers/value_processors/delete_suffix.rb +26 -0
  115. data/lib/leftovers/value_processors/demodulize.rb +24 -0
  116. data/lib/leftovers/value_processors/downcase.rb +19 -0
  117. data/lib/leftovers/value_processors/each.rb +21 -0
  118. data/lib/leftovers/value_processors/each_for_definition_set.rb +29 -0
  119. data/lib/leftovers/value_processors/each_keyword.rb +27 -0
  120. data/lib/leftovers/value_processors/each_keyword_argument.rb +27 -0
  121. data/lib/leftovers/value_processors/each_positional_argument.rb +24 -0
  122. data/lib/leftovers/value_processors/itself.rb +17 -0
  123. data/lib/leftovers/value_processors/keyword.rb +36 -0
  124. data/lib/leftovers/value_processors/keyword_argument.rb +36 -0
  125. data/lib/leftovers/value_processors/parameterize.rb +24 -0
  126. data/lib/leftovers/value_processors/placeholder.rb +18 -0
  127. data/lib/leftovers/value_processors/pluralize.rb +24 -0
  128. data/lib/leftovers/value_processors/positional_argument.rb +26 -0
  129. data/lib/leftovers/value_processors/replace_value.rb +18 -0
  130. data/lib/leftovers/value_processors/return_definition.rb +26 -0
  131. data/lib/leftovers/value_processors/return_string.rb +14 -0
  132. data/lib/leftovers/value_processors/singularize.rb +24 -0
  133. data/lib/leftovers/value_processors/split.rb +22 -0
  134. data/lib/leftovers/value_processors/swapcase.rb +19 -0
  135. data/lib/leftovers/value_processors/titleize.rb +24 -0
  136. data/lib/leftovers/value_processors/underscore.rb +24 -0
  137. data/lib/leftovers/value_processors/upcase.rb +19 -0
  138. data/lib/leftovers/version.rb +1 -1
  139. metadata +201 -25
  140. data/lib/config/selenium.yml +0 -21
  141. data/lib/leftovers/argument_rule.rb +0 -219
  142. data/lib/leftovers/core_ext.rb +0 -13
  143. data/lib/leftovers/hash_rule.rb +0 -40
  144. data/lib/leftovers/name_rule.rb +0 -53
  145. data/lib/leftovers/rule.rb +0 -74
  146. data/lib/leftovers/transform_rule.rb +0 -171
  147. data/lib/leftovers/value_rule.rb +0 -56
data/exe/leftovers CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require_relative '../lib/leftovers/cli'
4
+ require_relative '../lib/leftovers'
5
5
 
6
- Leftovers::CLI.new(argv: ARGV)
6
+ exit Leftovers::CLI.new(argv: ARGV).run
data/leftovers.gemspec CHANGED
@@ -16,9 +16,10 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = 'http://github.com/robotdana/leftovers'
19
- spec.metadata['changelog_uri'] = 'http://github.com/robotdana/leftovers/blob/master/CHANGELOG.md'
19
+ spec.metadata['changelog_uri'] = 'http://github.com/robotdana/leftovers/blob/main/CHANGELOG.md'
20
+ spec.required_ruby_version = '>= 2.4.0'
20
21
 
21
- spec.files = Dir.glob('{lib,exe}/**/{*,.*}') + %w{
22
+ spec.files = Dir.glob('{lib,exe,docs}/**/{*,.*}') + %w{
22
23
  CHANGELOG.md
23
24
  Gemfile
24
25
  LICENSE.txt
@@ -30,17 +31,23 @@ Gem::Specification.new do |spec|
30
31
  spec.require_paths = ['lib']
31
32
 
32
33
  spec.add_development_dependency 'activesupport'
34
+ spec.add_development_dependency 'benchmark-ips'
33
35
  spec.add_development_dependency 'bundler', '~> 2.0'
34
36
  spec.add_development_dependency 'haml'
35
37
  spec.add_development_dependency 'pry', '~> 0.1'
36
38
  spec.add_development_dependency 'rake', '>= 13'
37
39
  spec.add_development_dependency 'rspec', '~> 3.0'
38
- spec.add_development_dependency 'rubocop', '~> 0.74'
39
- spec.add_development_dependency 'rubocop-performance', '~> 1.4'
40
- spec.add_development_dependency 'rubocop-rspec', '~> 1.35'
40
+ spec.add_development_dependency 'rubocop', '~> 0.93.1'
41
+ spec.add_development_dependency 'rubocop-performance', '~> 1.8.1'
42
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.44.1'
43
+ spec.add_development_dependency 'simplecov', '>= 0.18.5'
44
+ spec.add_development_dependency 'simplecov-console'
45
+ spec.add_development_dependency 'timecop'
46
+ spec.add_development_dependency 'tty_string', '>= 0.2.1'
41
47
 
42
48
  spec.add_development_dependency 'spellr', '>= 0.8.1'
43
- spec.add_dependency 'fast_ignore', '>= 0.10.0'
49
+ spec.add_dependency 'fast_ignore', '>= 0.15.1'
50
+ spec.add_dependency 'json_schemer'
44
51
  spec.add_dependency 'parallel'
45
52
  spec.add_dependency 'parser'
46
53
  end
@@ -1,10 +1,9 @@
1
- rules:
1
+ dynamic:
2
2
  # this doesn't handle custom prefix, suffix, attribute
3
3
  - name: attr_encrypted
4
- defines:
5
- - argument: 1
4
+ defines: 0
6
5
  calls:
7
- - argument: 1
6
+ - argument: 0
8
7
  transforms:
9
8
  - add_prefix: encrypted_
10
9
  - add_prefix: encrypted_
@@ -1,4 +1,9 @@
1
- rules:
2
- name: current_user_method=
3
- calls:
4
- argument: 1
1
+ dynamic:
2
+ - name: current_user_method=
3
+ calls: 0
4
+ - name: audited
5
+ calls:
6
+ argument:
7
+ - associated_with
8
+ - if
9
+ - unless
@@ -1,4 +1,4 @@
1
- rules:
1
+ dynamic:
2
2
  - name: filter
3
3
  calls:
4
4
  arguments:
@@ -1,3 +1 @@
1
- rules:
2
- skip: true
3
- name: flipper_id
1
+ keep: flipper_id
@@ -1,20 +1,22 @@
1
- rules:
2
- - skip: true
3
- names:
4
- - cursor_from_node
5
- - paged_nodes
6
- - sliced_nodes
1
+ keep:
2
+ - cursor_from_node
3
+ - paged_nodes
4
+ - sliced_nodes
5
+ dynamic:
7
6
  - name: field
8
7
  calls:
9
- - argument: 1
10
- unless:
11
- has_argument: method
12
- - argument: method
8
+ argument: method
9
+ - name: field
10
+ unless:
11
+ has_argument: method
12
+ calls: 0
13
13
  - name: argument
14
+ unless:
15
+ has_argument: as
14
16
  calls:
15
- - argument: 1
17
+ - argument: 0
16
18
  add_suffix: '='
17
- unless:
18
- has_argument: as
19
+ - name: argument
20
+ calls:
19
21
  - argument: as
20
22
  add_suffix: '='
@@ -1,3 +1 @@
1
- rules:
2
- skip: true
3
- name: check
1
+ keep: check
@@ -1,91 +1,89 @@
1
- rules:
2
- skip: true
3
- names: |
4
- on_alias
5
- on_and
6
- on_and_asgn
7
- on_arg
8
- on_arg_expr
9
- on_args
10
- on_argument
11
- on_array
12
- on_back_ref
13
- on_begin
14
- on_block
15
- on_block_pass
16
- on_blockarg
17
- on_blockarg_expr
18
- on_break
19
- on_case
20
- on_casgn
21
- on_class
22
- on_const
23
- on_csend
24
- on_cvar
25
- on_cvasgn
26
- on_def
27
- on_defined?
28
- on_defs
29
- on_dstr
30
- on_dsym
31
- on_eflipflop
32
- on_ensure
33
- on_erange
34
- on_for
35
- on_gvar
36
- on_gvasgn
37
- on_hash
38
- on_if
39
- on_iflipflop
40
- on_irange
41
- on_ivar
42
- on_ivasgn
43
- on_kwarg
44
- on_kwbegin
45
- on_kwoptarg
46
- on_kwrestarg
47
- on_lvar
48
- on_lvasgn
49
- on_masgn
50
- on_match_current_line
51
- on_match_with_lvasgn
52
- on_mlhs
53
- on_module
54
- on_next
55
- on_not
56
- on_nth_ref
57
- on_op_asgn
58
- on_optarg
59
- on_or
60
- on_or_asgn
61
- on_pair
62
- on_postexe
63
- on_preexe
64
- on_procarg0
65
- on_redo
66
- on_regexp
67
- on_resbody
68
- on_rescue
69
- on_restarg
70
- on_restarg_expr
71
- on_retry
72
- on_return
73
- on_sclass
74
- on_send
75
- on_shadowarg
76
- on_splat
77
- on_super
78
- on_undef
79
- on_until
80
- on_until_post
81
- on_var
82
- on_vasgn
83
- on_when
84
- on_while
85
- on_while_post
86
- on_xstr
87
- on_yield
88
- process_argument_node
89
- process_regular_node
90
- process_var_asgn_node
91
- process_variable_node
1
+ keep:
2
+ - on_alias
3
+ - on_and
4
+ - on_and_asgn
5
+ - on_arg
6
+ - on_arg_expr
7
+ - on_args
8
+ - on_argument
9
+ - on_array
10
+ - on_back_ref
11
+ - on_begin
12
+ - on_block
13
+ - on_block_pass
14
+ - on_blockarg
15
+ - on_blockarg_expr
16
+ - on_break
17
+ - on_case
18
+ - on_casgn
19
+ - on_class
20
+ - on_const
21
+ - on_csend
22
+ - on_cvar
23
+ - on_cvasgn
24
+ - on_def
25
+ - on_defined?
26
+ - on_defs
27
+ - on_dstr
28
+ - on_dsym
29
+ - on_eflipflop
30
+ - on_ensure
31
+ - on_erange
32
+ - on_for
33
+ - on_gvar
34
+ - on_gvasgn
35
+ - on_hash
36
+ - on_if
37
+ - on_iflipflop
38
+ - on_irange
39
+ - on_ivar
40
+ - on_ivasgn
41
+ - on_kwarg
42
+ - on_kwbegin
43
+ - on_kwoptarg
44
+ - on_kwrestarg
45
+ - on_lvar
46
+ - on_lvasgn
47
+ - on_masgn
48
+ - on_match_current_line
49
+ - on_match_with_lvasgn
50
+ - on_mlhs
51
+ - on_module
52
+ - on_next
53
+ - on_not
54
+ - on_nth_ref
55
+ - on_op_asgn
56
+ - on_optarg
57
+ - on_or
58
+ - on_or_asgn
59
+ - on_pair
60
+ - on_postexe
61
+ - on_preexe
62
+ - on_procarg0
63
+ - on_redo
64
+ - on_regexp
65
+ - on_resbody
66
+ - on_rescue
67
+ - on_restarg
68
+ - on_restarg_expr
69
+ - on_retry
70
+ - on_return
71
+ - on_sclass
72
+ - on_send
73
+ - on_shadowarg
74
+ - on_splat
75
+ - on_super
76
+ - on_undef
77
+ - on_until
78
+ - on_until_post
79
+ - on_var
80
+ - on_vasgn
81
+ - on_when
82
+ - on_while
83
+ - on_while_post
84
+ - on_xstr
85
+ - on_yield
86
+ - process_argument_node
87
+ - process_regular_node
88
+ - process_var_asgn_node
89
+ - process_variable_node
data/lib/config/rails.yml CHANGED
@@ -4,31 +4,30 @@ exclude_paths:
4
4
  include_paths:
5
5
  - '*.rjs'
6
6
  - '*.rhtml'
7
+ requires:
8
+ - 'active_support/core_ext/string'
9
+ - 'active_support/inflections'
10
+ - './config/initializers/inflections'
7
11
 
8
12
  # THIS IS INCOMPLETE (you can help by expanding it)
9
13
  # rails is _really complicated_ and has a lot of magic which calls methods for you.
10
14
  # some is currently impossible to handle (with_options).
11
15
  # Some is just corners of rails I haven't hit yet.
12
- # TODO: split this up by the actual gems
13
- rules:
14
- - skip: true
15
- names:
16
- - ClassMethods # ActiveSupport::Concern
17
- - process_action # ActiveSupport::LogSubscriber
18
- - validate_each # ActiveModel::EachValidator
19
- - format_message # ActiveSupport::Logger
20
- - ssl_configured? # ApplicationController
21
- - APP_PATH
22
- - APP_ROOT
23
- - default_url_options # called by url_for
24
- - skip: true
25
- names:
26
- has_suffix: Helper
16
+ keep:
17
+ - ClassMethods # ActiveSupport::Concern
18
+ - process_action # ActiveSupport::LogSubscriber
19
+ - validate_each # ActiveModel::EachValidator
20
+ - format_message # ActiveSupport::Logger
21
+ - ssl_configured? # ApplicationController
22
+ - default_url_options # called by url_for
23
+ - APP_PATH
24
+ - APP_ROOT
25
+ - has_suffix: Helper
27
26
  path: /app/helpers
28
- - skip: true
29
- names:
30
- has_suffix: Preview
27
+ - has_suffix: Preview
31
28
  path: '**/mailers/previews/**/*_preview.rb'
29
+
30
+ dynamic:
32
31
  - names:
33
32
  - after_initialize
34
33
  - after_find
@@ -54,10 +53,10 @@ rules:
54
53
  - after_destroy_commit
55
54
  - after_save_commit
56
55
  calls:
57
- arguments:
58
- - 1
59
- - if
60
- - unless
56
+ - arguments: 0
57
+ - arguments: [if, unless]
58
+ nested:
59
+ arguments: '*'
61
60
  - name:
62
61
  - after_action
63
62
  - append_after_action
@@ -73,22 +72,24 @@ rules:
73
72
  - skip_around_action
74
73
  - validates_associated
75
74
  calls:
76
- - arguments:
77
- - '*'
78
- - if
79
- - unless
75
+ - arguments: ['*', if, unless]
80
76
  - name: validates
81
77
  calls:
82
78
  - arguments:
83
79
  - '*'
84
- - 'in'
80
+ - within
85
81
  - inclusion
86
82
  - scope
87
83
  - if
88
84
  - unless
89
- - keys: '*'
85
+ - arguments: inclusion
86
+ nested:
87
+ arguments: 'in'
88
+ - keywords:
89
+ unless: [if, unless]
90
90
  camelize: true
91
91
  add_suffix: Validator
92
+ split: '::'
92
93
  - names:
93
94
  - validate
94
95
  - validate_associated
@@ -123,8 +124,8 @@ rules:
123
124
  - url_field
124
125
  - week_field
125
126
  calls:
126
- - arguments: [1,2] # 1: with a receiver, 2: with no receiver
127
- - arguments: [1,2]
127
+ - arguments: [0,1] # 0: with a receiver, 1: with no receiver
128
+ - arguments: [0,1]
128
129
  add_suffix: '='
129
130
  - name: fields_for
130
131
  calls:
@@ -132,73 +133,81 @@ rules:
132
133
  add_suffix: _attributes
133
134
  - name: options_from_collection_for_select
134
135
  calls:
135
- - arguments: [2,3]
136
+ - arguments: [1,2]
136
137
  - name:
137
138
  - collection_select
138
139
  - collection_check_boxes
139
140
  - collection_radio_buttons
140
141
  calls:
141
- - argument: 2
142
+ - argument: 1
142
143
  add_suffix: '='
143
- - arguments: [4,5]
144
+ - arguments: [3,4]
144
145
  - name: grouped_collection_select
145
146
  calls:
146
- - argument: 2
147
+ - argument: 1
147
148
  add_suffix: '='
148
- - arguments: [4,5,6,7]
149
+ - arguments: [3,4,5,6]
149
150
  - name: option_groups_from_collection_for_select
150
151
  calls:
151
- - arguments: [1,2,3,4]
152
+ - arguments: [0,1,2,3]
152
153
  - name: scope
153
154
  path: /app/models
154
155
  defines:
155
- argument: 1 # ar
156
+ argument: 0 # ar
156
157
  - name: scope
157
158
  path: /config/routes*
158
159
  calls:
159
160
  argument: module # routes
160
161
  camelize: true
162
+ split: '::'
161
163
  - name: namespace
162
164
  calls:
163
- - argument: 1
165
+ - argument: 0
164
166
  camelize: true
167
+ split: '::'
165
168
  - name:
166
169
  - attribute
167
170
  - alias_attribute
168
171
  path: app/models/*
169
172
  defines:
170
- argument: 1
171
- linked_transforms:
173
+ argument: 0
174
+ transforms:
172
175
  - original
173
176
  - add_suffix: '?'
174
177
  - add_suffix: '='
175
178
  - name: alias_attribute
176
179
  calls:
177
- - argument: 2
178
- - argument: 2
180
+ - argument: 1
181
+ - argument: 1
179
182
  add_suffix: '?'
180
- - argument: 2
183
+ - argument: 1
181
184
  add_suffix: '='
182
185
  - name:
183
186
  - has_one
184
187
  - belongs_to
188
+ unless:
189
+ has_argument: class_name
185
190
  calls:
186
- argument: 1
191
+ argument: 0
187
192
  camelize: true
188
- unless:
189
- has_argument: class_name
193
+ split: '::'
194
+
190
195
  - name:
191
196
  - has_many
192
197
  - has_and_belongs_to_many
198
+ unless:
199
+ has_argument: class_name
193
200
  calls:
194
- - argument: 1
201
+ - argument: 0
195
202
  camelize: true
196
203
  singularize: true
197
- unless:
198
- has_argument: class_name
204
+ split: '::'
205
+ - name:
206
+ - has_many
207
+ - has_and_belongs_to_many
199
208
  defines:
200
- - argument: 1
201
- linked_transforms:
209
+ - argument: 0
210
+ transforms:
202
211
  - original
203
212
  - add_suffix: '='
204
213
  - singularize: true
@@ -224,8 +233,8 @@ rules:
224
233
  - has_one
225
234
  - belongs_to
226
235
  defines:
227
- - argument: 1
228
- linked_transforms:
236
+ - argument: 0
237
+ transforms:
229
238
  - original
230
239
  - add_suffix: '='
231
240
  - add_prefix: build_
@@ -234,12 +243,12 @@ rules:
234
243
  add_suffix: '!'
235
244
  - add_prefix: reload
236
245
  - name: belongs_to
246
+ unless:
247
+ has_argument:
248
+ at: optional
249
+ has_value: true
237
250
  calls:
238
- argument: 1
239
- unless:
240
- has_argument:
241
- keyword: optional
242
- value: true
251
+ argument: 0
243
252
 
244
253
  - name:
245
254
  - has_one
@@ -247,25 +256,23 @@ rules:
247
256
  - belongs_to
248
257
  - has_and_belongs_to_many
249
258
  calls:
250
- - argument:
251
- - class_name
252
- - inverse_of
259
+ - argument: class_name
260
+ split: '::'
261
+ - argument: inverse_of
253
262
  - argument: touch
254
263
  add_suffix: '='
255
- - argument: 1
256
- if:
257
- has_argument: dependent
258
- - argument: 1
259
- if:
260
- has_argument: inverse_of
261
- - argument: 1
262
- if:
263
- has_argument: touch
264
- - argument: 1
265
- if:
266
- has_argument:
267
- keyword: validate
268
- value: true
264
+ - name:
265
+ - has_one
266
+ - has_many
267
+ - belongs_to
268
+ - has_and_belongs_to_many
269
+ has_argument:
270
+ at: [dependent, inverse_of, touch, validate]
271
+ unless:
272
+ has_value: false
273
+ calls:
274
+ argument: 0
275
+
269
276
  - name:
270
277
  - rescue_from
271
278
  calls:
@@ -279,37 +286,47 @@ rules:
279
286
  - put
280
287
  - root
281
288
  calls:
282
- - arguments: [1, action]
289
+ - arguments: [0, action]
283
290
  - argument: '**'
284
291
  delete_before: '#'
285
292
  - argument: '**'
286
293
  delete_after: '#'
287
294
  camelize: true
288
295
  add_suffix: Controller
296
+ split: '::'
289
297
  - name: delegate
298
+ has_argument:
299
+ at: prefix
300
+ has_value: true
290
301
  defines:
291
302
  - argument: '*'
292
- if:
293
- has_argument:
294
- keyword: prefix
295
- value: true
296
303
  add_prefix:
297
- from_argument: to
298
- joiner: '_'
304
+ argument: to
305
+ add_suffix: '_'
306
+ calls:
307
+ - argument: to
308
+ - argument: '*'
309
+ - name: delegate
310
+ has_argument:
311
+ at: prefix
312
+ has_value_type: [String, Symbol]
313
+ defines:
299
314
  - argument: '*'
300
- if:
301
- has_argument:
302
- keyword: prefix
303
- value:
304
- type: [String, Symbol]
305
315
  add_prefix:
306
- from_argument: prefix
307
- joiner: '_'
316
+ argument: prefix
317
+ add_suffix: '_'
308
318
  calls:
309
319
  - argument: to
310
320
  - argument: '*'
311
- if:
312
- has_argument: prefix
321
+ - name: delegate
322
+ unless:
323
+ has_argument:
324
+ - at: prefix
325
+ has_value: true
326
+ - at: prefix
327
+ has_value_type: [String, Symbol]
328
+ calls:
329
+ - argument: to
313
330
  - name:
314
331
  - resource
315
332
  - resources
@@ -318,28 +335,31 @@ rules:
318
335
  - argument: controller
319
336
  camelize: true
320
337
  add_suffix: Controller
338
+ split: '::'
321
339
  - name:
322
340
  - resources
323
341
  - controller
324
342
  - namespace
325
343
  calls:
326
- - argument: 1
344
+ - argument: 0
327
345
  camelize: true
328
346
  add_suffix: Controller
347
+ split: '::'
329
348
  - name: accepts_nested_attributes_for
330
349
  defines:
331
350
  argument: '*'
332
- linked_transforms:
351
+ transforms:
333
352
  - add_suffix: _attributes
334
353
  - add_suffix: _attributes=
335
354
  calls:
336
355
  argument: reject_if
337
356
  - name: resource
338
357
  calls:
339
- - argument: 1
358
+ - argument: 0
340
359
  camelize: true
341
360
  pluralize: true
342
361
  add_suffix: Controller
362
+ split: '::'
343
363
  - name:
344
364
  - new
345
365
  - create
@@ -348,16 +368,17 @@ rules:
348
368
  - update!
349
369
  - assign_attributes
350
370
  calls:
351
- keys: '*'
371
+ keyword: '**'
352
372
  add_suffix: '='
353
373
  - name: permit
354
374
  calls:
355
375
  arguments: ['*', '**']
356
- keys: '*'
376
+ keywords: '**'
357
377
  add_suffix: "="
378
+ recursive: true
358
379
  - name: layout
359
380
  calls:
360
- argument: 1
381
+ argument: 0
361
382
  - name:
362
383
  - includes
363
384
  - preload
@@ -367,7 +388,7 @@ rules:
367
388
  - left_outer_joins
368
389
  calls:
369
390
  arguments: ['*', '**']
370
- keys: '*'
391
+ keywords: '**'
371
392
  - name:
372
393
  - string
373
394
  - text
@@ -383,7 +404,7 @@ rules:
383
404
  - boolean
384
405
  path: /db/schema.rb
385
406
  calls:
386
- argument: 1
407
+ argument: 0
387
408
  transforms:
388
409
  - original
389
410
  - add_suffix: '='
@@ -393,9 +414,8 @@ rules:
393
414
  - mattr_accessor
394
415
  defines:
395
416
  - argument: '*'
396
- transforms:
397
- - original
398
- - add_suffix: '='
417
+ - argument: '*'
418
+ add_suffix: '='
399
419
  calls:
400
420
  - argument: '*'
401
421
  add_prefix: '@'
@@ -418,10 +438,9 @@ rules:
418
438
  - thread_cattr_accessor
419
439
  - thread_mattr_accessor
420
440
  defines:
421
- argument: '*'
422
- transforms:
423
- - original
424
- - add_suffix: '='
441
+ - argument: '*'
442
+ - argument: '*'
443
+ add_suffix: '='
425
444
  - name:
426
445
  - thread_cattr_reader
427
446
  - thread_mattr_reader
@@ -435,4 +454,4 @@ rules:
435
454
  add_suffix: '='
436
455
  - name: delegate_missing_to
437
456
  calls:
438
- argument: 1
457
+ argument: 0