rails_best_practices 1.19.3 → 1.19.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -1
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +0 -4
  5. data/Gemfile.lock +120 -0
  6. data/README.md +4 -1
  7. data/lib/rails_best_practices.rb +2 -0
  8. data/lib/rails_best_practices/analyzer.rb +5 -4
  9. data/lib/rails_best_practices/cli.rb +22 -0
  10. data/lib/rails_best_practices/command.rb +1 -131
  11. data/lib/rails_best_practices/core/check.rb +24 -23
  12. data/lib/rails_best_practices/core/checks_loader.rb +17 -18
  13. data/lib/rails_best_practices/core/methods.rb +9 -8
  14. data/lib/rails_best_practices/core/model_associations.rb +1 -1
  15. data/lib/rails_best_practices/core/runner.rb +38 -38
  16. data/lib/rails_best_practices/option_parser.rb +140 -0
  17. data/lib/rails_best_practices/prepares/controller_prepare.rb +8 -14
  18. data/lib/rails_best_practices/prepares/gemfile_prepare.rb +1 -1
  19. data/lib/rails_best_practices/prepares/initializer_prepare.rb +3 -3
  20. data/lib/rails_best_practices/prepares/mailer_prepare.rb +1 -1
  21. data/lib/rails_best_practices/prepares/model_prepare.rb +13 -13
  22. data/lib/rails_best_practices/prepares/route_prepare.rb +16 -15
  23. data/lib/rails_best_practices/prepares/schema_prepare.rb +1 -1
  24. data/lib/rails_best_practices/reviews/add_model_virtual_attribute_review.rb +25 -23
  25. data/lib/rails_best_practices/reviews/always_add_db_index_review.rb +73 -72
  26. data/lib/rails_best_practices/reviews/check_destroy_return_value_review.rb +2 -1
  27. data/lib/rails_best_practices/reviews/check_save_return_value_review.rb +4 -3
  28. data/lib/rails_best_practices/reviews/default_scope_is_evil_review.rb +1 -1
  29. data/lib/rails_best_practices/reviews/dry_bundler_in_capistrano_review.rb +1 -1
  30. data/lib/rails_best_practices/reviews/hash_syntax_review.rb +11 -11
  31. data/lib/rails_best_practices/reviews/isolate_seed_data_review.rb +8 -8
  32. data/lib/rails_best_practices/reviews/keep_finders_on_their_own_model_review.rb +5 -5
  33. data/lib/rails_best_practices/reviews/law_of_demeter_review.rb +20 -19
  34. data/lib/rails_best_practices/reviews/move_code_into_controller_review.rb +3 -3
  35. data/lib/rails_best_practices/reviews/move_code_into_helper_review.rb +5 -5
  36. data/lib/rails_best_practices/reviews/move_finder_to_named_scope_review.rb +5 -5
  37. data/lib/rails_best_practices/reviews/needless_deep_nesting_review.rb +13 -13
  38. data/lib/rails_best_practices/reviews/not_rescue_exception_review.rb +1 -1
  39. data/lib/rails_best_practices/reviews/not_use_default_route_review.rb +2 -2
  40. data/lib/rails_best_practices/reviews/not_use_time_ago_in_words_review.rb +1 -1
  41. data/lib/rails_best_practices/reviews/overuse_route_customizations_review.rb +3 -3
  42. data/lib/rails_best_practices/reviews/protect_mass_assignment_review.rb +32 -32
  43. data/lib/rails_best_practices/reviews/remove_empty_helpers_review.rb +4 -4
  44. data/lib/rails_best_practices/reviews/remove_unused_methods_in_controllers_review.rb +14 -14
  45. data/lib/rails_best_practices/reviews/remove_unused_methods_in_helpers_review.rb +6 -6
  46. data/lib/rails_best_practices/reviews/remove_unused_methods_in_models_review.rb +15 -15
  47. data/lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb +8 -8
  48. data/lib/rails_best_practices/reviews/restrict_auto_generated_routes_review.rb +71 -70
  49. data/lib/rails_best_practices/reviews/review.rb +2 -1
  50. data/lib/rails_best_practices/reviews/simplify_render_in_controllers_review.rb +1 -1
  51. data/lib/rails_best_practices/reviews/simplify_render_in_views_review.rb +11 -11
  52. data/lib/rails_best_practices/reviews/use_before_filter_review.rb +12 -9
  53. data/lib/rails_best_practices/reviews/use_model_association_review.rb +10 -10
  54. data/lib/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review.rb +14 -13
  55. data/lib/rails_best_practices/reviews/use_observer_review.rb +20 -20
  56. data/lib/rails_best_practices/reviews/use_parentheses_in_method_def_review.rb +6 -6
  57. data/lib/rails_best_practices/reviews/use_query_attribute_review.rb +44 -41
  58. data/lib/rails_best_practices/reviews/use_say_with_time_in_migrations_review.rb +7 -7
  59. data/lib/rails_best_practices/reviews/use_scope_access_review.rb +14 -14
  60. data/lib/rails_best_practices/reviews/use_turbo_sprockets_rails3_review.rb +1 -1
  61. data/lib/rails_best_practices/version.rb +1 -1
  62. data/rails_best_practices.gemspec +8 -8
  63. data/spec/rails_best_practices/analyzer_spec.rb +4 -4
  64. data/spec/rails_best_practices/core/error_spec.rb +6 -3
  65. data/spec/rails_best_practices/lexicals/long_line_check_spec.rb +21 -21
  66. data/spec/rails_best_practices/prepares/gemfile_prepare_spec.rb +15 -15
  67. data/spec/rails_best_practices/prepares/route_prepare_spec.rb +17 -15
  68. data/spec/rails_best_practices/reviews/hash_syntax_review_spec.rb +4 -4
  69. data/spec/rails_best_practices/reviews/law_of_demeter_review_spec.rb +8 -8
  70. data/spec/rails_best_practices/reviews/move_code_into_model_review_spec.rb +6 -6
  71. data/spec/rails_best_practices/reviews/protect_mass_assignment_review_spec.rb +4 -2
  72. data/spec/rails_best_practices/reviews/remove_unused_methods_in_controllers_review_spec.rb +6 -4
  73. data/spec/rails_best_practices/reviews/remove_unused_methods_in_helpers_review_spec.rb +8 -6
  74. data/spec/rails_best_practices/reviews/remove_unused_methods_in_models_review_spec.rb +16 -14
  75. data/spec/rails_best_practices/reviews/replace_instance_variable_with_local_variable_review_spec.rb +4 -4
  76. data/spec/rails_best_practices/reviews/use_multipart_alternative_as_content_type_of_email_review_spec.rb +14 -14
  77. data/spec/rails_best_practices/reviews/use_parentheses_in_method_def_review_spec.rb +1 -1
  78. data/spec/rails_best_practices/reviews/use_turbo_sprockets_rails3_review_spec.rb +51 -51
  79. metadata +5 -2
