前言
分享一個(gè)小工具 , 可以用來查看到你項(xiàng)目中的代碼數(shù)量 , 滿足一些童鞋的好奇心 , 當(dāng)然在做項(xiàng)目匯報(bào)的時(shí)候也可以有所幫助.
介紹
CLOC (Count Line of Code)
點(diǎn)擊名稱即可下載
輸出效果 (以我的項(xiàng)目為例):
2020 text files.
1761 unique files.
530 files ignored.
http://cloc.sourceforge.net v 1.64 T=10.74 s (138.9 files/s, 20711.8 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Objective C 626 56238 15635 94476
C/C++ Header 730 12683 19977 14469
Objective C++ 17 827 302 3682
JSON 112 0 0 2464
C++ 1 164 156 754
Swift 1 36 30 322
Bourne Shell 2 22 10 185
HTML 2 11 0 98
Javascript 1 0 1 4
-------------------------------------------------------------------------------
SUM: 1492 69981 36111 116454
-------------------------------------------------------------------------------
CLOC支持的文件格式:
ABAP (abap)
ActionScript (as)
Ada (ada, adb, ads, pad)
ADSO/IDSM (adso)
AMPLE (ample, dofile, startup)
Ant (build.xml)
Apex Trigger (trigger)
Arduino Sketch (ino, pde)
ASP (asa, asp)
ASP.Net (asax, ascx, asmx, aspx, config, master, sitemap, webinfo)
Assembly (asm, S, s)
AutoHotkey (ahk)
awk (awk)
Bourne Again Shell (bash)
Bourne Shell (sh)
C (c, ec, pgc)
C Shell (csh, tcsh)
C# (cs)
C++ (C, c++, cc, cpp, cxx, pcc)
C/C++ Header (H, h, hh, hpp)
CCS (ccs)
Clojure (clj)
ClojureScript (cljs)
CMake (cmake, CMakeLists.txt)
COBOL (CBL, cbl, cob, COB)
CoffeeScript (coffee)
ColdFusion (cfm)
ColdFusion CFScript (cfc)
CSS (css)
CUDA (cu)
Cython (pyx)
D (d)
DAL (da)
Dart (dart)
DOS Batch (bat, BAT, btm, BTM, cmd, CMD)
DTD (dtd)
ECPP (ecpp)
Erlang (erl, hrl)
Expect (exp)
F# (fs, fsi)
Focus (focexec)
Fortran 77 (F, f, F77, f77, pfo)
Fortran 90 (F90, f90)
Fortran 95 (F95, f95)
Go (go)
Grails (gsp)
Groovy (gant, groovy)
Haml (haml)
Handlebars (handlebars, hbs)
Harbour (hb)
Haskell (hs, lhs)
HLSL (cg, cginc, shader)
HTML (htm, html)
IDL (idl, pro)
InstallShield (ism)
Java (java)
Javascript (js)
JavaServer Faces (jsf, xhtml)
JCL (jcl)
JSON (json)
JSP (jsp, jspf)
Kermit (ksc)
Korn Shell (ksh)
Kotlin (kt)
LESS (less)
lex (l)
Lisp (el, jl, lisp, lsp, sc)
Lisp/OpenCL (cl)
LiveLink OScript (oscript)
Lua (lua)
m4 (ac, m4)
make (am, gnumakefile, Gnumakefile, Makefile, makefile)
MATLAB (m)
Maven (pom, pom.xml)
Modula3 (i3, ig, m3, mg)
MSBuild script (csproj, vbproj, vcproj, wdproj, wixproj)
MUMPS (mps, m)
Mustache (mustache)
MXML (mxml)
NAnt script (build)
NASTRAN DMAP (dmap)
Objective C (m)
Objective C++ (mm)
OCaml (ml, mli, mll, mly)
Oracle Forms (fmt)
Oracle Reports (rex)
Pascal (dpr, p, pas)
Pascal/Puppet (pp)
Patran Command Language (pcl, ses)
Perl (perl, PL, pl, plh, plx, pm)
PHP (php, php3, php4, php5)
PHP/Pascal (inc)
Pig Latin (pig)
PL/I (pl1)
PowerShell (ps1)
Python (py)
QML (qml)
R (R)
Racket (rkt, rktl, sch, scm, scrbl, ss)
Razor (cshtml)
Rexx (rexx)
RobotFramework (tsv)
Ruby (rake, rb)
Ruby HTML (rhtml)
Rust (rs)
SASS (sass, scss)
Scala (scala)
sed (sed)
SKILL (il)
SKILL++ (ils)
Smarty (smarty, tpl)
Softbridge Basic (sbl, SBL)
SQL (psql, sql, SQL)
SQL Data (data.sql)
SQL Stored Procedure (spc.sql, spoc.sql, sproc.sql, udf.sql)
Swift (swift)
Tcl/Tk (itk, tcl, tk)
Teamcenter met (met)
Teamcenter mth (mth)
TypeScript (ts)
Unity-Prefab (mat, prefab)
Vala (vala)
Vala Header (vapi)
Velocity Template Language (vm)
Verilog-SystemVerilog (sv, svh, v)
VHDL (vhd, VHD, VHDL, vhdl)
vim script (vim)
Visual Basic (bas, cls, ctl, dsr, frm, vb, VB, vba, VBA, vbs, VBS)
Visualforce Component (component)
Visualforce Page (page)
Windows Message File (mc)
Windows Module Definition (def)
Windows Resource File (rc, rc2)
WiX include (wxi)
WiX source (wxs)
WiX string localization (wxl)
XAML (xaml)
xBase (prg)
xBase Header (ch)
XML (XML, xml)
XQuery (xq, xquery)
XSD (xsd, XSD)
XSLT (xsl, XSL, xslt, XSLT)
yacc (y)
YAML (yaml, yml)
使用
首先下載cloc.pl 只有一個(gè)perl文件 , 下載后就可以直接使用了.
下載好后你會(huì)得到這樣一個(gè)東東 , 不要在意名字 , cloc -版本號(hào).pl
下面打開終端 , cd 到這個(gè)文件的目錄 , 輸入以下命令就可以查看到你的代碼信息了:
perl cloc-對(duì)應(yīng)的版本號(hào).pl 你要查詢的工程路徑
舉個(gè)例子:
perl cloc-1.64.pl /Users/LEE/Desktop/LEEAlert
執(zhí)行命令后 就可以看到你想要的結(jié)果了.
內(nèi)容我就不一一介紹了 大家都看得懂.
執(zhí)行下面命令可以查看CLOC所有支持的語言:
perl cloc-1.64.pl --show-lang
執(zhí)行結(jié)果上面也有介紹的 , 常用的使用方法就介紹到這里 , 更多的使用方法可以到官網(wǎng)里面找.
我是LEE , 一枚有信仰的果粉Coder , 如果喜歡記得關(guān)注哦 親 ~ 么了個(gè)噠 ?