A CountLinesOfCode task.

Review Request #3005 — Created Oct. 20, 2015 and submitted

benjyw
pants
6110505...
pants-reviews
jsirois, nhoward_tw
- Shells out to cloc.
- Required some very minor refactoring of BinaryUtil, to support
  scripts that aren't qualified by system.

CI pending: https://travis-ci.org/pantsbuild/pants/builds/86517727

In case you're curious:

fozzie:[~/src/pants][cloc]$ ./pants cloc ::
http://cloc.sourceforge.net v 1.64  T=1.91 s (552.3 files/s, 59289.8 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Python                         735          18409          17412          60279
Java                           165           1623           1626           7013
Scala                           40            346            561           1718
Mustache                        38            183             34           1649
CSS                              4            114             52            832
Javascript                      38            130            112            666
Go                               8             17              3             80
Protocol Buffers                16             43             71             71
JSON                             4              0              0             35
C++                              3              8              0             31
C/C++ Header                     1              4              0             10
XSD                              1              0              0             10
XML                              1              0              0              7
-------------------------------------------------------------------------------
SUM:                          1054          20877          19871          72401
-------------------------------------------------------------------------------
JS
  1. 
      
  2. I think caching tasks that produce IO doesn't make very much sense - even or especially in the new engine.  Caching inputs to these tasks - maybe - when that is available as a division and makes sense.  Here it doesn't make much sense.  There is no easily available product - we'd have to parse cloc output - and the thing is fast enough - even on a large codebase.
    1. It's actually not that fast. Takes a couple of minutes or so to run on all of foursquare. And it's easy to parse cloc output - it can spit out csv if you tell it to.

      Plus in the future I could imagine us wanting to do further analytics on these numbers. At the very least, tracking them over time.

      But I'll remove the comment because it doesn't really add anything right now.

  3. Would be nice to to link this: http://cloc.sourceforge.net/#options
  4. Can you just yield the lines?  Seems easy even if not important for latency feel of the output.
  5. 
      
BE
BE
  1. Thanks John. Submitted as 55290e2b5b7b4ed3e678282a49a11da6f3b2de78.

  2. 
      
BE
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted as 55290e2b5b7b4ed3e678282a49a11da6f3b2de78.

Loading...