Re:Write code that is easy to delete, not easy to extend
by voltagex_ on Sunday February 14, 2016 @07:07PM
(#11100680)
What does that command do?
Re:Write code that is easy to delete, not easy to extend
by chairleader on Sunday February 14, 2016 @07:17PM
(#11100715)
By my read, it prints a list of all Ruby files in your project sorted by number of commits against them. It may take a long time to complete depending on number of files and number of commits.
YMMV, I am not a BASH shell.
Re:Write code that is easy to delete, not easy to extend
by michaelfeathers on Monday February 15, 2016 @10:24AM
(#11103804)
We put a variation of the script to music also. Seriously. It's on iTunes and Bandcamp:
https://itunes.apple.com/us/album/snippets-programming-episo...
Re:Write code that is easy to delete, not easy to extend
by voltagex_ on Sunday February 14, 2016 @07:24PM
(#11100738)
http://explainshell.com/explain?cmd=find+.+-name+%22*.rb%22+... doesn't quite get it either, but I think you're right. I'm not near a machine with Bash to check.
Re:Write code that is easy to delete, not easy to extend
by chris_wot on Sunday February 14, 2016 @10:25PM
(#11101356)
Actually, it finds all Ruby .rb files, then prints out that file every time a change was made to the file. It then does a count of each of the times the file is output, and then sorts the list with those files that were modified the most frequently being at the top, and those modified least frequently being at the bottom.
In other words, it shows (as the poster says) file churn in a Ruby codebase.
Re:Write code that is easy to delete, not easy to extend
by reportingsjr on Sunday February 14, 2016 @08:10PM
(#11100922)
It finds all of the files with the .rb extension in a directory, then feeds that in to git log --oneline. wc -l then counts how many lines resulted from git log, which basically tells you how many times each file has been modified. Lastly these numbers are sorted from largest number to lowest.
The gist of it is that you figure out which files get modified the most. This lets you know where your most frequently changed code is.
find . -name "*.rb" |xargs -n1 -I file sh -c 'echo `git log --oneline file | wc -l`: file'|sort -nr
Applying a time period window is good too as some parts of code churn for a while and them reach stability.