@@ -58,17 +58,17 @@ module RailsBestPractices
58
58
  # check assignment node,
59
59
  # if the right vavlue is a method_add_arg node with message "new",
60
60
  # then remember the left value as new variable.
61
- def remember_new_variable(node)
62
- right_value = node.right_value
63
- if :method_add_arg == right_value.sexp_type && 'new' == right_value.message.to_s
64
- @new_variables << node.left_value.to_s
65
- end
61
+ def remember_new_variable(node)
62
+ right_value = node.right_value
63
+ if right_value.sexp_type == :method_add_arg && right_value.message.to_s == 'new'
64
+ @new_variables << node.left_value.to_s
66
65
  end
66
+ end
67
67
 
68
68
  # see if the receiver of the call node is included in the @new_varaibles.
69
- def new_record?(node)
70
- @new_variables.include? node.receiver.to_s
71
- end
69
+ def new_record?(node)
70
+ @new_variables.include? node.receiver.to_s
71
+ end
72
72
  end
73
73
  end
74
74
  end
@@ -43,11 +43,11 @@ module RailsBestPractices
43
43
  # and the receiver of the node should be with message :call (this is the other model),
44
44
  # and any of its arguments is a hash,
45
45
  # then it is the finder of other model.
46
- def other_finder?(node)
47
- FINDERS.include?(node[1].message.to_s) &&
48
- :call == node[1].receiver.sexp_type &&
49
- node.arguments.grep_nodes_count(sexp_type: :bare_assoc_hash) > 0
50
- end
46
+ def other_finder?(node)
47
+ FINDERS.include?(node[1].message.to_s) &&
48
+ node[1].receiver.sexp_type == :call &&
49
+ node.arguments.grep_nodes_count(sexp_type: :bare_assoc_hash) > 0
50
+ end
51
51
  end
52
52
  end
53
53
  end
@@ -28,7 +28,7 @@ module RailsBestPractices
28
28
  # and the message of the receiver call node matchs one of the association name with the class name,
