rails_best_practices
https://github.com/flyerhzm/rails_best_practices
Ruby
a code metric tool for rails projects
RailsBestPractices::Reviews::ReplaceComplexCreationWithFactoryMethodReview#check_variable_save
check the call node to see if it is with message "save" or "save!", and the count attribute assignment on the receiver of the call node is greater than @assign_count defined, then it is a complex creation, should be replaced with factory method.
Edit
git clone [email protected]:flyerhzm/rails_best_practices.git
cd rails_best_practices
open lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-RailsBestPractices--Reviews--ReplaceComplexCreationWithFactoryMethodReview-check_variable_save-for-pr
# Commit to gitgit add lib/rails_best_practices/reviews/replace_complex_creation_with_factory_method_review.rbgit commit -m "better docs for RailsBestPractices::Reviews::ReplaceComplexCreationWithFactoryMethodReview#check_variable_save"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-RailsBestPractices--Reviews--ReplaceComplexCreationWithFactoryMethodReview-check_variable_save-for-pr
hub pull-request
# Celebrate!