Search code examples
scalapluginsmetricslines-of-code

Scala source code metrics tool (lines of code, lines of comments and so on)


There seems to be so many code analysis tools supporting the java language, but I am so far unable to find one that supports scala (something simple like finding LOC would be nice)? I'm working in intellij so have tried metricsReloaded and Static plugins, but they are completely ignoring the scala files.

Any suggestions would be appreciated.. :)

Edit: Metrics needed is just something like lines of code, lines of comment (% of comments), simple stuff like that

Edit: Thanks everyone, both answers were useful. :) I had to just choose an arbitrary "correct" answer (just gave it to the one with least votes up.


Solution

  • I use cloc and it works just fine. It understands pretty much any language or script out there, it's easy to install - comes as a package on Linux, and easy to use. It can also output to multiple formats like csv, xml, yaml, sql, etc. Here is an example output of one of my projects:

    # cloc .
    
        1145 text files.
         853 unique files.                                          
         937 files ignored.
    
    http://cloc.sourceforge.net v 1.60  T=23.05 s (25.5 files/s, 8260.4 lines/s)
    --------------------------------------------------------------------------------
    Language                      files          blank        comment           code
    --------------------------------------------------------------------------------
    XML                             383            311             26         150875
    Javascript                       18           2330            948           9904
    Scala                           132           1689           1901           8029
    CSS                               8           1266            163           7373
    HTML                             23            459             91           2835
    SQL                              11             11              5            877
    XSLT                              1             30             16            468
    Bourne Shell                      9             57            108            240
    Perl                              1             57            102            227
    Bourne Again Shell                1              2              0              3
    DOS Batch                         1              0              0              2
    --------------------------------------------------------------------------------
    SUM:                            588           6212           3360         180833
    --------------------------------------------------------------------------------