lightbend-labs / cloc-plugin

count lines of code. used in Scala 2 community build; also a near-minimal example Scala 2 compiler plugin
Apache License 2.0
7 stars 2 forks source link

switch from cloc to tokei? #10

Open SethTisue opened 5 years ago

SethTisue commented 5 years ago

Anthony Cerruti suggesting checking out tokei which is faster than cloc, and also more accurate than cloc for at least some languages, not sure about Scala in particular

https://github.com/XAMPPRocky/tokei

SethTisue commented 5 years ago

in scala/scala (2.13.x branch),

% cloc .
   11945 text files.
   10771 unique files.                                          
Complex regular subexpression recursion limit (32766) exceeded at /usr/local/Cellar/cloc/1.80/libexec/bin/cloc line 9051.
    4239 files ignored.

github.com/AlDanial/cloc v 1.80  T=9.21 s (851.7 files/s, 59182.0 lines/s)
--------------------------------------------------------------------------------
Language                      files          blank        comment           code
--------------------------------------------------------------------------------
Scala                          6977          62123          96968         316303
XML                             309              4              7          23737
HTML                             38           2511            431          11246
Markdown                         23           2263              0           8531
Java                            393           1039           1176           5599
CSS                              15            599             65           3659
Bourne Again Shell               23            427            676           2059
JavaScript                       13            212            118           1218
Maven                            21              0              0           1203
DOS Batch                        11            342            383           1055
XSLT                              2             30             16            532
YAML                              5             19             10            154
Bourne Shell                     11             44             57            142
awk                               1              0              3             36
C/C++ Header                      1              2              7             12
C                                 1              2              0              6
--------------------------------------------------------------------------------
SUM:                           7844          69617          99917         375492
--------------------------------------------------------------------------------

% tokei .
-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 BASH                    2          158          120           11           27
 Batch                   1           70           48            0           22
 C                       1            8            6            0            2
 C Header                1           21           12            7            2
 CSS                    12         3481         2967           38          476
 HTML                    3          224          192           13           19
 Java                  404         7927         5695         1180         1052
 JavaScript             10         1478         1163          108          207
 Markdown               23        10794        10794            0            0
 Scala                7169       478017       316065        99488        62464
 Shell                  11          243          133           66           44
 SVG                    13          864          861            0            3
 Plain Text             11        65918        65918            0            0
 XML                    23          135          117            7           11
 YAML                    4          101           92            0            9
-------------------------------------------------------------------------------
 Total                7688       569439       404183       100918        64338
-------------------------------------------------------------------------------

tokei runs instantaneously, cloc takes a little while, but speed is a negligible issue in the context of the community build

for Scala LOC count is very nearly identical at 316K

it looks like there's no compelling reason to switch, but also no compelling reason not to switch

s5bug commented 5 years ago

Tokei seems to recognize many more comments, but is also "missing" files. There is also less blank lines reported in tokei where there are missing files. Tokei might ignore empty files if there are any?

However, tokei reports more Scala files than cloc. (scs and sbts?)