cloc
cloc copied to clipboard
Backslashes in Windows paths not escaped in JSON output
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 \\.
Give be968f1 a try. I was able to load a JSON report file from Python (v3.8.3) without issues.