codecharta icon indicating copy to clipboard operation
codecharta copied to clipboard

cc.json[.gz] is empty

Open christianbaumann opened this issue 1 year ago • 5 comments

Bug

Expected Behavior

WHEN I run cssh tokeiimporter myproject.tokei.json -o myproject.tokei.cc.json

THEN a valid `myproject.tokei.cc.json[.gz]' is created

Actual Behavior

The 'myproject.tokei.cc.json` is empty

Screenshots

Steps to Reproduce the Problem

5 min Generic Metrics Quickstart

Specifications

  • is released in online-demo: no
  • CodeCharta Version: 1.122.0
  • OS: Win 11
  • Browser: Chrome

PS.: Feel free to contact me via MW Teams. ;-)

christianbaumann avatar Feb 02 '24 10:02 christianbaumann

I contacted you.

phanlezz avatar Feb 02 '24 11:02 phanlezz

I did some digging and I think, that there might be a problem with the produced paths by Tokei under Windows. Our Importer seems to struggle with them, and not parse them correctly as paths, but as file names.

phanlezz avatar Feb 05 '24 07:02 phanlezz

As a quick workaround: It should be possible to replace all \\ with / inside the Tokei JSON file and then import it.

phanlezz avatar Feb 05 '24 08:02 phanlezz

It should be possible to replace all \ with / inside the Tokei JSON file and then import it.

I confirm that this works.

christianbaumann avatar Feb 05 '24 08:02 christianbaumann

There are two problems here which we need to investigate:

  1. Created archives with the tokeiimporter are empty
  2. When using the tokeiimporter with a windows based Tokei JSON file, the output can't be displayed in visualization

How (1) and (2) are intertwined is currently unknown. For (2) it needs to be analyzed if the problem is in the cc.json file produced by tokeiiimporter or if the visualization struggles with windows paths. For (1) the circumstances when this happens are currently unknown

Update: Let's focus in this issue on the second point, as the first one can't be reproduced, and it might be a side effect of the second point. If the situation changes, we can update the issue or create a new one.

phanlezz avatar Feb 08 '24 08:02 phanlezz

I did some more testing: Tokei used double backslash as path-separator on Windows. When imported with our module, this must be specified with a single backslash. Furthermore, the single backslash can escape the last quotes " which can lead to miss interpretation of the entered command. It is possible to remove the quotes. I will try to improve our importer here, so that double backslashes can be understood correctly or the separator could be determined automatically

phanlezz avatar Apr 12 '24 11:04 phanlezz