Return files without any tags at all at the tail of the ranked_tags list

This commit is contained in:
Paul Gauthier 2023-06-04 14:53:14 -07:00
parent dfcf813ad6
commit 53e8c65745
2 changed files with 23 additions and 1 deletions

View file

@ -306,8 +306,19 @@ class RepoMap:
continue
ranked_tags += list(definitions.get((fname, ident), []))
rel_other_fnames_without_tags = set(
os.path.relpath(fname, self.root) for fname in other_fnames
)
fnames_already_included = set(rt[0] for rt in ranked_tags)
top_rank = sorted([(rank, node) for (node, rank) in ranked.items()], reverse=True)
for rank, fname in top_rank:
rel_other_fnames_without_tags.remove(fname)
if fname not in fnames_already_included:
ranked_tags.append((fname,))
for fname in rel_other_fnames_without_tags:
ranked_tags.append((fname,))
return ranked_tags