Wrote a code statistics tool

Source: Internet
Author: User

Weekend want to statistics xcl-charts exactly how many lines of code, the go language to write a code statistics tool, the effect is good, statistical speed is also fast.

The statistical report part of the perfect today, abruptly the very short code Peng rose to more than 200 lines.

In addition to the required number of lines of code and file totals, the number of code files with 300,500,1000,5000 and more than 5000 of these levels has been added to the statistics function.

At the same time, the user can specify all the file details that show the number of lines of code greater than or equal to a value, arranged in large to small order.

Paste the effect:

E:\xcltools\src\crname>go run scounter.go-l=600-i. Java E:\GITHUB\GITHUB\XCL-CHARTS\XCL-CHARTS\SRC Code Statistics Rollup ( 2014-12-22 22:20:47) ================================================= Analysis root directory: E:\GitHub\GitHub\XCL-Charts\ XCL-CHARTS\SRC code lines: Number of files-------------------------------------------------line <= 300:92-<= 500:13  <= 1000:6 line <= 5000:0 lines > 5000:0-------------------------------------------------code row total: 18214         Comment Line total: 7068 analysis files: 111 line of code (>= 600) file details: Line of code comment line file name-------------------------------------------------987          154. \org\xclcharts\renderer\axeschart.java 620. \org\xclcharts\chart\areachart.java 615 \org\xclcharts\renderer\plot\plotlegendrender.java 610 \org\xclcharts\chart\barchart.java---- Number of---------------------------------------------files: 4elapsed 1.744222 seconds
Under Linux, I added a color effect to highlight the stats.

Above the Xcl-charts library I wrote 18214 lines of valid Java code, compared to the Microsoft Casablanca Library, then the powerful C + + SDK Library,

will be nearly 7k C + + code ...

e:\xcltools\src\crname> scounter-l=700  -I=.C,.CPP,.H,.HPPD:\CASABLANCA1027\RELEASE\SRC Code Statistics Rollup (2014-12-22 21:26:54) ================================================= Analysis root directory: D:\CASABLANCA1027\RELEASE\SRC code lines     : Number of files-------------------------------------------------line <=  : 9 line <=  £ º 6 line <= 1000:2 Li NE <= 5000:2 line >  0-------------------------------------------------code lines total: 6981  Comment Line total: 1688 analysis file Number: 19 lines of code (>= 700) file details: line of   code    Comment line file    name-------------------------------------------------  1489    \json\json.cpp         825    . \http\client\http_ Client.cpp-------------------------------------------------             number of files: 2elapsed 1.027630 seconds
As can be seen from the above example, after-I plus a variety of extensions, you can put the specified extension of the file together statistics, can also be cross-language statistics, such as-i=.cpp,.go,.java.

Attached command Description:

[Email protected]:~/xclcounter$./scountername:  scounter <path> Statistics Code lines options:  -i= "": Files that contain only the specified extension, such as:. JAVA,.CPP,.H), the non-input contains all.  -v=false: Whether to display file statistics details.  -l=0: Lists file information that is greater than or equal to the specified number of rows (0 is not logged) on the statistic results. EXAMPLE:  scounter-i. java c:\xclcharts\xclcharts\src  scounter-i=.cpp,.h,.hpp,.c/xclproject/src  Scounter-i. go-v=false/usr/local/go/src  scounter-l=680-i=.cpp,.h,.hpp,.c  /xclproject/common/srcauthor:  

This kind of thing in the go language is actually very good to write, plus code processing to filter out multiple lines of code comments, combined with the file traversal and channel, a bit out.

Finally I put Xcl-charts's library and demo project code together, a total of 32379 lines of code, at first really buried a good freshman pit, make now are still in pits ...


Tool Download: Click here


MAIL: [Email protected]

blog:http://blog.csdn.net/xcl168





Wrote a code statistics tool

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.