V Tue, 17 Dec 2019 16:53:04 +0100
Stefan Hundhammer <shundham...@suse.de> napsáno:

> 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 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+unsubscr...@opensuse.org
To contact the owner, e-mail: yast-devel+ow...@opensuse.org

Reply via email to