1

I create with cloc a csv file and used this file later in a Java Application.

This app runs on a linux vm, but I develope on a windows PC.

The Problem:

Cloc generate 2 different Header

Command:

cloc . --csv --quiet --by-file --unix

Testoutput via Java Processbuilder.redirectOutput or > cloc.csv in cmd

Header Windows:

language,filename,blank,comment,code,"http://cloc.sourceforge.net v 1.64  T=0.52 s (558.7 files/s, 29979.7 lines/s)"
Java,./b3-eos-ws/src/main/java/com/db/data/data.java,3,0,2048

Header Linux:

     100 files
     200 files
     300 files
Duplicate file check 327 files (278 known unique)
Unique:      100 files                                          
Unique:      200 files                                          
Counting:  100
Counting:  200
Counting:  300
language,filename,blank,comment,code,"http://cloc.sourceforge.net v 1.60  T=0.45 s (591.6 files/s, 34060.2 lines/s)"
Java,./b3-eos-ws/src/main/java/com/db/data/data.java,3,0,2048

Is there a way to hide the lines where cloc count the files ? Or is the only way to remove this in my Java App ?

  • I cannot reproduce that. What is your `cloc` version? which operation system (version)? – hek2mgl Aug 15 '17 at 11:32
  • @hek2mgl The version is 1.60 and the system linux(ubuntu), the version stands in the Header. I found out what the Problem was: I output the file with `Java` and with `> cloc.csv`...both times cloc output sometimes empty lines or other things that the format of each cloc file was different. I post my solution that the Output command was `--report-file=cloc.csv`, so the csv has always the same format without empty lines or sth else. –  Aug 16 '17 at 05:55

2 Answers2

1

Solution:

I try it with

cloc . --csv --quiet --by-file --unix --report-file=cloc.csv

and this works instead of

cloc . --csv --quiet --by-file --unix

and save the file with Java redirectOutput

With this solution the csv has always this format without a blank line on the top or some output from cloc :

language,filename,blank,comment,code,"http://cloc.sourceforge.net v 1.60  T=0.44 s (605.4 files/s, 34856.5 lines/s)"
Java,./git/src/main/java/com/db/data/data.java,3,0,2048
0

According to the man page (invaluable tool, btw) the switch -q will suppress intermediate output (anything but the summary).

tink
  • 14,342
  • 4
  • 46
  • 50