29
29
  # then it violates the law of demeter.
30
30
  add_callback :start_call do |node|
31
- if :call == node.receiver.sexp_type && need_delegate?(node)
31
+ if node.receiver.sexp_type == :call && need_delegate?(node)
32
32
  add_error 'law of demeter'
33
33
  end
34
34
  end
@@ -40,28 +40,29 @@ module RailsBestPractices
40
40
  # if the receiver of receiver of the call node matchs any in model names,
41
41
  # and the message of receiver of the call node matchs any in association names,
42
42
  # then it needs delegate.
43
- def need_delegate?(node)
44
- return unless variable(node)
45
- class_name = variable(node).to_s.sub('@', '').classify
46
- association_name = node.receiver.message.to_s
47
- association = model_associations.get_association(class_name, association_name)
48
- attribute_name = node.message.to_s
49
- association && ASSOCIATION_METHODS.include?(association['meta']) &&
50
- is_association_attribute?(association['class_name'], association_name, attribute_name)
51
- end
43
+ def need_delegate?(node)
44
+ return unless variable(node)
45
+
46
+ class_name = variable(node).to_s.sub('@', '').classify
47
+ association_name = node.receiver.message.to_s
48
+ association = model_associations.get_association(class_name, association_name)
49
+ attribute_name = node.message.to_s
50
+ association && ASSOCIATION_METHODS.include?(association['meta']) &&
51
+ is_association_attribute?(association['class_name'], association_name, attribute_name)
52
+ end
52
53
 
53
- def is_association_attribute?(association_class, association_name, attribute_name)
54
- if association_name =~ /able$/
55
- models.each do |class_name|
56
- if model_associations.is_association?(class_name, association_name.sub(/able$/, '')) ||
57
- model_associations.is_association?(class_name, association_name.sub(/able$/, 's'))
58
- return true if model_attributes.is_attribute?(class_name, attribute_name)
59
- end
54
+ def is_association_attribute?(association_class, association_name, attribute_name)
55
+ if association_name =~ /able$/
56
+ models.each do |class_name|
57
+ if model_associations.is_association?(class_name, association_name.sub(/able$/, '')) ||
58
+ model_associations.is_association?(class_name, association_name.sub(/able$/, 's'))
59
+ return true if model_attributes.is_attribute?(class_name, attribute_name)
60
60
  end
61
- else
62
- model_attributes.is_attribute?(association_class, attribute_name)
63
61
  end
62
+ else
63
+ model_attributes.is_attribute?(association_class, attribute_name)
64
64
  end
65
+ end
65
66
  end
66
67
  end
67
68
  end
@@ -38,9 +38,9 @@ module RailsBestPractices
38
38
  private
39
39
 
40
40
  # check if the node is a finder call node.
41
- def finder?(node)
42
- node.receiver.const? && FINDERS.include?(node.message.to_s)
43
- end
41
+ def finder?(node)
42
+ node.receiver.const? && FINDERS.include?(node.message.to_s)
43
+ end
44
44
  end
45
45
  end
46
46
  end
@@ -43,11 +43,11 @@ module RailsBestPractices
43
43
  # if the first argument is an array,
44
44
  # and the size of array is greater than @array_count you defined,
45
45
  # then it is complext.
46
- def complex_select_options?(node)
47
- 'options_for_select' == node[1].message.to_s &&
48
- :array == node.arguments.all.first.sexp_type &&
49
- node.arguments.all.first.array_size > @array_count
50
- end
46
+ def complex_select_options?(node)
47
+ node[1].message.to_s == 'options_for_select' &&
48
+ node.arguments.all.first.sexp_type == :array &&
49
+ node.arguments.all.first.array_size > @array_count
50
+ end
51
51
  end
52
52
  end
53
53
  end
@@ -35,11 +35,11 @@ module RailsBestPractices
35
35
  # and the message of call method_add_arg is one of find, all, first or last,
36
36
  # and any of its arguments is a hash,
37
37
  # then it is a finder.
38
- def finder?(node)
39
- FINDERS.include?(node[1].message.to_s) &&
40
- :call == node[1].sexp_type &&
41
- node.arguments.grep_nodes_count(sexp_type: :bare_assoc_hash) > 0
42
- end
38
+ def finder?(node)
39
+ FINDERS.include?(node[1].message.to_s) &&
40
+ node[1].sexp_type == :call &&
41
+ node.arguments.grep_nodes_count(sexp_type: :bare_assoc_hash) > 0
42
+ end
43
43
  end
44
44
  end
