adamtornhill / maat-scripts

Scripts used to post-process the results from Code Maat
GNU General Public License v3.0
74 stars 30 forks source link

csv_as_enclosure_json returns incorrect values because of mismatched paths on Windows #3

Closed colettemoran closed 8 years ago

colettemoran commented 8 years ago

Hi,

It appears that on Windows, the csv_as_enclosure_json.py script will run but returns 0.0 weight for all the paths because of a mismatch between the paths generated by hg log:
Xian/ImageViewer/ClearCanvas.ImageViewer.xml

and the paths returned by Cloc:
.\Xian\ImageViewer\ClearCanvas.ImageViewer.xml

In my clone I've modified parse_structural_element and parse_element_weight to use os.path.normpath on the names, e.g.
name = os.path.normpath(csv_row[0]) but then StructuralElement.parts() splits the paths using / which means nothing gets split, so I modified that to use os.path.sep instead of '/' and that seems to do the job.

colettemoran commented 8 years ago

Scratch that, I see your comment on the other issue about using the --unix parameter with Cloc so it outputs / instead of \, so I'll close this issue.