boyter/scc

ULOC missing in JSON output format

Closed this issue · 5 comments

Describe the bug
When setting the format output to JSON or JSON2 the ULOC calculations (when --uloc is set) are not in the output

To Reproduce

  1. Run scc --uloc --format json
  2. Look at the output: there is no ULOC metric (while it is there in other formats like csv)

Expected behavior
Add ULOC metric to JSON output format, similar as for CSV

Desktop (please complete the following information):

  • OS: any
  • Version any

Hah! Id id not expect anyone to actually be using ULOC in JSON. I can add it in. Although I also need to add it to some of the other formats too.

Haha, well I really like the idea of your ULOC metric :) Since I'm parsing the results of many repositories I prefer JSON over CSV which is less error prone and has the COCOMO metrics as well.
Would be great if you could add it!

Not my metric, I attribute it to https://cmcenroe.me/2018/12/14/uloc.html but I am happy to have included it.

Ill ensure this makes the next release, which will come with the new version of Go for a nice performance boost.

Merged in. So building from source will give you this now,

scc -f json -a main.go
[{"Name":"Go","Bytes":8869,"CodeBytes":0,"Lines":398,"Code":382,"Comment":6,"Blank":10,"Complexity":10,"Count":1,"WeightedComplexity":0,"Files":[],"LineLength":null,"ULOC":253}]

Of course you do need to pass in the -u or -a argument to get the calculation as you expect.

Great, thanks! :)