[yast-devel] Tool to count LOC

Hi guys, I just would like to inform you about interesting tool. Today I want to answer some email about yast and need to know what is current state of LOC of YaST. So I do a bit search as output of find and wc -l was not enough for me. And found interesting tool cloc[1]. I install it with npm method with `sudo npm install -g cloc`. And how looks output now for yast (my own checkout without snapper, libstorage-ng and some others)? like this ( sorry for broken formating, but email are not perfect for ascii output ). I expect many HTML is generated doc, btw our biggest ruby file is [2]: jreidinger@linux-vvcf:~/prace/yast> cloc . 16111 text files. 14565 unique files. 5948 files ignored. github.com/AlDanial/cloc v 1.85 T=20.84 s (515.5 files/s, 132408.6 lines/s) -------------------------------------------------------------------------------- Language files blank comment code -------------------------------------------------------------------------------- HTML 1628 468135 1247 705188 Ruby 4281 104886 150083 573752 C++ 726 40778 31679 143555 XML 359 3236 5807 97274 Python 280 3174 2397 61881 Perl 188 10166 7772 45276 YAML 676 2259 1381 40101 Markdown 361 10707 1 34282 C/C++ Header 640 18259 38038 30950 JSON 9 0 0 24797 SVG 281 76 170 14525 Sass 100 1595 1889 8431 C 31 1261 474 6648 TeX 59 1575 85 6423 make 360 2520 1825 6372 CMake 140 769 631 4332 diff 96 933 3028 4257 Bourne Again Shell 68 830 2009 4252 XSLT 21 569 531 3922 CSS 17 546 302 3785 JavaScript 65 504 382 3658 Bourne Shell 192 808 1232 2910 SWIG 24 288 169 1647 Cucumber 18 159 13 1254 Expect 52 504 440 1218 Qt 5 0 0 1077 Lisp 4 49 56 412 vim script 2 31 36 381 Dockerfile 47 47 24 290 ERB 7 31 20 173 m4 2 26 7 117 XSD 1 0 0 95 Tcl/Tk 1 22 32 57 PO File 2 5 16 40 Clojure 1 4 0 9 -------------------------------------------------------------------------------- SUM: 10744 674752 251776 1833341 -------------------------------------------------------------------------------- [1] https://github.com/AlDanial/cloc [2] https://github.com/yast/yast-ycp-ui-bindings/blob/master/examples/Tree-recur... -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org

On 17.12.19 11:04, Josef Reidinger wrote:
Ruby 4281 104886 150083 573752 C++ 726 40778 31679 143555
I was tempted to calculate the ratio of real lines of code vs. comment lines (ignoring blank lines): comment_ratio = comment_lines / (total_lines - blank_lines) Then I realized that we have that license header in each file which greatly distorts such a ratio: That legalese is also considered comment lines. Each file has a legalese header. But Ruby files tend to be a lot smaller, so there are more percent of legalese lines. so... comment_ratio = (comment_lines - legalese_lines) / (total_lines - blank_lines - legalese_lines) Any chance of figuring out the real sizes without the legalese? I am really curious how well documented our stuff is. Kind regards -- Stefan Hundhammer <shundhammer@suse.de> YaST Developer SUSE Software Solutions Germany GmbH Geschäftsführer: Felix Imendörffer HRB 36809 (AG Nürnberg) Maxfeldstr. 5, 90409 Nürnberg, Germany -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org

V Tue, 17 Dec 2019 16:53:04 +0100 Stefan Hundhammer <shundhammer@suse.de> napsáno:
I am not sure if that tool support e.g. plugin so we can extend it by some trick to recognize that legalese lines.
I am really curious how well documented our stuff is.
Well, not sure if we can measure quality of documentation (I worry we will need to test it on real people), but we can easily for ruby code measure quantity of documented public interfaces. yardoc itself support it and you can define in Rakefile threshold to ensure that it does not lower[1]. Output looks like: jreidinger@linux-vvcf:~/prace/yast/bootloader> rake check:doc /usr/bin/yardoc Generating documentation... Files: 38 Modules: 3 ( 2 undocumented) Classes: 66 ( 7 undocumented) Constants: 32 ( 27 undocumented) Attributes: 25 ( 0 undocumented) Methods: 299 ( 166 undocumented) 52.47% documented There are even some services that can be attached to github repo that generate more precise output[2]. So definitively we have a ways to measure it and what is the best, we do not need to write it ourself :) Josef [1] https://github.com/yast/yast-bootloader/blob/master/Rakefile#L11 [2] https://inch-ci.org/github/yast/yast-bootloader
Kind regards
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org

On 12/17/19 4:41 PM, Josef Reidinger wrote:
And for c++, maybe coverxygen [1] could help (if doxygen was used for documenting the code). [1] https://github.com/psycofdj/coverxygen -- José Iván López González YaST Team at SUSE LINUX GmbH IRC: jilopez -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org
participants (3)
-
Josef Reidinger
-
José Iván López González
-
Stefan Hundhammer