Skip to content

Commit 3663d02

Browse files
committed
Fix bug in FileTree's handling of unused files
The setmap was previously constructed by iterating over node associations, which meant that unused lines (which have no associations) were skipped. Constructing a setmap that includes unused lines requires iterating over all nodes in the specialization tree. Signed-off-by: John Pennycook <john.pennycook@intel.com>
1 parent d37e8c0 commit 3663d02

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

codebasin/report.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -780,9 +780,12 @@ def files(
780780
for f in codebase:
781781
setmap = defaultdict(int)
782782
if state:
783-
for node, assoc in state.get_map(f).items():
784-
if isinstance(node, CodeNode):
785-
setmap[frozenset(assoc)] += node.num_lines
783+
association = state.get_map(f)
784+
for node in [
785+
n for n in state.get_tree(f).walk() if isinstance(n, CodeNode)
786+
]:
787+
platform = frozenset(association[node])
788+
setmap[platform] += node.num_lines
786789
tree.insert(f, setmap)
787790

788791
print("", file=stream)

0 commit comments

Comments
 (0)