Sunday, June 01, 2014

Ruby Science Book Notes

Code Reviews

1. Use git diff and --patch to examine code before commit.
2. Push your feature branch and invite your teammates to review the changes via git diff origin/master..HEAD
3. Share your best refactoring ideas with them.
4. Refactor for readability first.


1. Flog : Detect complexity

Example :
$ flog app lib

flog score of 10 or higher : Method may be too long
A class with a flog score of 50 is a large class that might need refactoring.

$ flog -a app/models/question.rb

2. Flay : Find duplication
3. Reek : Find bad code
4. Churn : Find files with high churn rate
5. MetricFu : Analyze application

Take a look at Code Climate.