git blameã«ããSRPï¼åä¸è²¬ä»»ååï¼ã®å®éå
ã¯ããã«
ã½ã¼ã¹ã³ã¼ããéç解æãããã¨ã§SRPï¼åä¸è²¬ä»»ååï¼ãå®éçã«ç®åºãã¾ãï¼*1
svn blameã«ããSRPç®åº*2ãåèã«ãgit blameã«ããç®åºãshã§è¡ã£ã¦ã¿ã¾ããï¼
ãã®SRPå¤ãæ大ã®ã¢ã¸ã¥ã¼ã«ãçæ§ã¢ã¸ã¥ã¼ã«ã«ç¸å½ãã¾ãï¼
# åä¸è²¬åæ§ã®éåææ°ï¼SRPï¼ # SRPï¼Rï¼Uï¼((L/100)ï¼5) # Rï¼ä¿®æ£ãªãã¸ã§ã³ã®ã¦ãã¼ã¯æ° # Uï¼ä¿®æ£ã¦ã¼ã¶ã®ã¦ãã¼ã¯æ° # Lï¼ã¢ã¸ã¥ã¼ã«ã®ã©ã¤ã³æ° function get_SRP() { local target_filepath=$1 echo $(( \ $(git --no-pager blame --line-porcelain $target_filepath | sed -n 's/^summary //p' | sort | uniq -c | sort -rn | wc -l) + \ $(git --no-pager blame --line-porcelain $target_filepath | sed -n 's/^author //p' | sort | uniq -c | sort -rn | wc -l) + \ ( $(cat $target_filepath | wc -l) / 100 - 5) \ )) $target_filepath } # SRPãé ·ãé ï¼å¤§ããé ï¼ã« "SRP ãã¡ã¤ã«å" ãæ¨æºåºå for file in `git ls-files app lib config vendor script | grep -E '\.rb$'`; do get_SRP $file done | sort -k1,1 -nr
â»ããã§ã¯railsã®ãªãã¸ããªã対象ã«ããããï¼rbãã¡ã¤ã«ã対象ã«ãã¦ãã¾ããï¼å¥è¨èªã§ãå ¨ãåæ§ã«æ±ãã¾ãï¼
é¢é£ããéå»è¨äº
*1:éç解æã¨ãããã¨ãã£ãããã£ãããã¾ããï¼ãã£ã¦ããã¨ã¯ã¨ã¦ãåç´ã§ãï¼
*2:第8åãPerlã«ãã大è¦æ¨¡ã·ã¹ãã éçºã»è¨è¨ã®ããï¼3ï¼ï¼Perl Hackers Hubï½gihyo.jp ⦠æè¡è©è«ç¤¾ - http://gihyo.jp/dev/serial/01/perl-hackers-hub/000803