Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslashes in Windows paths not escaped in JSON output #546

Open
kamilk opened this issue Dec 11, 2020 · 1 comment
Open

Backslashes in Windows paths not escaped in JSON output #546

kamilk opened this issue Dec 11, 2020 · 1 comment

Comments

@kamilk
Copy link

kamilk commented Dec 11, 2020

Command run on Windows 10, cloc version 1.88:
cloc . --json --out=d:\temp\cloc\stats-PaymentIntegrationTests.json

The following report was produced:

{"header" : {
  "cloc_url"           : "github.com/AlDanial/cloc",
  "cloc_version"       : "1.88",
  "elapsed_seconds"    : 0.316219091415405,
  "n_files"            : 136,
  "n_lines"            : 19454,
  "files_per_second"   : 430.081559564479,
  "lines_per_second"   : 61520.6372041718,
  "report_file"        : "d:\temp\cloc\stats-PaymentIntegrationTests.json"},

...stats go here..

Note that there are only single backslashes in the report_file property. This causes the JSON to be invalid: \t is interpreted as a tabulation but there is no such thing as \c or \s. Because of this, the file cannot be loaded with tools such as the json package in Python. All backslashes in the path should be escaped as \\.

@AlDanial
Copy link
Owner

Give be968f1 a try. I was able to load a JSON report file from Python (v3.8.3) without issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants