Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go/extractor/extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,12 +815,12 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
displayPath = rawPath
}
if i == len(components)-1 {
lbl := tw.Labeler.FileLabelFor(path)
lbl := tw.Labeler.FileLabelFor(file)
dbscheme.FilesTable.Emit(tw, lbl, displayPath)
dbscheme.ContainerParentTable.Emit(tw, parentLbl, lbl)
dbscheme.HasLocationTable.Emit(tw, lbl, emitLocation(tw, lbl, 0, 0, 0, 0))
extraction.Lock.Lock()
slbl := extraction.StatWriter.Labeler.FileLabelFor(path)
slbl := extraction.StatWriter.Labeler.FileLabelFor(file)
if !isDummy {
dbscheme.CompilationCompilingFilesTable.Emit(extraction.StatWriter, extraction.Label, extraction.GetFileIdx(file), slbl)
}
Expand Down
4 changes: 2 additions & 2 deletions go/extractor/trap/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ func (l *Labeler) GlobalID(key string) Label {
// FileLabel returns the label for a file with path `path`.
func (l *Labeler) FileLabel() Label {
if l.fileLabel == InvalidLabel {
l.fileLabel = l.FileLabelFor(srcarchive.TransformPath(l.tw.path))
l.fileLabel = l.FileLabelFor(l.tw.path)
}
return l.fileLabel
}

// FileLabelFor returns the label for the file for which the trap writer `tw` is associated
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comment describes FileLabelFor as returning "the label for the file for which the trap writer tw is associated", but this function is now a general utility that can be used with any file path, not just the one associated with the trap writer. Consider updating the comment to reflect that it takes an arbitrary path parameter and transforms it. For example: "FileLabelFor returns the label for a file at the given path (after applying path transformation)".

Suggested change
// FileLabelFor returns the label for the file for which the trap writer `tw` is associated
// FileLabelFor returns the label for a file at the given path (after applying path transformation).

Copilot uses AI. Check for mistakes.
func (l *Labeler) FileLabelFor(path string) Label {
return l.GlobalID(util.EscapeTrapSpecialChars(filepath.ToSlash(path)) + ";sourcefile")
return l.GlobalID(util.EscapeTrapSpecialChars(filepath.ToSlash(srcarchive.TransformPath(path))) + ";sourcefile")
}

// LocalID associates a label with the given AST node `nd` and returns it
Expand Down
Loading