45
45
  end
@@ -60,21 +60,21 @@ module RailsBestPractices
60
60
  # and its message is resources or resource,
61
61
  # then check if @counter is greater than or equal to @nested_count,
62
62
  # if so, it is the needless deep nesting.
63
- def recursively_check(node)
64
- shallow = @shallow_nodes.include? node
65
- if %i[command_call command].include?(node[1].sexp_type) && %w[resources resource].include?(node[1].message.to_s)
66
- hash_node = node[1].arguments.grep_node(sexp_type: :bare_assoc_hash)
67
- shallow ||= (hash_node && 'true' == hash_node.hash_value('shallow').to_s)
68
- @counter += 1
69
- node.block_node.statements.each do |stmt_node|
70
- @shallow_nodes << stmt_node if shallow
71
- recursively_check(stmt_node)
72
- end
73
- @counter -= 1
74
- elsif %i[command_call command].include?(node.sexp_type) && %w[resources resource].include?(node.message.to_s)
75
- add_error "needless deep nesting (nested_count > #{@nested_count})", @file, node.line_number if @counter >= @nested_count && !@shallow_nodes.include?(node)
63
+ def recursively_check(node)
64
+ shallow = @shallow_nodes.include? node
65
+ if %i[command_call command].include?(node[1].sexp_type) && %w[resources resource].include?(node[1].message.to_s)
66
+ hash_node = node[1].arguments.grep_node(sexp_type: :bare_assoc_hash)
67
+ shallow ||= (hash_node && hash_node.hash_value('shallow').to_s == 'true')
68
+ @counter += 1
69
+ node.block_node.statements.each do |stmt_node|
70
+ @shallow_nodes << stmt_node if shallow
71
+ recursively_check(stmt_node)
76
72
  end
73
+ @counter -= 1
74
+ elsif %i[command_call command].include?(node.sexp_type) && %w[resources resource].include?(node.message.to_s)
75
+ add_error "needless deep nesting (nested_count > #{@nested_count})", @file, node.line_number if @counter >= @nested_count && !@shallow_nodes.include?(node)
77
76
  end
77
+ end
78
78
  end
79
79
  end
80
80
  end
@@ -18,7 +18,7 @@ module RailsBestPractices
18
18
 
19
19
  # check rescue node to see if its type is Exception
20
20
  add_callback :start_rescue do |rescue_node|
21
- if rescue_node.exception_classes.any? { |rescue_class| 'Exception' == rescue_class.to_s }
21
+ if rescue_node.exception_classes.any? { |rescue_class| rescue_class.to_s == 'Exception' }
22
22
  add_error "Don't rescue Exception", rescue_node.file, rescue_node.exception_classes.first.line_number
23
23
  end
24
24
  end
@@ -24,8 +24,8 @@ module RailsBestPractices
24
24
 
25
25
  # check all command nodes
26
26
  add_callback :start_command do |node|
27
- if 'match' == node.message.to_s &&
28
- ':controller(/:action(/:id(.:format)))' == node.arguments.all.first.to_s
27
+ if node.message.to_s == 'match' &&
28
+ node.arguments.all.first.to_s == ':controller(/:action(/:id(.:format)))'
29
29
  add_error 'not use default route'
30
30
  end
31
31
  end
@@ -17,7 +17,7 @@ module RailsBestPractices
17
17
 
18
18
  # check fcall node to see if its message is time_ago_in_words or distance_of_time_in_words_to_now
19
19
  add_callback :start_fcall do |node|
20
- if 'time_ago_in_words' == node.message.to_s || 'distance_of_time_in_words_to_now' == node.message.to_s
20
+ if node.message.to_s == 'time_ago_in_words' || node.message.to_s == 'distance_of_time_in_words_to_now'
21
21
  add_error 'not use time_ago_in_words'
22
22
  end
23
23
  end
@@ -46,9 +46,9 @@ module RailsBestPractices
46
46
  # if its receiver is with message "resources",
47
47
  # then calculate the count of call nodes, whose message is get, post, update or delete,
48
48
  # it is just the count of member and collection custom routes.
49
- def member_and_collection_count_for_rails3(node)
50
- 'resources' == node[1].message.to_s ? node.grep_nodes_count(sexp_type: :command, message: VERBS) : 0
51
- end
49
+ def member_and_collection_count_for_rails3(node)
50
+ node[1].message.to_s == 'resources' ? node.grep_nodes_count(sexp_type: :command, message: VERBS) : 0
51
+ end
52
52
  end
