tech_memo / Tools / cloc


tech_memo

概要

  • ソースのdiffのサマリをとるツール

Install

  • cloc自体は、epelからyumで取得できるが、依存pkgのperl-Algorithm-Diffが、RHEL-5系のリポジトリにしか存在しない。(cloc自体は、RHEL-6系のリポジトリにしかない)
  • ひとまず、依存PKGごと、sv11の以下の場所に置いておく
    [root@sv11 cloc]# pwd
    /root/work/cloc
    [root@sv11 cloc]# ll
    total 304
    -rw-r--r-- 1 root root  77932 May 16  2013 cloc-1.58-4.el6.noarch.rpm
    -rw-r--r-- 1 root root  46272 Jan  5  2010 perl-Algorithm-Diff-1.1902-1.el5.rf.noarch.rpm
    -rw-r--r-- 1 root root 171602 Nov 11  2010 perl-Regexp-Common-2010010201-2.el6.rf.noarch.rpm

使用方法

ディレクトリ配下のソースの総ライン数

  • 各ソースフォーマットごとにも出力される
    [soapui@sv15 tmp]$ cloc soapui-scripts-head/
         296 text files.
         295 unique files.
           1 file ignored.
    
    http://cloc.sourceforge.net v 1.58  T=1.0 s (294.0 files/s, 24306.0 lines/s)
    -------------------------------------------------------------------------------
    Language                     files          blank        comment           code
    -------------------------------------------------------------------------------
    Groovy                         293           3470            395          20421
    Perl                             1              2              0             18
    -------------------------------------------------------------------------------
    SUM:                           294           3472            395          20439
    -------------------------------------------------------------------------------

2つのディレクトリ配下の差分を取得する例

  • 以下は、Headリビジョンと、それ以前のリビジョンのsoapui-scriptsの比較
    [soapui@sv15 tmp]$ ls
    soapui-scripts-head  soapui-scripts-r65247
    
    [soapui@sv15 tmp]$ cloc --diff soapui-scripts-r65247/ soapui-scripts-head/
         294 text files.
         296 text files.
           2 files ignored.
    
    http://cloc.sourceforge.net v 1.58  T=3.0 s (0.3 files/s, 0.3 lines/s)
    -------------------------------------------------------------------------------
    Language                     files          blank        comment           code
    -------------------------------------------------------------------------------
    Perl
     same                            1              0              0             18
     modified                        0              0              0              0
     added                           0              0              0              0
     removed                         0              0              0              0
    Groovy
     same                          290              0            395          20366
     modified                        1              0              0             13
     added                           2             15              0             42
     removed                         0              0              0              2
    -------------------------------------------------------------------------------
    SUM:
     same                          291              0            395          20384
     modified                        1              0              0             13
     added                           2             15              0             42
     removed                         0              0              0              2
    -------------------------------------------------------------------------------

最新の20件

2023-01-26 2022-11-11 2022-03-02 2022-02-03 2021-11-18 2021-11-11 2021-10-27 2021-10-04 2021-09-30 2021-08-24 2021-04-01 2021-02-25 2020-08-13 2020-05-22 2020-04-16 2020-04-15 2020-03-23 2020-03-12 2020-02-27

今日の6件

  • counter: 229
  • today: 1
  • yesterday: 0
  • online: 1