Skip to content

Commit

Permalink
fix(csv_as_enclosure_json): files do not match
Browse files Browse the repository at this point in the history
See issue [#10](adamtornhill/maat-scripts#10)

On macOS, cloc saves file paths with leading "./" while
code-maat leaves this prefix out.

As a consequence all weights are set to 0.0 because
the normalized_weight_for(module_name) never finds
a match.

The bugfix removes a leading "./" prefix, if it exists,
when initializing a StructuralElement.

Note: This fix combines the associated bugfix on branch python3
into a single commit.
  • Loading branch information
wonderbird committed Dec 29, 2021
1 parent e76ff60 commit 06c2559
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions transform/csv_as_enclosure_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ def pathParts(self):

def parse_structural_element(csv_row):
name = csv_row[1]
if name.startswith('./'):
name = name[2:]
complexity = csv_row[4]
return StructuralElement(name, complexity)

Expand Down

0 comments on commit 06c2559

Please sign in to comment.