53
53
  end
54
54
  end
@@ -54,53 +54,53 @@ module RailsBestPractices
54
54
 
55
55
  private
56
56
 
57
- def check_activerecord_version
58
- if Prepares.gems.gem_version('activerecord').to_i > 3
59
- @mass_assignement = false
60
- end
57
+ def check_activerecord_version
58
+ if Prepares.gems.gem_version('activerecord').to_i > 3
59
+ @mass_assignement = false
61
60
  end
61
+ end
62
62
 
63
- def check_whitelist_attributes_config
64
- if 'true' == Prepares.configs['config.active_record.whitelist_attributes']
65
- @whitelist_attributes = true
66
- end
63
+ def check_whitelist_attributes_config
64
+ if Prepares.configs['config.active_record.whitelist_attributes'] == 'true'
65
+ @whitelist_attributes = true
67
66
  end
67
+ end
68
68
 
69
- def check_include_forbidden_attributes_protection_config
70
- if 'true' == Prepares.configs['railsbp.include_forbidden_attributes_protection']
71
- @mass_assignement = false
72
- end
69
+ def check_include_forbidden_attributes_protection_config
70
+ if Prepares.configs['railsbp.include_forbidden_attributes_protection'] == 'true'
71
+ @mass_assignement = false
73
72
  end
73
+ end
74
74
 
75
- def check_rails_builtin(node)
76
- if @whitelist_attributes || [node.to_s, node.message.to_s].any? { |str| %w[attr_accessible attr_protected].include? str }
77
- @mass_assignement = false
78
- end
75
+ def check_rails_builtin(node)
76
+ if @whitelist_attributes || [node.to_s, node.message.to_s].any? { |str| %w[attr_accessible attr_protected].include? str }
77
+ @mass_assignement = false
79
78
  end
79
+ end
80
80
 
81
- def check_strong_parameters(command_node)
82
- if 'include' == command_node.message.to_s && 'ActiveModel::ForbiddenAttributesProtection' == command_node.arguments.all.first.to_s
83
- @mass_assignement = false
84
- end
81
+ def check_strong_parameters(command_node)
82
+ if command_node.message.to_s == 'include' && command_node.arguments.all.first.to_s == 'ActiveModel::ForbiddenAttributesProtection'
83
+ @mass_assignement = false
85
84
  end
85
+ end
86
86
 
87
- def check_devise(command_node)
88
- if 'devise' == command_node.message.to_s
89
- @mass_assignement = false
90
- end
87
+ def check_devise(command_node)
88
+ if command_node.message.to_s == 'devise'
89
+ @mass_assignement = false
91
90
  end
91
+ end
92
92
 
93
- def check_authlogic(node)
94
- if [node.to_s, node.message.to_s].include? 'acts_as_authentic'
95
- @mass_assignement = false
96
- end
93
+ def check_authlogic(node)
94
+ if [node.to_s, node.message.to_s].include? 'acts_as_authentic'
95
+ @mass_assignement = false
97
96
  end
97
+ end
98
98
 
99
- def check_active_record(const_path_ref_node)
100
- if 'ActiveRecord::Base' != const_path_ref_node.base_class.to_s
101
- @mass_assignement = false
102
- end
99
+ def check_active_record(const_path_ref_node)
100
+ if const_path_ref_node.base_class.to_s != 'ActiveRecord::Base'
101
+ @mass_assignement = false
103
102
  end
103
+ end
104
104
  end
105
105
  end
106
106
  end
@@ -17,16 +17,16 @@ module RailsBestPractices
17
17
 
18
18
  # check the body of module node, if it is nil, then it should be removed.
19
19
  add_callback :start_module do |module_node|
20
- if 'ApplicationHelper' != module_node.module_name.to_s && empty_body?(module_node)
20
+ if module_node.module_name.to_s != 'ApplicationHelper' && empty_body?(module_node)
21
21
  add_error 'remove empty helpers'
22
22
  end
23
23
  end
24
24
 
25
25
  protected
26
26
 
27
- def empty_body?(module_node)
28
- s(:bodystmt, s(:stmts_add, s(:stmts_new), s(:void_stmt)), nil, nil, nil) == module_node.body
29
- end
27
+ def empty_body?(module_node)
28
+ s(:bodystmt, s(:stmts_add, s(:stmts_new), s(:void_stmt)), nil, nil, nil) == module_node.body
29
+ end
30
30
  end
31
31
  end
32
32
  end
