boyter / scc

Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates written in pure Go
MIT License
6.57k stars 262 forks source link

[question] how to show Files column in csv format #433

Closed marslo closed 5 months ago

marslo commented 7 months ago

Describe the bug The Files column ( count of files ) shows in tabular/json format, but doesn't shows in csv format, details as below:

image

To Reproduce

  1. how you were using scc either as command line or library: command line
  2. If command line please list the arguments. If library please supply code to demonstrate the issue.

    # csv
    $ scc --include-ext c,ec,pgc,h,cc,cpp,cxx,c++,pcc,in,hh,hpp,hxx,inl,ipp --no-cocomo --no-size --no-duplicates --format=csv <folder_1> <folder_2> > file.csv
    
    # tabular
    $ scc --include-ext c,ec,pgc,h,cc,cpp,cxx,c++,pcc,in,hh,hpp,hxx,inl,ipp --no-cocomo --no-size --no-duplicates <folder_1> <folder_2>
    
    # json
    $ scc --include-ext c,ec,pgc,h,cc,cpp,cxx,c++,pcc,in,hh,hpp,hxx,inl,ipp --no-cocomo --no-size --no-duplicates --format=json <folder_1> <folder_2> > file.json

Expected behavior Has Files column in csv format, or any params to turn on/off Files column

Desktop (please complete the following information):

boyter commented 7 months ago

This was intentional when I created the csv format, because the underlying idea was that it would be used to create your own aggregations (similar to the SQL output format). As such I kept it as simple as possible because adding calculated columns makes parsing it after a little more annoying.

Whats the use case here? Im not opposed to making changes, but I would really want to know what you are trying to achieve.

marslo commented 5 months ago

Hey @boyter,

I've using scc to collect data and generate slides, and since csv can be recognized by Excel, so it's easy to transfer to chart ( as below ).

csv-ppt-chart

So, if the columns can be configurable via parameters, it will be awesome. Now, I have to manually added ... thanks

boyter commented 5 months ago

Yep I promise the moment I am not swamped at work I will be getting back to doing a lot of these things.

Main goal will be to improve the gitfile support, followed by all of these sort of changes. I have not forgotten, just no time right now.

boyter commented 5 months ago

Done.

$ scc -f csv -u ./processor
Language,Lines,Code,Comments,Blanks,Complexity,Bytes,Files,ULOC
Go,8136,6402,410,1324,1400,369653,23,3293

Files as a count is in the summary now, along with the new special ULOC calculation (if you want it). Will make it into the next release, which should be done in a week or so.

marslo commented 4 months ago

nice thanks. verified !