Class: RailsBestPractices::Reviews::RemoveEmptyHelpersReview
- Inherits:
-
Review
- Object
- Core::Check
- Review
- RailsBestPractices::Reviews::RemoveEmptyHelpersReview
- Defined in:
- lib/rails_best_practices/reviews/remove_empty_helpers_review.rb
Overview
Review a helper file to make sure it is not an empty moduel.
See the best practice details here rails-bestpractices.com/posts/72-remove-empty-helpers.
Implementation:
Review process:
check all helper files, if the body of module is nil, then the helper file should be removed.
Constant Summary
Constants inherited from Core::Check
Core::Check::CONTROLLER_FILES, Core::Check::HELPER_FILES, Core::Check::MAILER_FILES, Core::Check::MIGRATION_FILES, Core::Check::MODEL_FILES, Core::Check::NODE_TYPES, Core::Check::PARTIAL_VIEW_FILES, Core::Check::ROUTE_FILE, Core::Check::SCHEMA_FILE, Core::Check::VIEW_FILES
Instance Attribute Summary
Attributes inherited from Core::Check
Instance Method Summary collapse
- #interesting_files ⇒ Object
- #interesting_nodes ⇒ Object
-
#start_module(module_node) ⇒ Object
check the body of module node, if it is nil, then it should be removed.
- #url ⇒ Object
Methods inherited from Review
#equal?, #model_associations, #model_attributes, #models, #remember_variable_use_count, #reset_variable_use_count, #variable, #variable_use_count
Methods inherited from Core::Check
#add_error, #initialize, #method_missing, #node_end, #node_start
Constructor Details
This class inherits a constructor from RailsBestPractices::Core::Check
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RailsBestPractices::Core::Check
Instance Method Details
#interesting_files ⇒ Object
19 20 21 |
# File 'lib/rails_best_practices/reviews/remove_empty_helpers_review.rb', line 19 def interesting_files HELPER_FILES end |
#interesting_nodes ⇒ Object
23 24 25 |
# File 'lib/rails_best_practices/reviews/remove_empty_helpers_review.rb', line 23 def interesting_nodes [:module] end |
#start_module(module_node) ⇒ Object
check the body of module node, if it is nil, then it should be removed.
28 29 30 |
# File 'lib/rails_best_practices/reviews/remove_empty_helpers_review.rb', line 28 def start_module(module_node) add_error "remove empty helpers" if module_node.body.is_a?(Core::Nil) end |
#url ⇒ Object
15 16 17 |
# File 'lib/rails_best_practices/reviews/remove_empty_helpers_review.rb', line 15 def url "http://rails-bestpractices.com/posts/72-remove-empty-helpers" end |