@@ -71,7 +71,7 @@ module RailsBestPractices
71
71
  node.arguments.all.each { |argument| mark_publicize(argument.to_s) }
72
72
  when 'delegate'
73
73
  last_argument = node.arguments.all.last
74
- if :bare_assoc_hash == last_argument.sexp_type && 'controller' == last_argument.hash_value('to').to_s
74
+ if last_argument.sexp_type == :bare_assoc_hash && last_argument.hash_value('to').to_s == 'controller'
75
75
  controller_name = current_module_name.sub('Helper', 'Controller')
76
76
  node.arguments.all[0..-2].each { |method| mark_publicize(method.to_s, controller_name) }
77
77
  end
@@ -82,7 +82,7 @@ module RailsBestPractices
82
82
 
83
83
  # mark assignment as used, like current_user = @user
84
84
  add_callback :start_assign do |node|
85
- if :var_field == node.left_value.sexp_type
85
+ if node.left_value.sexp_type == :var_field
86
86
  call_method "#{node.left_value}=", current_class_name
87
87
  end
88
88
  end
@@ -90,7 +90,7 @@ module RailsBestPractices
90
90
  # get all unused methods at the end of review process.
91
91
  add_callback :after_check do
92
92
  @routes.each do |route|
93
- if '*' == route.action_name
93
+ if route.action_name == '*'
94
94
  action_names = @controller_methods.get_methods(route.controller_name_with_namespaces).map(&:method_name)
95
95
  action_names.each { |action_name| call_method(action_name, route.controller_name_with_namespaces) }
96
96
  else
@@ -106,19 +106,19 @@ module RailsBestPractices
106
106
 
107
107
  protected
108
108
 
109
- def methods
110
- @controller_methods
111
- end
109
+ def methods
110
+ @controller_methods
111
+ end
112
112
 
113
- def internal_except_methods
114
- %w[rescue_action default_url_options].map { |method_name| "*\##{method_name}" } +
115
- %w[Devise::OmniauthCallbacksController].map { |controller_name| "#{controller_name}#*" }
116
- end
113
+ def internal_except_methods
114
+ %w[rescue_action default_url_options].map { |method_name| "*\##{method_name}" } +
115
+ %w[Devise::OmniauthCallbacksController].map { |controller_name| "#{controller_name}#*" }
116
+ end
117
117
 
118
- def mark_publicize(method_name, class_name = current_class_name)
119
- @controller_methods.mark_publicize(class_name, method_name)
120
- @controller_methods.mark_parent_class_methods_publicize(class_name, method_name)
121
- end
118
+ def mark_publicize(method_name, class_name = current_class_name)
119
+ @controller_methods.mark_publicize(class_name, method_name)
120
+ @controller_methods.mark_parent_class_methods_publicize(class_name, method_name)
121
+ end
122
122
  end
123
123
  end
124
124
  end
@@ -34,13 +34,13 @@ module RailsBestPractices
34
34
 
35
35
  protected
36
36
 
37
- def methods
38
- @helper_methods
39
- end
37
+ def methods
38
+ @helper_methods
39
+ end
40
40
 
41
- def internal_except_methods
42
- ['*#url_for']
43
- end
41
+ def internal_except_methods
42
+ ['*#url_for']
43
+ end
44
44
  end
45
45
  end
46
46
  end
@@ -88,22 +88,22 @@ module RailsBestPractices
88
88
 
89
89
  protected
90
90
 
91
- def methods
92
- @model_methods
93
- end
91
+ def methods
92
+ @model_methods
93
+ end
94
94
 
95
- def internal_except_methods
96
- %w[
97
- initialize
98
- validate validate_each validate_on_create validate_on_update
99
- human_attribute_name assign_attributes attributes attribute
100
- to_xml to_json as_json to_param
101
- before_save before_create before_update before_destroy after_save after_create
102
- after_update after_destroy after_find after_initialize
103
- method_missing
104
- table_name module_prefix
105
- ].map { |method_name| "*\##{method_name}" }
106
- end
95
+ def internal_except_methods
96
+ %w[
97
+ initialize
98
+ validate validate_each validate_on_create validate_on_update
99
+ human_attribute_name assign_attributes attributes attribute
100
+ to_xml to_json as_json to_param
101
+ before_save before_create before_update before_destroy after_save after_create
102
+ after_update after_destroy after_find after_initialize
103
+ method_missing
104
+ table_name module_prefix
105
+ ].map { |method_name| "*\##{method_name}" }
106
+ end
107
107
  end
108
108
  end
109
109
  end